Jump to content
Site Stability Read more... ×
  • Advertisement
Sign in to follow this  

Light shafts problem

This topic is 2789 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys.

I am trying to achieve simple light shafts effect and have some weird problem with it.


As you can see the 3/4 of the effect look quite good but there are weird streaks going top left. This is the HLSL code:

[source]float2 texCoords=input.TexCoords;
float4 pos=lightPos;

float2 dir=(texCoords-pos.xy)/SAMPLES;
float3 sum=0.0f;
float add=1.0f;
for(int i=0;i<SAMPLES;i++)
float val=tex2D(tex, texCoords).rgb;

return float4(sum, 1.0f);[/source]

Screen space position of the light looks good. I have no idea what is wrong.

Any advice please?

Share this post

Link to post
Share on other sites
I don't see how a post effect can make a realistic shaft effect with that length. I would make it with deferred rendering by drawing the positions as colors for the front and back side. Then I would sample both images and calculate the amount of light on the fog.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!