浏览代码

renamed and added the pragma multi_compile for decals to Lit shaders

/main
Paul Melamed 7 年前
当前提交
30ddbe57
共有 7 个文件被更改,包括 19 次插入7 次删除
  1. 10
      com.unity.render-pipelines.high-definition/HDRP/Material/Decal/Decal.hlsl
  2. 2
      com.unity.render-pipelines.high-definition/HDRP/Material/Decal/Decal.shader
  3. 3
      com.unity.render-pipelines.high-definition/HDRP/Material/LayeredLit/LayeredLit.shader
  4. 3
      com.unity.render-pipelines.high-definition/HDRP/Material/LayeredLit/LayeredLitTessellation.shader
  5. 3
      com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.shader
  6. 3
      com.unity.render-pipelines.high-definition/HDRP/Material/Lit/LitTessellation.shader
  7. 2
      com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDRenderPipeline.cs

10
com.unity.render-pipelines.high-definition/HDRP/Material/Decal/Decal.hlsl


DBufferType2 MERGE_NAME(NAME, 2) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 2), unCoord2); \
DBufferType3 MERGE_NAME(NAME, 3) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 3), unCoord2);
#ifdef _PER_CHANNEL_MASK
#ifdef _DECALS_PER_CHANNEL_MASK
#define ENCODE_INTO_DBUFFER(DECAL_SURFACE_DATA, NAME) EncodeIntoDBuffer(DECAL_SURFACE_DATA, MERGE_NAME(NAME,0), MERGE_NAME(NAME,1), MERGE_NAME(NAME,2), MERGE_NAME(NAME,3))
#define DECODE_FROM_DBUFFER(NAME, DECAL_SURFACE_DATA) DecodeFromDBuffer(MERGE_NAME(NAME,0), MERGE_NAME(NAME,1), MERGE_NAME(NAME,2), MERGE_NAME(NAME,3), DECAL_SURFACE_DATA)
#else

, out DBufferType0 outDBuffer0
, out DBufferType1 outDBuffer1
, out DBufferType2 outDBuffer2
#ifdef _PER_CHANNEL_MASK
#ifdef _DECALS_PER_CHANNEL_MASK
, out DBufferType3 outDBuffer3
#endif
)

outDBuffer2 = surfaceData.mask;
#ifdef _PER_CHANNEL_MASK
#ifdef _DECALS_PER_CHANNEL_MASK
outDBuffer3 = surfaceData.MAOSBlend;
#endif
}

, DBufferType1 inDBuffer1
, DBufferType2 inDBuffer2
#ifdef _PER_CHANNEL_MASK
#ifdef _DECALS_PER_CHANNEL_MASK
, DBufferType3 inDBuffer3
#endif
, out DecalSurfaceData surfaceData

surfaceData.normalWS.xyz = inDBuffer1.xyz * 2.0f - 1.0f;
surfaceData.normalWS.w = inDBuffer1.w;
surfaceData.mask = inDBuffer2;
#ifdef _PER_CHANNEL_MASK
#ifdef _DECALS_PER_CHANNEL_MASK
surfaceData.MAOSBlend = inDBuffer3;
#else
surfaceData.MAOSBlend = float2(surfaceData.mask.w, surfaceData.mask.w);

2
com.unity.render-pipelines.high-definition/HDRP/Material/Decal/Decal.shader


#pragma shader_feature _MAOS_BLEND_MASK_B
#pragma multi_compile_instancing
#pragma multi_compile _ _PER_CHANNEL_MASK
#pragma multi_compile _ _DECALS_PER_CHANNEL_MASK
//-------------------------------------------------------------------------------------
// Define
//-------------------------------------------------------------------------------------

3
com.unity.render-pipelines.high-definition/HDRP/Material/LayeredLit/LayeredLit.shader


// enable dithering LOD crossfade
#pragma multi_compile _ LOD_FADE_CROSSFADE
// decal 3RT or 4RT toggle
#pragma multi_compile _ _DECALS_PER_CHANNEL_MASK
//enable GPU instancing support
#pragma multi_compile_instancing

3
com.unity.render-pipelines.high-definition/HDRP/Material/LayeredLit/LayeredLitTessellation.shader


// enable dithering LOD crossfade
#pragma multi_compile _ LOD_FADE_CROSSFADE
// decal 3RT or 4RT toggle
#pragma multi_compile _ _DECALS_PER_CHANNEL_MASK
// enable GPU instancing
#pragma multi_compile_instancing

3
com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.shader


// enable dithering LOD crossfade
#pragma multi_compile _ LOD_FADE_CROSSFADE
// decal 3RT or 4RT toggle
#pragma multi_compile _ _DECALS_PER_CHANNEL_MASK
//enable GPU instancing support
#pragma multi_compile_instancing

3
com.unity.render-pipelines.high-definition/HDRP/Material/Lit/LitTessellation.shader


// enable dithering LOD crossfade
#pragma multi_compile _ LOD_FADE_CROSSFADE
// decal 3RT or 4RT toggle
#pragma multi_compile _ _DECALS_PER_CHANNEL_MASK
//enable GPU instancing support
#pragma multi_compile_instancing

2
com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDRenderPipeline.cs


renderQueueRange = HDRenderQueue.k_RenderQueue_AllOpaque
};
CoreUtils.SetKeyword(cmd, "_PER_CHANNEL_MASK", m_Asset.GetRenderPipelineSettings().decalSettings.perChannelMask);
CoreUtils.SetKeyword(cmd, "_DECALS_PER_CHANNEL_MASK", m_Asset.GetRenderPipelineSettings().decalSettings.perChannelMask);
renderContext.DrawRenderers(cullResults.visibleRenderers, ref drawSettings, filterRenderersSettings);
DecalSystem.instance.RenderIntoDBuffer(cmd);

正在加载...
取消
保存