Giter Club home page Giter Club logo

unity-srp-vxgi's Introduction

Unity - Scriptable Render Pipeline - Voxel-based Global Illumination

Showcase

Screenshot 1 Screenshot 2

Requirements

  • Unity 2019.
  • Shader Model 4.5 or newer.
  • Graphic API that supports geometry shader (this excludes Metal API).
  • Approximately 1GB of VRAM for highest voxel resolution setting.

Installation

This method is the easiest way to install a package. Just add the following dependency to <project path>/Packages/manifest.json:

{
  "dependencies": {
    "com.looooong.srp.vxgi": "https://github.com/Looooong/Unity-SRP-VXGI.git"
  }
}

If you want to fiddle with the source code while using this package, you can install the package locally.

For more information on how to manage UPM package, please refer to this.

Usage

Enable VXGI Render Pipeline

  • Goto Asset/Rendering/VXGI Render Pipeline Asset to create a new VXGI render pipeline asset.
  • Open Project Settings window by going to Edit/Project Settings....
  • Assign the newly created render pipeline asset to Graphics/Scriptable Render Pipeline Settings.

Enable VXGI Rendering on a Camera

  • Add VXGI component to a Camera.
  • Assign tag MainCamera to the same Camera to preview VXGI rendering in Scene View.
  • Optional: Add VXGI Mipmap Debug to the same Camera to visualize the voxel mipmap volume.

Apply VXGI materials to objects in the Scene

Apply the material that uses one of the following VXGI shaders:

  • VXGI/Standard and VXGI/Standard (Specular setup)
    • Only Albedo, Metallic, Specular, Smoothness, Normal Map and Emission are supported.
  • VXGI/Particles/Standard Unlit
    • Only Additive rendering mode is supported.

Light Sources

Directional light, point light and spot light are supported. Lighting fall-off follows the inverse-squared distance model without range attenuation. The fall-off model will be expanded with more options in the future.

Configuration

VXGI Component Properties

  • Voxel Volume:
    • Follow Camera: make the voxel volume center follow the camera position.
    • Center: the center of the voxel volume in World Space.
    • Bound: the size of the voxel volume in World Space.
    • Resolution: the resolution of the voxel volume.
    • Anti Aliasing: the anti-aliasing level of the voxelization process.
    • Mipmap Filter Mode: specify the method to generate the voxel mipmap volume.
    • Limit Refresh Rate: limit the voxel volume refresh rate.
    • Refresh Rate: the target refresh rate of the voxel volume.
  • Rendering:
    • Indirect Diffuse Modifier: how strong the diffuse cone tracing can affect the scene.
    • Indirect Specular Modifier: how strong the specular cone tracing can affect the scene.
    • Diffuse Resolution Scale: downscale the diffuse cone tracing pass.

VXGI Mipmap Debug Component Properties

  • Mipmap Level: Mipmap level to visualize.
  • Ray Tracing Step: how big is a step when ray tracing through the voxel volume.
  • Filter Mode: visualization filter mode.

Known Issues and Limitations

  • VXGI uses geometry shader, which is not supported by few graphics APIs, e.g., Metal.
  • The content of Unity UI element is not displayed in Scene View, but only bounding Rect Transform is displayed. Unity UI element is displayed normally in Game View.

Contributing

All pull requests are welcome.

License

MIT

Backers

Thank you for your support! ๐Ÿ™

David Jeske

Acknowledgement

This project is inspired by sonicether/SEGI.

Icons made by Freepik from www.flaticon.com.

unity-srp-vxgi's People

Contributors

looooong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unity-srp-vxgi's Issues

Poping particles shadows on dynamic mesh

Your addon's effect is so great.But when i try to generate some procedural mesh
https://imgur.com/euTGxR3
There are some particles shadow will pop out and appear randomly.(From the picture it seems aceptable ,by if run in video it looks very anoying )

Is there any way i can avoid this issue happen.The shadow will follow the direction light.And
I found it's related to the voxel?When the resolution is low,the particle shadow will become bigger.

This issue seems won't happen in the static mesh.

NormalMap and HeightMap assign not working

Hi,Looooong.I have downloaded this texture and try to recreate the material in VXGI. https://cc0textures.com/view.php?tex=Tiles20

_col.jpg assign to Abedo
_rgh assign to Metallic
_nrm.jpg assign to NormalMap
_disp assign to HeightMap

