浏览代码

Enable SSS in the player

/Branch_Batching2
Evgenii Golubev 8 年前
当前提交
85a5ac90
共有 5 个文件被更改,包括 3 次插入16 次删除
  1. 10
      Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
  2. 1
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl
  3. 1
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.shader
  4. 6
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitDataInternal.hlsl
  5. 1
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.shader

10
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs


}
// Broadcast SSS parameters to all shaders.
Shader.SetGlobalInt("_EnableSSS", globalDebugSettings.renderingDebugSettings.enableSSS ? 1 : 0);
if (globalDebugSettings.renderingDebugSettings.enableSSS)
{
cmd.EnableShaderKeyword("_SUBSURFACE_SCATTERING");
}
else
{
cmd.DisableShaderKeyword("_SUBSURFACE_SCATTERING");
}
renderContext.ExecuteCommandBuffer(cmd);
cmd.Dispose();

1
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl


// SSS parameters
#define SSS_N_PROFILES 8
#define SSS_UNIT_CONVERSION (1.0 / 300.0) // From meters to 1/3 centimeters
uint _EnableSSS; // Globally toggles subsurface scattering on/off
uint _TransmissionFlags; // 1 bit/profile; 0 = inf. thick, 1 = supports transmission
uint _TexturingModeFlags; // 1 bit/profile; 0 = PreAndPostScatter, 1 = PostScatter
float _ThicknessRemaps[SSS_N_PROFILES][2]; // Remap: 0 = start, 1 = end - start

1
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.shader


#pragma shader_feature _DETAIL_MAP
#pragma shader_feature _SUBSURFACE_RADIUS_MAP
#pragma shader_feature _THICKNESS_MAP
#pragma shader_feature _SUBSURFACE_SCATTERING
#pragma shader_feature _VERTEX_WIND
#pragma multi_compile LIGHTMAP_OFF LIGHTMAP_ON

6
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitDataInternal.hlsl


// This part of the code is not used in case of layered shader but we keep the same macro system for simplicity
#if !defined(LAYERED_LIT_SHADER)
#ifdef _SUBSURFACE_SCATTERING
surfaceData.materialId = _MaterialID;
#else
surfaceData.materialId = (_MaterialID == MATERIALID_LIT_SSS) ? 0 : _MaterialID;
#endif
surfaceData.materialId = (_EnableSSS || _MaterialID != MATERIALID_LIT_SSS) ? _MaterialID : MATERIALID_LIT_STANDARD;
// TODO: think about using BC5
#ifdef _TANGENTMAP

1
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.shader


#pragma shader_feature _DETAIL_MAP
#pragma shader_feature _SUBSURFACE_RADIUS_MAP
#pragma shader_feature _THICKNESS_MAP
#pragma shader_feature _SUBSURFACE_SCATTERING
#pragma shader_feature _VERTEX_WIND
#pragma multi_compile LIGHTMAP_OFF LIGHTMAP_ON

正在加载...
取消
保存