Jump to content
  • Advertisement
Sign in to follow this  
mokaschitta

deferred shading: Material Variety / different lighting models

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

Hi, After finishind a very basic first version of a deferred renderer I now want to make a decision on how I want to handle different materials. I read alot about it so far and for what I can tell I came across two different ways of doing it which are: - only stick to a phong lighting model and save material properties like specular power, specular intensity, luminance intensity, occlusion in the gbuffer to modify the output from the phong shader to mimic different materials. (this is how for example killzone 2 does it, as far as I can tell they stick to phong lighting model for everything) - reading the lighting information from a 3D texture based on HdotN and LdotN aswell as a material ID. This would make it possible to render a huge variety of materials and is basically the approach described here. this would allow to use different lighting models and also achieve some kind of anisotropic lighting effects. - using a material id in the G-Buffer and have some kind of Uber-Shader with alot of branching to light different materials differently. This is basically similar to the second approach but a bad idea in terms of performance on todays hardware. Since I am a design/art student, I want to use the deferred renderer for art, design, interactive and generative pieces (even though for now I just develop it for fun and learning). I think the second approach would give me more of an artistic freedom to render non photorealistic effects thats why I tend to go with it. On the other hand I have no idea on how to accurately stick to common lighting models like phong or cook torrance since I woud have to draw them to a texture :). Also, what would be an appropriate size for those textures? What method do you guys prefer? Can anybody provide me with some more information about the texture lookup approach? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by mokaschitta
This is basically similar to the second approach but a bad idea in terms of performance on todays hardware.


I wouldn't be so sure about that. Yeah Nvidia's 6 and 7-series were dogs when it came to dynamic branching, but 8-series and up are much better. As long as you have decent coherency in your branching (which you should, since you'll have the same material assigned to adjacent groups of triangles) you should be okay. I would also think it would give you more freedom and flexibility than the second approach, since you're free to stick whatever shader code you want in a branch rather than having to encode something into a texture.

Share this post


Link to post
Share on other sites
well I develop on an old Mac Book pro right now but I will buy a new one as soon as there will be new ones in a few month so those should propably have a decent nVidia card. I might just start out with a phong lighting model and also save one channel in my gBuffer for a material ID so i can extend it later on :)
Since I reconstruct positions from depth I have plenty of room in my gbuffer anyways.

Still I would be glad about some other opinions :)

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!