That works well in standard3d mode.

But in VXGI.Only the abedo and metallic works well.

The normal map in some aspects can work.But I find I can't adjust the intensity value next to the "NormaMap".I can only go to the texture import settings to set the Bumpiness and press the apply to effect the normalMap.

And the height map doesn't have any effect apply to the material.Though I have already twisted the value.

Add at least minimal docs

Just a few bullet points that summarise getting the render pipeline set up. Something you can skim read in 20 seconds rather than having to find headphones and listen to the first 5 minutes of a YouTube video!

How to display Text in VXGI

I tried to create "GameObject - UI - Text" in VXGI mode. But the text didn't show. Although i set the font material to VXGI material,it just shows a bunch of rectangles~

Can't get transparency working

Spent few hours trying to get VXGI working, but transparency is not working, or maybe my settings are wrong.
here is the settings
Issue

Ingame screenshot
Unity 2020-07-08 19-50-24-29

Newest branch's color problem

When i use the " Add Spherical Harmonics pass and environment settings " 's branch,everything is fine except the post process's depth of field is flip.So i import the newest branch base on this branch in the same scene.But I find the color changed a lot.

The picture above is original.The second one is after import.the lighting looks very flat
img

Rework mipmap filtering algorithm

Currently, the volume resolution of each mipmap texture is 2n+1. This ugly number was chosen because it was implemented using 3x3x3 Gaussian kernel.

image

image

However, I think that choosing 3x3x3 Gaussian kernel was a poor decision. I suspect that the 2n+1 resolution doesn't fit nicely on the GPU memory architecture, which may impact GPU read/write performance.

Instead, we can perform mipmap filtering using 4x4x4 Gaussian kernel on light texture with the resolution of 2n. Beside fitting nicely on GPU memory, we can also divide the compute shader thread groups equally. Voila!

image

image

[Question] Use case of voxel GI

Hi Looooong, could you give me an idea of use cases where voxel GI is a better option?
I think that voxel GI would better for procedural worlds.
Am I right? Or am I not even close?

Light intensity defaulting to 10 at runtime

Hi!
First off, great stuff! The output is beautiful! :) However I have noticed that nomatter how I set the intensity of the directional light in the scene, it will set itself back to 10 every time I press play.

This can be reproduced by starting any scene with a directional light.

I'm not sure if you want a seperate bug for this but if i create a box with walls that are made of 5 unit thick boxes, the inside still has light even if the ambient light is set to 0x000000 like so:

2019-08-13_11-27-23

If is change the directional lights intensity to 1 it looks like so:

2019-08-13_11-35-38

(which is much better - i set the walls to 1 unity thick and it seems to only leak a little light)

Anyway thanks for your efforts!

Alia

PostProcessingV2 not working on VXGI

Hi,Looooong,I found PostProessingV2 not working on VXGI.
Usually,i follow this steps can make it work.

1.Download postProcessingV2 package,(I have tried 2.1.7 and 2.0.17)
2.Add two scripts: Post Process Layer and Post Process Volume in the main Camera.
3. Set the camera layer into "Postprocessing"
4.Create a Post-Processing profile in the Assets file and assign it to the Camera's Post Process Volume component's Profile

Then,in the Post Process Volume component ,click the is Global and add different effect on it will see the PostProcess effect.Like Vignette or sth else.

But in VXGI is not successful ,did I miss any steps?

Particle system functionality

I'm having some issues with particle systems. They either seem to not render at all, or render through all geometry.

Here's a video:
PaleForcefulHind-size_restricted

Do yo have a guide on how to use particle systems? Or is this a bug?

I'd appreciate your help. ๐Ÿ‘‹

How to set enviroment lighting

Hi,Looooong.Your VXGI addon is great.But I don't know where to set the environmental lighting.In SEGI, I can go to the LightingSetting - envirment lighting - ambient color to set.But in VXGI this doesn't work.So the shadows are alway very dark.I can't make a bright environment~

Is it possible to set the VXGI's resolution?

Hello.Looooong.Is it possible to custom the resolution in VXGI? Where can i modify? I know the XYZ axizs use the same resolution like a cube.But in some situation.If there's a very long object like 8 * 1 * 1 i want to render on the screen. Then there is a lot of space is useless.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.