Are YOU using any GBuffer alterations in your system?
Please let us know in this thread, and notify any publishers that are, so they can come help out!
Due to complications caused by multiple assets/system conflicts when using GBuffer channels, I thought it would be a good idea to get some sort of registry going for who’s using what, and some general tips for managing any problems if you have two trying to access the same one.
CORE PROBLEM:
2 (or more) shaders try to access the same GBuffer (for example, both use GBuffer2.a). They use them for different purposes, and cause lighting errors when you have both in your project.
RISK:
As Unity brings the Glorious Customizable Scriptable Render Loop into the fold, it’s increasingly likely that more and more lighting systems will fight for the same GBuffer slot and cause conflicts.
EXTISTING INFO ON GBUFFER USAGE:
Unity - Scripting API: BuiltinRenderTextureType - basic description
Unity - Manual: Deferred Shading rendering path - what Unity Deferred uses
Techniques for adding another g-buffer texture
How do I write a normal decal shader using a newly added (Unity 5.2) "finalgbuffer" modifier?
Stefan Sincak - Game Programmer - builtin shader gbuffer usage, not 100% up to date on gbuffer 1 and 3, but good anyway
EXISTING SOLUTIONS:
Nothing, for gbuffer usage anyway. There are solutions elsewhere that should work though. Radio and TV have their own dedicated frequencies and there’s a big list of who is using what allocations, and other useful info. There is some organization, and predictability for dealing with certain bandwidth brackets. Also, back when I was into modding racing games, there was a Car ID system, where each type of vehicle had its own ID from 1-511 or something, and on all the main forums there was a big list for modders that had each number on the left and what car used it on the right. That way each car/class had its own slot that was called and it was easy to avoid conflicts.
PROPOSAL:
1: We need some way to easily deal with conflicts. If we can get a big list of who uses what, what’s it’s for, and where in code it’s used, it becomes much much easier to manage.
2: Also, a handy guide for quickly and easily changing the ones used (consolidating them into one GBuffer instead of 3 extras should gain us some performance!) would be nice.
3: For anyone selling assets that use GBuffers, it might be useful to have a link to this in your Readme. That way, they can understand what’s happening and not drown in mystery code.
4: I’ll try to keep this post updated with any responses so you don’t have to dig through the thread! Entries in Italics are Unity default slots, which take preference over anything else and should be avoided.
THE FIX, PART 1:
The Registry
GBUFFER0
RT0
ARGB32 format
RGB: Unity Diffuse Color
A: Unity Occlusion
GBUFFER1
RT1
ARGB32 format
RGB: Unity Specular color
A: Unity Roughness
GBUFFER2
RT2
ARGB2101010 format
RGB: Unity Worldspace Normals
—CONFLICT!—
GBUFFER2.A
-Tropical Forest Pack - More Specifically the tree shader (CTI?)
-Used for Transparency rendering for plants
–See shaders A, B, C lines 1, 2, 3 for references to this slot.
–Add this [code snippet] in this [place] to your deferred scripts to use this slot.
—CONFLICT!—
GBUFFER2.A
-NeoFur
-Used as a type of mask to separate out furry/hairy surfaces
–See shaders A, B, C lines 1, 2, 3 for references to this slot.
–Add this [code snippet] in this [place] to your deferred scripts to use this slot.
GBUFFER3
RT3
ARGB2101010 format (non-HDR)
ARGBHalf format (HDR)
RGBA: Unity Emission + Lighting + Lightmaps + Reflection Probes
GBUFFER4
RT4
ARGB32 format
RGBA: Unity Light Occlusion, Shadowmask / Distance Shadowmask (with Mixed Lightmapping ???)
GBUFFER5
RT5
??? format
R: ???
G: ???
B: ???
GBUFFER6
RT6
??? format
R: ???
G: ???
B: ???
GBUFFER7
RT7
??? format
R: ???
G: ???
B: ???