Giter Site home page Giter Site logo

orels1 / unity-baked-volumetrics Goto Github PK

View Code? Open in Web Editor NEW

This project forked from frostbone25/unity-baked-volumetrics

1.0 1.0 0.0 7.23 MB

A work in progress graphics solution for completely baked volumetric lighting, meant to be very lightweight and inexpensive.

License: MIT License

C# 80.63% ShaderLab 19.37%

unity-baked-volumetrics's Introduction

Unity Baked Volumetrics

A work in progress graphics solution for completely baked volumetric lighting, meant to be very lightweight and inexpensive for VR.

More details will be revealed but it's very much a work in progress...

Results

sponza1

sponza2

sponza3

yakohama1

yakohama2

yakohama3

Context

NOTE: Constructed on the Built-In Rendering Pipeline.

The general concept is the following...

You define a box volume within your scene. You set the voxel density for ths volume (or you can set a custom resolution), and choose to either sample colors from the scene light probes, or a custom raytracer, or both. Each have their advantages and drawbacks, but from there you use that to generate a 3D texture that is saved into the disk. At runtime, we sample this 3D texture and raymarch through it against the scene depth buffer to get the desired effect.

There are 2 versions of this effect, one being a "scene" based solution, and the other being a proper post process version.

The scene based solution is for circumstances where you don't have the abillity to create custom post processing effects. Why the heck would this be the case? A good example of this scenario is VRChat where you can't make custom post processing effects, but you can still make shaders within the scene itself. Note that this shader requires that there is a camera rendering a camera depth texture. This works automatically for deferred rendering, but for forward rendering the camera depth texture flag must be enabled. (QUICK HACK: if that cant be done, another wierd quirk of the post processing stack is that you can enable ambient occlusion which automatically sets off the camera depth texture generation flag and therefore allows this effect to work.)

The post processing based version is a work in progress currently, and is meant to be the proper implementation of this effect. It also allows me to leverage more techniques to make the effect way more efficent and lightweight at runtime. It works currently... but there is alot more I want to do to it.

Will be elaborated on but yes this has been tested and works on Oculus/Meta Quest 2.

TODO

  1. POST PROCESSING - Adding interleaved rendering to save on performance.
  2. POST PROCESSING - Adding temporal filtering and animated noise to accumulate samples and save on performance.
  3. POST PROCESSING - Using a froxel to intersect multiple volumes in a scene, and raymarch only once (rather than raymarch for each volume in the scene which would be dumb).
  4. OFFLINE VOLUME GENERATION - Improve the raytraced volume speed by multithreading.
  5. OFFLINE VOLUME GENERATION - Create a custom pathtraced/raytraced solution that voxelizes the scene within the volume and traces against it rather than relying on scene light probes which can be low quality (Could also be potentially faster than the current CPU only implemntation of the raytracer?).
  6. EDITOR - Previewing Voxels is really really slow at low density values.

unity-baked-volumetrics's People

Contributors

frostbone25 avatar

Stargazers

R3TR0MAX avatar

Watchers

 avatar

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.