deferred shading: Material Variety / different lighting models

Started by
1 comment, last by mokaschitta 14 years, 6 months ago
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!
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.

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 :)

This topic is closed to new replies.

Advertisement