• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Michael McLafferty

Deferred Lighting + Fresnel

7 posts in this topic

Hello All.

I have been attempting to create more physically correct rendering pipeline. It uses deferred lighting and a normalized blinn-phong. I have come to a stumbling block when attempting to imeplement the Fresnel effect using Shlick's approximation. I do not want to fake it by using N dot V in the second forward pass. So far my render targets look like the following:

Depth + A: Nothing stored in alpha yet.
RGBA8 - Best Fit Normals in RGB and monochrome gloss map value stored in A, which is used for specular power.

I am using a 16bit floating point per channel render target for my light accumulation buffer since I could not find a decent storage method to use with an 8bit per channel one. All that I could find info on required swapping rendering targets back and forth when you have overlapping lights, which doesn't seem like a good idea performance wise (not tested though).

My first thought was to create a lookup map for specular color. I could store 256 common specular colors within this lookup and store the index into the Depth render targets alpha channel. I could then lookup the color during the light accumulation phase and output the accumulated specular color to yet another render target. This would require another large render target to support HDR values, much like my light accumulation target.

I noticed in Tri-Ace's 2012 GDC slides, they use Deferred Lighting with FresnelShlick but they didn't go into much detail on how they accomplished it in the lighting phase. Does anyone have any brilliant ideas on how I might accomplish this or is my current idea sufficient for a decent range of materials.

Thanks in advanced,

-Mike
0

Share this post


Link to post
Share on other sites
Tri-ace doesn't really elaborate on how how their renderer is set up, it's totally possible they do a more traditional deferred rendering approach with a fat G-Buffer. A lot of people tend to be pretty loose with terminology regarding deferred lighting, deferred shading, deferred rendering, etc. When you say "deferred lighting" I assume you're talking rendering a very minimal G-Buffer, rendering lighting to a buffer, and then rendering geometry again which samples the lighting buffer? If so you might want to reconsider ditching that approach and going with a fat G-Buffer. The kind of deferred lighting you're doing has a lot of disadvantages (such as the one you mentioned), and not so many advantages. It can be different on certain hardware where you might have a penalty for using MRT or some extra hardware on which you can parallelize the lighting computations, but if you're not working with them it's really not a compelling choice.
0

Share this post


Link to post
Share on other sites
Thanks for the reply. You are correct, by deferred lighting I am referring to what is also called "Light Pre Pass". The same thing Wolf has posted on his blog as well as the technique Uncharted and CryEngine 3 is using. Uncharted applied the fake Fresnel effect using N dot V, and it sounds like the CryEngine 3 did something on the CPU to supply a L.H value to the second forward pass. Not exactly sure what they did there.

The main reason why I chose it was because I would like to get it running on the xbox 360 with decent performance. The traditional deferred rendering with the fat g-buffer will be problematic at higher resolutions on the xbox-360 due to the 10mb EDRAM. Of course, the way people have worked around that is to split the screen in half and render in two passes. I was hoping to avoid that.
0

Share this post


Link to post
Share on other sites
[quote name='Mike McLafferty' timestamp='1334697785' post='4932291']
The main reason why I chose it was because I would like to get it running on the xbox 360 with decent performance. The traditional deferred rendering with the fat g-buffer will be problematic at higher resolutions on the xbox-360 due to the 10mb EDRAM. Of course, the way people have worked around that is to split the screen in half and render in two passes. I was hoping to avoid that.
[/quote]

If you use XNA predicate tilling is done by the API, if you use Microsoft SDK you have to implement predicate tilling yourself. The XNA team said that a good predicate tilling technique is really fast, it seems that way. But like you, I prefer that the EDRAM holds the whole G-Buffer.

I still didn’t research much about Fresnel effects, and that includes the Shlick technique. But looking in the Crysis 2 resource I see a fresnel_sampler.dds texture and they read it using the following code:

[CODE]
// Cheap shlick fresnel term using lookup table (each channel has a diferent power (x = 1, y = 2, z = 4, w = 5) )
half4 GetFresnelTex( float NdotI, float bias)
{
return tex2D( fresnelShlickMapSampler, float2(NdotI, bias) );
}
[/CODE]

Where NdotI is (I think) NdotV (following the rest of the shaders)

This help you?

Moderators: If I put something that I shouldn’t then let me know.
0

Share this post


Link to post
Share on other sites
I have yet to test the built in Predicated Tiling on XNA, so I cannot say how well it works with regards to performance. I currently do not hold a Creators Club membership and have mostly been designing based on knowledge i've read around in the web. I will probably create another renderer that does the fat-g buffer and see if I can measure the performance penalties of perdicated tiling. Worst case, I use the NdotV approach for Xbox with deferred lighting and a fat g-buffer on the PC. Or, if predicated tiling does not seem to be an issue then I will just stick with a fat g-buffer.

Thanks for posting the shader code, it is kinda interesting that they are reading it from a texture as it would seem like it would only support dielectric materials. Is the texture monochromatic?
0

Share this post


Link to post
Share on other sites
Having to tile isn't necessarily a deal-breaker. On XNA it's transparent to you, and the overhead depends on the amount of geometry as well as the amount of draw calls you need to make. Of course you should keep in mind that with your current set up you will need to tile at 1280x720 since you have two render targets + a depth/stencil buffer which is 10.5MB.
0

Share this post


Link to post
Share on other sites
[quote name='Mike McLafferty' timestamp='1334702711' post='4932306']
Thanks for posting the shader code, it is kinda interesting that they are reading it from a texture as it would seem like it would only support dielectric materials. Is the texture monochromatic?
[/quote]

It is very similar [img]http://public.gamedev.net//public/style_emoticons/default/wink.png[/img] to the attached textured.

[quote name='MJP' timestamp='1334704500' post='4932310']
Having to tile isn't necessarily a deal-breaker. On XNA it's transparent to you, and the overhead depends on the amount of geometry as well as the amount of draw calls you need to make. Of course you should keep in mind that with your current set up you will need to tile at 1280x720 since you have two render targets + a depth/stencil buffer which is 10.5MB.
[/quote]

1024 x 600 (without MSAA of course) is my happy number for the XBOX (same as COD games). The G-Buffer can hold three 32 bits render target plus a depth/stencil buffer.
0

Share this post


Link to post
Share on other sites
[quote name='Mike McLafferty' timestamp='1334697785' post='4932291']
The main reason why I chose it was because I would like to get it running on the xbox 360 with decent performance. The traditional deferred rendering with the fat g-buffer will be problematic at higher resolutions on the xbox-360 due to the 10mb EDRAM. Of course, the way people have worked around that is to split the screen in half and render in two passes. I was hoping to avoid that.
[/quote]

You do know the next Xbox and Playstation are due soon right? Or were you hoping to be done much sooner, and counting on the much larger installed base?
Anyway, from what I remember both Crysis 2 and Halo: Reach shrunk down their horizontal resolutions to something like 1024x720 (something like that) and then rescaled the finished frame to 1280x720 in order to fit everything into EDRAM without tiling. And of course Battlefield 3 went for a fat g-buffer on the 360 anyway, they got it working.

Best of luck either way, and if you want to look at the Crysis 2 stuff Crytek is nice enough to put all their powerpoints and stuff up on their site: [url="http://www.crytek.com/cryengine/presentations"]http://www.crytek.co...e/presentations[/url]
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0