2
\$\begingroup\$

Since you need to use the general g-buffer shader to fill g-buffer, how can entities have their own shaders, like giving a box normal mapping feature ? As I remember, you can't use two shaders at the same time. So there is a possible solution that every object will have their own renderers, but If I have to make each entity have their own renderers that also include g-buffer filling in their shaders, wouldn't there be unnecessary g-buffer shader code everywhere, extra variable passings to GPU ?

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

You can use any shader to fill the g-buffer, it doesn't have to be generic. That's not the point of deferred, the point of deferred is when you come to do the lighting pass you combine the various render targets in the g-buffer with your lights; your lighting pass is confined to pixels on-screen (rather than shading pixels which may be occluded). But it's quite agnostic as to how the individual render targets get filled, so in the case of normal mapping you can use a shader with normal mapping here, and output the result of it to your normals buffer.

\$\endgroup\$
2
  • \$\begingroup\$ So the point is, as long as there is something filling that gl_FragData[], i can use any shader ? \$\endgroup\$
    – deniz
    Sep 18, 2013 at 13:22
  • \$\begingroup\$ You could even use glDrawPixels if you were so inclined. \$\endgroup\$ Sep 18, 2013 at 15:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .