Advertisement Jump to content
Sign in to follow this  

light rendering in shaders, slow.

This topic is 1874 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

I'm trying to implement light scattering effect. 

here is my rendering function

at the moment, the rendering is horribly slow.

at the moment it looks like this:

fragment shaders i'm using same as in tutorial, unchanged.


Any suggestion how to make rendering better?



Share this post

Link to post
Share on other sites

Does the lag significantly reduce if you lower the constant (which currently is set at 100) in the shader?


Also your render function, go through it and make sure that everything in it actually needs to be done every frame. If theres stuff that only needs to be done once, move it outside.


Also how big is that model of yours?

Edited by Waterlimon

Share this post

Link to post
Share on other sites

1) Find if the high number of texture samples is the culprit (try setting the constant to like 5)


2) If it is, try:

a) Running it over a lower resolution input (take your scene, downsample it to lets say halve the dimensions)

b) Reducing the constant (this should not affect the quality as negatively if you do a. If you halve the dimensions of the input, i think you should halve the constant too)

c) Reducing the resolution of the output (eg render this effect onto a low resolution buffer, then render that on top of your scene)

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!