light rendering in shaders, slow.

Started by
4 comments, last by suvirbhargav 10 years, 4 months ago

I'm trying to implement light scattering effect.

here is my rendering function http://scsys.co.uk:8002/282348?hl=on&submit=Format+it%21

at the moment, the rendering is horribly slow.

at the moment it looks like this: http://tinypic.com/view.php?pic=taj3vp&s=5#.UpsERx9OXKM

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

Any suggestion how to make rendering better?

Suvir

Advertisement

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?

o3o

it has around 1000 vertices.

i did disable the line

//glViewport(0,0,renderWidth,renderHeight);// make the viewport to normal size

and i see rendering much better. but obviously size gets smaller.http://tinypic.com/view.php?pic=30navps&s=5#.Upsu9B9OXKM

changing samples from 100 to 60 did not show any major improvement.

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)

o3o

By constant you mean NUM_SAMPLES . Yes a value of 50 is good on my laptop. ALthough, effect of ray also reduces at 50, but its ok.

Yes, i'm using OFF_SCREEN_RENDER_RATIO as 2.

On other issue i'm faincg is i'm not able to draw sun as sphere.

http://scsys.co.uk:8002/282693?hl=on&submit=Format+it%21

This topic is closed to new replies.

Advertisement