- Home /
Sunshaft Image Effect Help
HI-
I have been trying to set up sun shafts in my scene but I haven't been able to get the effect right.
In one of the demo videos for Unity 3, scene geometry appears to affect the casting of the sun shafts. See here: http://www.youtube.com/watch?v=wc1vJ-FixM8&feature=related
I am trying to achieve the same affect but the sun shafts in my scene are ignoring my geometry and always appear overdrawn on my scene geometry.
Is there a setting that needs to be applied to my geometry or my directional light that would solve this problem?
Any ideas appreciated, thanks in advance!
Answer by CPB · Sep 17, 2010 at 11:12 PM
I figured it out.
'Use Depth texture' was set to false, but setting it to true caused the effect to disappear altogether. That was happening because my level was positioned inside a sphere mesh which I was using for a sky. The sun shafts were being blocked by this mesh.
The fix for that was to add a second camera to my player. The main camera clear flags were set to Depth Only and I put the sphere mesh "sky" in its own layer which I then removed from the culling mask. The second camera clear flags were left as default, and the culling mask was set to render nothing but the sky mesh. I then changed the Depth setting for the Main Camera to 1.
FYI- If you want to be able to see the sun shaft effect through windows or other transparent material you will have to use this same approach, otherwise the sun shafts will by overdrawn but the mesh for your window.
Just curious, would it also have been possible to simply place your dyson sphere on the "ignore raycast" layer?
I'd recomend to try it out yourself, it'd be good practice as well...
Your answer
Follow this Question
Related Questions
Sun Shafts from a single Light Source? 1 Answer
How can i set the sun transform value on the SunShafts script? 1 Answer
How to Create Sunbeam Particle 1 Answer
Sun Shafts with z buffer on flicker in Deferred mode 0 Answers
Sun Shafts upside down 0 Answers