Skip to content

A volumetric light scattering effect created for Serious Point Games

Notifications You must be signed in to change notification settings

Josephy5/VolumetricLightScattering-UnityURP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Godrays

Volumetric Light Scattering / God rays

Unity Version Unity Pipeline Support (Built-In) Unity Pipeline Support (URP) Unity Pipeline Support (HDRP)

A Volumetric light scattering effect that is used to replicate the visuals of god rays in Unity. It was created for Unity URP (6000.0.27f1) and for Serious Point Games as part of my studies in shader development. It could theoretically run on Unity 2022 since its using the same code I used for the effects's render feature and pass within Unity 2022, but it is untested.

This effect only works on one directional light, and does not support point, spot, or multiple directional lights.


Note: I have previously created a separate volumetric light scattering effect in Unity 2022 for my own personal use. The code I used for that effect is entirely different from the code in this repository. However, I might reuse some of the light marching or other light scattering related code from this repository to my personal one, as it is better than what I developed earlier for that effect.


Features

  • Fully adjustable screen-based ray marched godrays
  • Can choose to use Schlick or Henyey Greenstein
  • Adjustable downsampling
  • Adjustable via Volume Component

Example[s]

Godrays
What it looks with the effect on

GodraysWithout
What it looks without the effect

Installation

  1. Clone repo or download the folder and load it into an unity project.
  2. Ensure that under the project settings > graphics > Render Graph, you enable Compatibility Mode on (meaning you have Render Graph Disabled).
  3. Add the render feature of the effect to the Universal Renderer Data you are using.
  4. [Optional] Create a volume game object and load the effect's volume component in the volume profile to adjust values
  5. If needed, you can change the effect's render pass event in its render feature under settings.

Credits/Assets used

Some of the shader code is based on Mr-222’s Unity Volumetric Rendering Repo’s Volumetric Lighting code. GitHub Repo Link

"Mossy/Grassy Landscape" (https://skfb.ly/6RYvL) by Šimon Ustal is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/by/4.0/). No changes made. (The mountain landscape that you see in the screenshots for demonstration purposes)