Jump to content
  • Advertisement
Sign in to follow this  
Phil123

Support Multiple Shading Models (Deferred Rendering)

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

Here's the problem: I'd prefer to use deferred rendering, however, I'd also like to support multiple shading models (strauss, ward, ashikhmin-shirley, etc).  The necessary data (position, normal, diffuse, material, etc) is output to various textures which, as standard, is read by a shader that creates the final picture.

 

Right now, I would have to switch on the material type in this shader and use the appropriate formulas to get the result, though I've read that heavy branching like this should be avoided (and for legitimate reasons).  What's the standard solution here? 

 

Also, how should ambient lighting be calculated in a scene for non-blinn phong shading models?  Normally you could just leverage the mesh's diffuse texture to trivially set a base "lit" value, but this won't work for shading models that are drastically different (as parts of the mesh that are lit dynamically will look very different from those that are just lit by ambient lighting).

Share this post


Link to post
Share on other sites
Advertisement

For each material set the stencil buffer to a specific value.
For lighting each material, use the stencil buffer to select only the pixels specific to the material you are using, and make one pass per material type.


L. Spiro

 

Sounds easy enough, I could definitely implement that, thank you.  I'd appreciate your thoughts on how ambient lighting should be handled with PBR, as I'm quite unsure about this myself.

Edited by Artemiye

Share this post


Link to post
Share on other sites
The standard solution for ambient at the moment is Image Based Lighting, preconvolved with (parts of) your BRDF and corrected with a LUT. See the Brian Karis Unreal 4 lighting course notes for the details that everyone is copying/refining :lol:

Share this post


Link to post
Share on other sites

The standard solution for ambient at the moment is Image Based Lighting, preconvolved with (parts of) your BRDF and corrected with a LUT. See the Brian Karis Unreal 4 lighting course notes for the details that everyone is copying/refining laugh.png

 

That makes sense.  I read a portion of the course notes, and damn, now I have even more questions (though they aren't completely relevant to this thread's title so I'll post it in a new thread).

Edited by Artemiye

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!