public override void GetMaterialGBufferDescription(HDRenderPipelineAsset asset, out RenderTextureFormat[] RTFormat, out bool[] sRGBFlag, out GBufferUsage[] gBufferUsage, out bool[] enableWrite) { int gBufferCount; bool supportShadowMask; bool supportLightLayers; GetGBufferOptions(asset, out gBufferCount, out supportShadowMask, out supportLightLayers); RTFormat = new RenderTextureFormat[gBufferCount]; sRGBFlag = new bool[gBufferCount]; gBufferUsage = new GBufferUsage[gBufferCount]; enableWrite = new bool[gBufferCount]; RTFormat[0] = RenderTextureFormat.ARGB32; // Albedo sRGB / SSSBuffer sRGBFlag[0] = true; gBufferUsage[0] = GBufferUsage.SubsurfaceScattering; enableWrite[0] = false; RTFormat[1] = RenderTextureFormat.ARGB32; // Normal Buffer sRGBFlag[1] = false; gBufferUsage[1] = GBufferUsage.Normal; enableWrite[1] = true; // normal buffer is used as RWTexture to composite decals in forward RTFormat[2] = RenderTextureFormat.ARGB32; // Data sRGBFlag[2] = false; gBufferUsage[2] = GBufferUsage.None; enableWrite[2] = false; RTFormat[3] = Builtin.GetLightingBufferFormat(); sRGBFlag[3] = Builtin.GetLightingBufferSRGBFlag(); gBufferUsage[3] = GBufferUsage.None; enableWrite[3] = false; int index = 4; if (supportLightLayers) { RTFormat[index] = RenderTextureFormat.ARGB32; sRGBFlag[index] = false; gBufferUsage[index] = GBufferUsage.LightLayers; index++; } // All buffer above are fixed. However shadow mask buffer can be setup or not depends on light in view. // Thus it need to be the last one, so all indexes stay the same if (supportShadowMask) { RTFormat[index] = Builtin.GetShadowMaskBufferFormat(); sRGBFlag[index] = Builtin.GetShadowMaskBufferSRGBFlag(); gBufferUsage[index] = GBufferUsage.ShadowMask; index++; } }
public override void GetMaterialGBufferDescription(HDRenderPipelineAsset asset, out GraphicsFormat[] RTFormat, out GBufferUsage[] gBufferUsage, out bool[] enableWrite) { int gBufferCount; bool supportShadowMask; bool supportLightLayers; GetGBufferOptions(asset, out gBufferCount, out supportShadowMask, out supportLightLayers); RTFormat = new GraphicsFormat[gBufferCount]; gBufferUsage = new GBufferUsage[gBufferCount]; enableWrite = new bool[gBufferCount]; RTFormat[0] = GraphicsFormat.R8G8B8A8_SRGB; // Albedo sRGB / SSSBuffer gBufferUsage[0] = GBufferUsage.SubsurfaceScattering; enableWrite[0] = false; RTFormat[1] = GraphicsFormat.R8G8B8A8_UNorm; // Normal Buffer gBufferUsage[1] = GBufferUsage.Normal; enableWrite[1] = true; // normal buffer is used as RWTexture to composite decals in forward RTFormat[2] = GraphicsFormat.R8G8B8A8_UNorm; // Data gBufferUsage[2] = GBufferUsage.None; enableWrite[2] = false; RTFormat[3] = Builtin.GetLightingBufferFormat(); gBufferUsage[3] = GBufferUsage.None; // If we are in raytracing mode and we want to have indirect diffuse active, we need to make sure that the gbuffer3 is writable #if ENABLE_RAYTRACING enableWrite[3] = true; #else enableWrite[3] = false; #endif int index = 4; if (supportLightLayers) { RTFormat[index] = GraphicsFormat.R8G8B8A8_UNorm; gBufferUsage[index] = GBufferUsage.LightLayers; index++; } // All buffer above are fixed. However shadow mask buffer can be setup or not depends on light in view. // Thus it need to be the last one, so all indexes stay the same if (supportShadowMask) { RTFormat[index] = Builtin.GetShadowMaskBufferFormat(); gBufferUsage[index] = GBufferUsage.ShadowMask; index++; } }