@Stephanowicz wrote:
Hi there!
Well after having a real hard time finding a SIMPLE example for casting light shafts I finally managed to port the Volumetric Lighting Tutorial by Nicolas Menzel to monogame.
His turorial is based on the GPUGems 3 article "Volumetric Light Scattering as a Post-Process" by Kenny Mitchell from EA
Surely there are lots of examples, but mostly in XNA4 or too complicated for me as a beginner.
The source by Nicolas isn't that simple, too, as there's lot of unused stuff - but I finally got it running!So I put the project to gitHub and want to give a quick description, hoping that it may help others desperate like me finding a simple solution.
I've splitted the project into to parts - the uncleared original port, also containing all the unused original functions and a cleared, basic version with only the necessary stuff inside.
The original consisted of 2 projects I merged into one.
I'm using a different model, as I had problems with the original gears and the cube textures. I found a nice sphere with breakouts at cgtraderI also added a controls-form for easily manipulating the light shaft parameters.
Project structure:
- Game1.cs - the main game class
- Controls... - the control form class
- PostScreenEffects.cs - class for the post screen effect handling
As a raw order for generating a light shaft effect one could say:
- Generate several render targets for the different steps
- render the models with textures and other lighting (this step can be anywhere before steps 8,9)
- render an occlusion mask of the scene
- render the background texture containing the lightsource (the flare) and the occlusion mask to a new render target (blending)
- downscale the blended target from step 4 and apply a linear filter
- apply the lightshaft effect to this downscaled target
- upscale the result
- combine the targets (step 2 and step 7) to the final target
- draw the final target to screen
So far, for this moment… hope to add some more details next time!
Cheers,
Stephan
Posts: 1
Participants: 1