Volumetric Lighting in the World. How to?

I have a question on how to implement something similar to the ‘GLOBAL VOLUMETRIC SCATTER LIGHTING’ found in Blender 2.8 and greater.

Here is a screenshot of a scene:


Here is a GIF of it in action. This is in the editor and it’s real time using their rendering engine EEVEE
20-07-27_Capture-1595874372

Now I’m not even sure where to begin to implement this, but I assume I’d make a custom shader that would be able to take the lighting information and create this affect.

I don’t need it to be HIGH QUALITY since I’m trying to go a bit more retro/lowfi in terms of the visuals, BUT having this along with some other ‘NEXT GEN’ graphical implementation, it could make for a fantastic new style. Anything to help me get started on this would be fantastic :smiley:

Something along the lines of the game INSIDE running on browser
Example of the game INSIDE:

I found some examples that are for three.js but curious what more expert opinions would look like based on this


http://bkcore.com/blog/3d/webgl-three-js-volumetric-light-godrays.html

Hi @Robotpencil,

I’ve done something similar in the past to render light shafts from the sun.

You will have to use a post process effect to render the scene a second time while applying your custom shader. You can start with these tutorials on how to apply a post process effect, and then study your three.js link on what shader is required:

https://developer.playcanvas.com/en/tutorials/?tags=posteffects

2 Likes

MY DUDE! You rock!

Any clues for great resources on how to learn this stuff in general? I’m about to create a ShaderToy Account to learn with but curious if I can do it straight out of playcanvas??

Also was planning on looking at some of your stuff too! :smiley: You are awesome, love the stuff you do :slight_smile:
Do you know if you are able to do the volumetric lighting stuff with point lights? or just an overall Directional Light.

See in blender it’s global so any new light you apply begins to have that affect you see in my first post.

Cheers,
AJ

1 Like

I haven’t looked at point lights yet, I know the process would be similar but it will be a bit more complex for multiple lights and definitely will have a performance hit. Which may be ok for simple/smaller scenes like product configurators.

You can find a lot of shaders on shadertoy for this kind of thing, so when you start feeling comfortable writing post process effects you can give it a go transferring those in Playcanvas.

It’s a long process, especially in the beginning, but quite rewarding! Good luck :wink:

What also helps is to learn the theory behind how the effect works, here is a great post on how the Witcher 3 implemented light shafts. It provides the logic and also screen grabs of the various render parts of the effect:

4 Likes