Convert Figma logo to code with AI

sonicether logoSEGI

A fully-dynamic voxel-based global illumination system for Unity

1,495
170
1,495
10

Top Related Projects

Post Processing Stack

4,049

A generic post-processing injector for games and video software.

2,633

Real-Time Rendering Framework

Quick Overview

SEGI (Screen-Space Global Illumination) is a Unity asset that provides real-time global illumination for Unity projects. It uses screen-space techniques to calculate indirect lighting, reflections, and ambient occlusion, offering a performance-friendly alternative to traditional global illumination methods.

Pros

  • Provides real-time global illumination without the need for pre-baking
  • Relatively lightweight and performant compared to other GI solutions
  • Easy to integrate into existing Unity projects
  • Customizable settings for balancing quality and performance

Cons

  • Screen-space techniques can have limitations in certain scenarios (e.g., off-screen objects)
  • May require fine-tuning for optimal results in different scenes
  • Performance impact can be noticeable on lower-end hardware
  • Limited documentation and support compared to Unity's built-in lighting solutions

Code Examples

// Enable SEGI in your scene
public class SEGIManager : MonoBehaviour
{
    void Start()
    {
        SEGI segi = Camera.main.gameObject.AddComponent<SEGI>();
        segi.enabled = true;
    }
}
// Adjust SEGI settings at runtime
public class SEGIController : MonoBehaviour
{
    public SEGI segi;

    void Update()
    {
        segi.voxelResolution = 256; // Set voxel resolution
        segi.temporalBlendWeight = 0.1f; // Adjust temporal blending
        segi.infiniteBounces = true; // Enable infinite bounces
    }
}
// Toggle SEGI on/off based on performance
public class SEGIPerformanceToggle : MonoBehaviour
{
    public SEGI segi;
    public float fpsThreshold = 30f;

    void Update()
    {
        float currentFPS = 1.0f / Time.deltaTime;
        segi.enabled = (currentFPS > fpsThreshold);
    }
}

Getting Started

  1. Import the SEGI asset into your Unity project.
  2. Add the SEGI component to your main camera:
using UnityEngine;

public class SEGISetup : MonoBehaviour
{
    void Start()
    {
        Camera.main.gameObject.AddComponent<SEGI>();
    }
}
  1. Adjust SEGI settings in the inspector to fit your scene's needs.
  2. Build and run your project to see the global illumination in action.

Competitor Comparisons

Post Processing Stack

Pros of PostProcessing

  • Official Unity package, ensuring compatibility and long-term support
  • Comprehensive set of post-processing effects, including bloom, color grading, and depth of field
  • Regular updates and optimizations for performance across various platforms

Cons of PostProcessing

  • May have higher performance overhead compared to SEGI's focused approach
  • Less specialized in global illumination effects, which is SEGI's primary focus
  • Potentially more complex setup for achieving specific lighting effects

Code Comparison

SEGI (Shader snippet):

float3 indirectDiffuse = SampleVolumetricGI(_IndirectDiffuseTexture, worldPos, normal, coneWidth);

PostProcessing (C# snippet):

[Tooltip("Indirect lighting multiplier.")]
public FloatParameter indirectLightingMultiplier = new FloatParameter { value = 1f };

The SEGI code snippet shows a direct sampling of volumetric global illumination, while the PostProcessing snippet demonstrates a parameter for adjusting indirect lighting intensity, highlighting the different approaches to handling lighting effects in these repositories.

4,049

A generic post-processing injector for games and video software.

Pros of ReShade

  • More versatile, supporting a wide range of post-processing effects for various games
  • Actively maintained with frequent updates and a large community
  • Easier to use with a user-friendly interface for configuring effects

Cons of ReShade

  • May have a higher performance impact due to its broader range of effects
  • Less specialized for global illumination compared to SEGI
  • Requires more manual configuration to achieve specific lighting effects

Code Comparison

SEGI (HLSL shader code):

float3 IndirectLighting(float3 albedo, float3 normal, float3 viewDir, float roughness)
{
    float3 indirectDiffuse = SampleIndirectDiffuse(normal);
    float3 indirectSpecular = SampleIndirectSpecular(normal, viewDir, roughness);
    return albedo * indirectDiffuse + indirectSpecular;
}

ReShade (Generic effect code):

float4 PS_Main(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
    float4 color = tex2D(ReShade::BackBuffer, texcoord);
    color.rgb = ApplyCustomEffect(color.rgb);
    return color;
}
2,633

Real-Time Rendering Framework

Pros of Falcor

  • Comprehensive rendering framework with extensive features
  • Strong industry backing from NVIDIA
  • Regular updates and active development

Cons of Falcor

  • Steeper learning curve due to complexity
  • Requires more powerful hardware to run effectively
  • Less suitable for quick prototyping or small-scale projects

Code Comparison

SEGI (Global Illumination):

float3 IndirectLighting = SampleVoxelMipmap(worldPos, normal, roughness);
finalColor += IndirectLighting * albedo;

Falcor (Path Tracing):

PathTracer::TraceRay(const Ray& ray, Scene::SharedPtr pScene, SampleGenerator& sg)
{
    Intersection isect;
    if (pScene->intersect(ray, isect))
    {
        return EvaluateMaterial(isect, ray, sg);
    }
    return float3(0);
}

SEGI focuses on voxel-based global illumination, offering a simpler implementation for indirect lighting. Falcor provides a more comprehensive path tracing solution, allowing for more accurate and versatile rendering techniques at the cost of increased complexity.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

SEGI

A fully-dynamic voxel-based global illumination system for Unity. More details at http://www.sonicether.com/segi/

Installation

Check the Releases section above to download a version of SEGI that is a simple .unitypackage file which is ready for you to import into your project.

You can also click the "Clone or Download" button and select "Download Zip", then extract the contents to "Assets/SEGI" in your project to test out the latest unreleased versions of SEGI.

All the scripts and files for SEGI must be in "Assets/SEGI" for SEGI to fully function properly in your project.

Please refer to the User Guide.pdf for usage instructions.

Community

If you need some help, feel free to ask any questions in the official thread on Unity forums.