npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

com.ellyality.visual.volumetric.lighting

v1.0.9

Published

Provide basic udp connection

Downloads

4

Readme

Volumetric Lights for Unity 5.5 up to 2023!

IMAGE ALT TEXT HERE IMAGE ALT TEXT HERE

This version is based on: https://github.com/SlightlyMad/VolumetricLights/

  • Grouped everything into one folder and one sampled scene
  • Added custom noise and dithering (a sample blue noise texture is provided)
  • Made it work seamlessly with NGSS
  • Added ZReverse check instead of platforms checks
  • Added shadows fadeDistance

Open source (BSD) extension for built-in Unity lights. It uses ray marching in light's volume to compute volumetric fog. This technique is similar to the one used in Killzone (GPU Pro 5: Volumetric Light Effects in Killzone Shadow Fall by Nathan Vos)

Corresponding thread in Unity Forum can be found here.

Demo Project

I developed this technology for my hobby project. It was never meant for real use and it is therefore little rough around the edges.

You can see the demo on Youtube. Or you can try it for yourself: Binary download

Features

  • Volumetric fog effect for multiple lights. Point, spot and directional lights are fully supported.
  • Volumetric shadows
  • Volumetric light cookies
  • Volumetric noise implemented as animated 3D texture.

Usage

  • Add VolumetricLightRenderer script to your camera and set default cookie texture for spot light.
  • Add VolumetricLight script to every light that you want to have volumetric fog.

Volumetric lights will respect standard light's parameters like color, intensity, range, shadows and cookie. There are also additional parameters specific for volumetric lights. For example:

  • Sample count - number of raymarching samples (trade quality for performance)
  • Scattering Coef - scattering coefficient controls amount of light that is reflected towards camera. Makes the effect stronger.
  • Extinction Coef - controls amount of light absorbed or out-scattered with distance. Makes the effect weaker with increasing distance. It also attenuates existing scene color when used with directional lights.
  • Skybox Extinction Coef - Only affects directional light. It controls how much skybox is affected by Extinction coefficient. This technique ignores small air particles and decreasing particle density with altitude. That often makes skybox too "foggy". Skybox extinction coefficient can help with it.
  • MieG - controls mie scattering (controls how light is reflected with respect to light's direction)
  • Height Fog - toggle exponential height fog
  • Height Fog Scale - scale height fog
  • Noise - enable volumetric noise
  • Noise Scale - noise scale
  • Noise Speed - noise animation speed

Several sample scenes are part of this project.

Building a standalone player

IMPORTANT - Standalone player will work only if all shaders are included in build! All shaders must be added into "Always Included Shaders" in ProjectSettings/Graphics.

Example scene with different parameters

  • Low/High Scattering and Extinction parameters
  • Low/High Mie G parameter
  • High/Low Shadow Strength. This technique uses single scattering model. That makes areas in shadow unnaturally dark. Use Shadow Strength to "simulate" multiple scattering.
  • Height fog with different scale
  • High/Low Skybox Extinction parameter

Rendering resolution

Volumetric fog can be rendered in smaller resolution as an optimization. Set rendering resolution in VolumetricLightRenderer script.

  • Full resolution - best quality, poor performance. Serves as a "ground truth".
  • Half resolution - best quality/performance ratio.
  • Quarter resolution - experimental. Worse quality, best performance.

Requirements

  • Unity 5 and 2022 ~~(tested on 5.3.4, 5.4 and 5.5)~~
  • DirectX 10/11 or OpenGL 4.1 and above
  • Tested on Windows and Mac but it should work on other platforms as well
  • VR isn't supported
  • Mobile devices aren't supported

Known Limitations

  • ~~Currently requires HDR camera and deferred renderer~~
  • ~~Currently requires DirectX 11~~
  • Doesn't handle transparent geometry correctly (cutout is ok)
  • ~~3d noise texture is hard coded. VolumetricLightRenderer has custom dds file loader that loads one specific 3d texture (Unity doesn't support 3d textures loaded from file). File "NoiseVolume.bytes" has to be in Resources folder.~~
  • ~~Shadow fading is not implemented~~
  • Parameters and thresholds for bilateral blur and upscale are hard-coded in shaders. Different projects may need different constants. Look into BilateralBlur.shader. There are several constants at the beginning that control downsampling, blur and upsampling.

Technique overview

  • Create render target for volumetric light (volume light buffer)
  • Use CameraEvent.BeforeLighting to clear volume light buffer
  • For every volumetric light render light's volume geometry (sphere, cone, full-screen quad)
    • Use LightEvent.AfterShadowMap for shadow casting lights​
    • Use CameraEvent.BeforeLighting for non-shadow casting lights​
    • Perform raymarching in light's volume​
      • Dithering is used to offset ray origin for neighbouring pixels​
  • Use CameraEvent.AfterLighting to perform depth aware gaussian blur on volume light buffer
  • Add volume light buffer to Unity's built-in light buffer

Possible improvements

  • Light's volume geometry is unnecessarily high poly
  • Ray marching is performed in view space and every sample is then transformed to shadow space. It would be better to perform ray marching in both spaces simultaneously.
  • Add temporal filter to improve image quality and stability in motion. Change sampling pattern every frame to get more ray marching steps at no additional cost (works only with temporal filter)
  • Bilateral blur and upscale can be improved
  • I didn't try to optimize the shaders, there is likely room for improvement.

Donations

I've been asked about donation button several times now. I don't feel very comfortable about it. I don't need the money. I have a well paid job. It could also give the impression that I would use the money for further development. But that is certainly not the case.

But if you really like it and you want to brighten my day then you can always buy me a little gift. Send me Amazon or Steam gift card and I'll buy myself something shiny. You can find my email in my profile.