Sign in to follow this  

lazy shading

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

When working on my home rasterizer i noticed that i shade

all the triangles then later clip it (so i do a lot of unnecessary shading)

 

This is becouse shading is done in world space (when i move models

relative to the lights - all this is done in world space) 

 

.. but as i said it seem to by unnecessary to shade all the triangles tahat

goes dead (filteres out) later - so maybe i could revrite it to do lazy shading

(count only alive set of triangles then back and shade them)

 

I m curious if modern engines (like ogl etc) use this concept or they

shade everything in brute force before the clipping tests?

 

 

 

 

Share this post


Link to post
Share on other sites

Shading is done after clipping. There is literally no point in shading pixels [that the player is supposed to see] which will not be drawn on screen, so they aren't. This is done automatically by the GPU hardware. It should not be too hard to modify your rasterizer to take this into account when shading, I think, it's a fairly basic (and natural) optimization.

Share this post


Link to post
Share on other sites

Shading is done after clipping. There is literally no point in shading pixels [that the player is supposed to see] which will not be drawn on screen, so they aren't. This is done automatically by the GPU hardware. It should not be too hard to modify your rasterizer to take this into account when shading, I think, it's a fairly basic (and natural) optimization.

alright,

possibly, but it was not the feerst seen of this as this is not 100% strightforward (after clipping you have a transformed coordinates and you return to old ones 4 steps back in the pipeline to shade it there

Share this post


Link to post
Share on other sites

 

Shading is done after clipping. There is literally no point in shading pixels [that the player is supposed to see] which will not be drawn on screen, so they aren't. This is done automatically by the GPU hardware. It should not be too hard to modify your rasterizer to take this into account when shading, I think, it's a fairly basic (and natural) optimization.

alright,

possibly, but it was not the feerst seen of this as this is not 100% strightforward (after clipping you have a transformed coordinates and you return to old ones 4 steps back in the pipeline to shade it there

 

 

 

After clipping you do your pixel rasterization, which is the step in which you interpolate all the vertex attributes that you transformed/passed through the vertex transform stage. People often do lighting in view space, and for that all you need is a view space normal to be interpolated for each pixel in order to do lighting. You don't need to go back in the pipeline to get any data.

Share this post


Link to post
Share on other sites

 

 

Shading is done after clipping. There is literally no point in shading pixels [that the player is supposed to see] which will not be drawn on screen, so they aren't. This is done automatically by the GPU hardware. It should not be too hard to modify your rasterizer to take this into account when shading, I think, it's a fairly basic (and natural) optimization.

alright,

possibly, but it was not the feerst seen of this as this is not 100% strightforward (after clipping you have a transformed coordinates and you return to old ones 4 steps back in the pipeline to shade it there

 

 

 

After clipping you do your pixel rasterization, which is the step in which you interpolate all the vertex attributes that you transformed/passed through the vertex transform stage. People often do lighting in view space, and for that all you need is a view space normal to be interpolated for each pixel in order to do lighting. You don't need to go back in the pipeline to get any data.

 

 

you need 'get back' to count a normal there on demand - for clipping I dont need a normal so i must get back for it only to use it for shading at a very later stage (even after 'vertex depth' test (i do such depth clipping on vertexes before rasterisation for speed )) - but dont matter, now im more confuzed by the making light less plastic, see the other thread maybe you could help?

 

(this could be closed as everything's clear)

Share this post


Link to post
Share on other sites

This topic is 1274 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this