Quality - Need to get in the bilateral upsample filter, for now you can sacrifice performance for quality by decreasing r.CVarVolumetricLightScatterDownSample
Having more then one VLS in a scene can cause issues - workaround turn off VLS lights when they are out of view with a trigger.
Only been tested with Spot Lights
Spot Light is doing a sphere intersection test to determine wether or not the ray should get drawn - this makes the VLS look kind of wierd - will get fixed when I switch it over to a cone intersection test.
VLS Gets brightner sometimes depending on how close you are to the camera.
Toggling on and off VLS doesn’t work right.
Current VLS Light Options:
Enable Volumetric Light Scatter - Toggles VLS on or off for a given light.
Num VLSRay Steps - This is how many raymarches to do for the VLS highering this number can fix banding, lowering it can cause more banding but will speed up the shader.
VLS isn’t free, it should not be a replacement for cheaper ways of doing god rays. Were VLS really works well is were the light is moving so the rays are moving, or a lot of objects(or one big object) is casting a whole bunch of rays. On NV 600 series cards or higher you should be able to get 1 or 2 VLS lights in a scene going at once and still get around 50-60ms. This shader is very memory bound(as it has to sample from the shadow map for each ray march that is inside of the spot light cone), but I have gotten VLS in under 5 or 6 ms on console hardware.
Some good use cases on games I’ve shipped with VLS enabled:
1) A VLS light is shining down or coming from the floor going up to the ceiling and have a big boss spawn and flex it's muscles and do a bunch of scarey stuff. The VLS amplifies the mood.
2) VLS shinning through tress in a forest were the leafs are moving.
3) AI Flashlights(NOT PLAYER FLASHLIGHTS).
4) A big fan with a VLS light behind it.
An example of when to not use VLS would be god rays shinning through a church window that’s high up were the player never would get inside of the ray.
What would really make me happy, and probably involve throwing money at my screen - is if the volumetric scatter can be modified via a volume texture (say a 3D noise to simulate light passing through varying densities of atmospherics)
That is a great idea but the VLS pass is very memory bound as it is, I feel that adding another sampler during the raymarch might not be worth it. Basically during the VLS pass were doing a bunch of random reads into the shadow map texture, so the L2 cache on the GPU is constantly pulling from VRAM, causing whatever wavefront is processing that part of the shader to basically stall, while it waits for data. I do plan on adding VLS “cookie” textures which would just be a alphed texture that would get copied on to the shadow map that would help people carve out various rays without having to make a bunch of geo for it.
There are a couple ideas that would be cheaper; we can calculate 3d noise of the fly based on various parameters, or we can have a VLS only shadow pass that would render all the same geo as the regular shadow pass but would have VLS only geo inside of it. I don’t know if particles currently cast shadows in UE4, but we can maybe get something to work that would get you close to what your looking for.
VLS isn’t ALU intensive so doing 3d noise on the fly might be a viable option.
Yeah I was just trying to come up with a way to get the same effect without sampling from a pre-generated 3d fractal noise texture during the VLS pass. Rendering geo is way cheaper and might give you what your looking for(if not I can always get something in and we can measure the performance).