Login | Register 
FEATURES
APPLICATIONS
DOWNLOADS
EDUCATION
BLOG
WIKI
FORUM
STORE

Deferred Shading

Helpful techniques for working with TouchDesigner. Answers only, no questions.

Deferred Shading

Postby malcolm » Wed Jun 18, 2008 6:36 pm

Here's another neat rendering technique. This one is called Deferred shading. The idea with this one is that instead of rendering and calculating lights while you rendering your geometry; instead, you render out relevant spacial information about the geometry to the Render TOP. For example you output the position, the normal, the UV, the shininess of the material, the diffuse color of the material to the Render TOP instead. You do this using floating point color buffers, and multiple render targets. (since a single color buffer can't hold all of this information)

Then using this information you can apply a light to the scene as a post process. The benefits of this are:
1. There is no limitation (except for speed) of the number of lights you can use. In a normal render you'd be limited to 3-7 lights (depending if they are point or spot lights).
2. Greatly increasing the geometry in the scene will still result in the exact same lighting cost as simple geometry. This is because the light cost is calculated by ((width*height*complexity of light shader) in this technique. Adding more geometry to the scene doesn't change any of those values. The technique is particularly useful in scenes with a large amount of overdraw (look into the wiki for an article on overdraw).
It's use is of course situational, but a useful idea to have in your pocket in case the need arises.
Attachments
DeferredShading.toe
(6.15 KiB) Downloaded 862 times
User avatar
malcolm
Staff
 
Posts: 3948
Joined: Tue Nov 13, 2007 1:11 am

Re: Deferred Shading

Postby Achim » Thu Jun 19, 2008 2:54 am

thanks a lot for that example Malcolm. very useful

Instead of having a separate TOP for each light, is it also possible to add all the lights in a single TOP? If yes, will it be slower/faster?
This does not work well with transparent objects, does it?


Also, it would be nice if everybody could post the FPS they get with this file
I get 21fps with a 7800GT
So I'm gonna need a new card soon
Achim
 
Posts: 1659
Joined: Wed Nov 14, 2007 1:52 pm

Re: Deferred Shading

Postby malcolm » Thu Jun 19, 2008 12:26 pm

Ya this technique is poor with transparent objects, but there are some workarounds.
You could definitely merge the GLSL TOP shaders together so you do multiple lights per pass, and yes it'd be faster. I just left them split out to make it easier to see whats happening.
User avatar
malcolm
Staff
 
Posts: 3948
Joined: Tue Nov 13, 2007 1:11 am

Re: Deferred Shading

Postby Achim » Thu Jun 19, 2008 1:47 pm

Thanks Malcolm,
it's definitely easier to follow with each light split to a separate TOP. Having an example which does it in one TOP would be great one day.

If you find some time, could you also please elaborate on the transparency workarounds?
Achim
 
Posts: 1659
Joined: Wed Nov 14, 2007 1:52 pm

Re: Deferred Shading

Postby malcolm » Thu Jun 19, 2008 1:58 pm

I've never actually tried to implement the workarounds, just seen them mentioned in a few articles. Your best bet is to google deferred shading and find papers on it for the workarounds.
User avatar
malcolm
Staff
 
Posts: 3948
Joined: Tue Nov 13, 2007 1:11 am

Re: Deferred Shading

Postby Achim » Thu Jun 19, 2008 2:10 pm

will do. thx
Achim
 
Posts: 1659
Joined: Wed Nov 14, 2007 1:52 pm

Re: Deferred Shading

Postby OMD » Tue Feb 18, 2014 6:35 am

Is these techniques also ussefal ive you would like to project a Gobo ore picture? There is no shadow techniques?

These is a Example about the idea that I have to create. A lot off light fixtures that creates a volumetric light beam and the possibility to project lights on the 3d model. Whit ore whiteout a gobo.
Attachments
IMG_0116.JPG
IMG_0116.JPG (1.66 MiB) Viewed 11708 times
OMD
 
Posts: 76
Joined: Mon Dec 17, 2012 6:11 am

Re: Deferred Shading

Postby archo-p » Thu Sep 10, 2015 10:18 pm

Hey there!

I've been playing around with this a bit. I have a question though about how to deal with anti-aliasing. It seems to me that using this method makes anti-aliasing difficult, but I also don't fully understand how anti-aliasing works on renders. Is there a way to get it back and still use deferred shading? You can see in my example that anti-aliasing the initial render yields artifacts because of the way the different buffers need to be used in the lighting pass.

I'm attaching a file that is a sort of hybrid that uses the deferred technique but is actually still using light COMPs in a post render ( of a flat tile using a GLSL mat) to take advantage of the built in lighting functions. This doesn't get around the lighting limit though since its still specifying light COMPs in a render, but I think it is faster still.
Attachments
deferredTests.2.toe
(15.1 KiB) Downloaded 482 times
User avatar
archo-p
 
Posts: 470
Joined: Thu Nov 19, 2009 3:03 pm
Location: Los Angeles

Re: Deferred Shading

Postby malcolm » Fri Sep 11, 2015 11:09 am

The best way now would be to not antialias in your main render, do all your deferred rendering work and then use the Anti-Alias TOP at the end to apply anti-aliasing.
User avatar
malcolm
Staff
 
Posts: 3948
Joined: Tue Nov 13, 2007 1:11 am

Re: Deferred Shading

Postby yeswecan » Fri Feb 03, 2017 8:27 am

Hey guys!

I was trying to run that last example in a non-commercial version of TD 099, but it doesn't work. What do you think might be the case? I've found no errors in the network apart from the textures being limited by non-commercial resolution.
http://i.imgur.com/Lx1kAbI
Image
yeswecan
 
Posts: 18
Joined: Mon Jan 28, 2013 4:19 am

Next

Return to Techniques

Who is online

Users browsing this forum: No registered users and 2 guests