Jump to content
  • Advertisement
Sign in to follow this  
bzroom

G Buffer

This topic is 2554 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 my format so far

RGBA8: diffuse RGB 8 bits each, shininess 7 bits, is emissive 1 bit*
RGBA8: normal xyz 8 bits each, spec value 8 bits.
Depth 24f s8: depth 24 bits, stencil unused*

The problem is that I'm not storing both emission and diffuse. so an object must be one or the other. Unfortunately the artists will not accept this.

I could:
Add a render target (seems excessive for such a simple emission effect)
Some how use the stencil or existing channels differently (material id?)
Render emissive stuff in the transparent/blending pass afterwords.
Somehow modulate diffuse and emmision together and store some kind of unpacking ratio. (thats what I'm doing right now, except the ratio is binary)

What are your thoughts?

Share this post


Link to post
Share on other sites
Advertisement

What are your thoughts?

Start looking for an other artist ...:cool:

To be honest, talk to your artist, why does he need this requirement ? When he needs it, because he wants to deliver textures in a certain format (he delivers diffuse,normal,emissive textures) , you could still write a little converter to transform his textures in your format. It this requirement for some killer feature of your game/engine, or is it just a theoritically feature which might be useful in the future ? Which would be a useful usecase ? (a green wall with emissive blue light ? :blink: )

Share this post


Link to post
Share on other sites
If majority of your objects are *not* emissive, I would recommend rendering emissive (as well as other effects like environment mapping) in another pass after the deferred light rendering. The Z-buffer will already be primed, so you should get early-Z rejection for occluded objects.

Share this post


Link to post
Share on other sites

If majority of your objects are *not* emissive, I would recommend rendering emissive (as well as other effects like environment mapping) in another pass after the deferred light rendering. The Z-buffer will already be primed, so you should get early-Z rejection for occluded objects.

Very workable. You can even recycle your actual illumination buffers for this purpose, and then draw light contributions in on top of the emissive. It's some extra draw calls, sure, but that shouldn't be too bad unless you have a *lot* of emissive objects.

Share this post


Link to post
Share on other sites
The most notable case is that we want the armor to sort of glow in the dark.

We want it to always glow, and yet react to light. Some swords have animated glowing regions. Like cracks with lava in them. We could easily separate these into two draw calls.
But a glowing green armor is going to be harder to "split up."


So a characters entire body suit would need to be rendered twice.

If i did render them in a second pass, i could skip the whole "1 bit is emissive" packing stuff which would be nice.

Share this post


Link to post
Share on other sites
To be honest, I suggest going straight to four G-buffers and stretching your legs a bit. You're probably still in the exploratory phase here for features, performance, etc and playing packing games right from the beginning is not going to be fun. Be generous with resources, find out what works and how real scenes look, and then strip it back down from there as necessary.

Share this post


Link to post
Share on other sites
I'm targetting the xbox 360. Memory consumption and texture fetching is at a premium. Performance asside, we're already well into production and the scope of our art is pretty well known. At this point, besides emissive materials, the rendering methods are indistinguishable. In other words we dont really need any more features. What we need most is performance and memory.

I'm going to investigate drawing them in a separate pass.

Share this post


Link to post
Share on other sites
Have you considered doing pre-pass lighting? It's basically the same as what you conclude, but for all objects in the scene. It uses less render targets (usually just one if you have hardware support for reading depth buffer) that classic deferred rendering, and also enables more variety in the materials (which is sorta that problem you're having).

Probably drawing the emissive mesh a second time is a nice thing (if there aren't too many of them), as it gives you the most flexibiltity. Imagine extruding the triangles and using some fancy-pants shader, you could probably have a volumetric glow rather than a flat emissive.

Share this post


Link to post
Share on other sites

Have you considered doing pre-pass lighting? It's basically the same as what you conclude, but for all objects in the scene. It uses less render targets (usually just one if you have hardware support for reading depth buffer) that classic deferred rendering, and also enables more variety in the materials (which is sorta that problem you're having).

Probably drawing the emissive mesh a second time is a nice thing (if there aren't too many of them), as it gives you the most flexibiltity. Imagine extruding the triangles and using some fancy-pants shader, you could probably have a volumetric glow rather than a flat emissive.


I wouldn't suggest this, overall. A light-prepass renderer would entail rendering *everything* twice for marginal gain. As bzroom stated, things are already in feature lock so I think materials, etc. don't need much more flexibility. As far as I'm aware this approach is considered more or less superceded nowadays and the advantages over straight deferred shading were somewhat dubious even way-back-when.

On topic-- If you can hold off on drawing emissives until the end of the opaque pass, you can probably even get around the second draw call, just bind the illumination buffer as an additional render target and have the shader write out the emissive color; depth rejects will take care of the rest. The one problem I see is that this is going to eat up more EDRAM, and I don't know what your budget for that is.

EDIT: I see you're using unpacked normals, too. As a thought you could switch over to a compressed format (spheremap transform comes recommended) and then have 8 bits left over for a monochrome self-illumination value. I'm unsure if this would be satisfactory for the artists, though.

Share this post


Link to post
Share on other sites
Thats a really good idea. That's essentially what i was hoping to do. Store some coefficient that transformed the diffuse into the emissive factor.

Sort of like barycentric light coordinates. Where a 0.25 would indicate that the stored color is 0.25 between diffuse and emissive.
So neither the diffuse nor the emissive value were directly stored, but rather the barycentric value and coordinate were stored.

I'm not sure if that's even possible. But your solution is almost exactly that, assuming the only difference between the two colors was intensity.

Thank you. I'll run that by them.

edit:
I'm using unpacked because each channel is only using 8 bits. :(
I'm pretty sure we could spare another render target. But i would be proud of the implementation if it only needed 2 targets. It would also obviously be significantly better with less render targets. In terms of memory and texture fetches and resolve times.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!