浏览代码

HDRenderPipeline: Update SSS test and rename diffusion profile in layered lit

/main
Sebastien Lagarde 7 年前
当前提交
27bcab4c
共有 2 个文件被更改,包括 20 次插入20 次删除
  1. 32
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/LayeredLit/LayeredLitData.hlsl
  2. 8
      Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/CommonAssets/Tests_Diffusion_Profile_Settings.asset

32
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/LayeredLit/LayeredLitData.hlsl


// In the case of subsurface profile index, the goal is to take the index with the hights weights.
// Or the last found in case of equality.
float BlendLayeredSSSprofile(float x0, float x1, float x2, float x3, float weight[4])
float BlendLayeredDiffusionProfile(float x0, float x1, float x2, float x3, float weight[4])
int sssProfileIndex = x0;
int diffusionProfileId = x0;
sssProfileIndex = currentMax < weight[1] ? x1 : sssProfileIndex;
diffusionProfileId = currentMax < weight[1] ? x1 : diffusionProfileId;
sssProfileIndex = currentMax < weight[2] ? x2 : sssProfileIndex;
diffusionProfileId = currentMax < weight[2] ? x2 : diffusionProfileId;
sssProfileIndex = currentMax < weight[3] ? x3 : sssProfileIndex;
diffusionProfileId = currentMax < weight[3] ? x3 : diffusionProfileId;
return sssProfileIndex;
return diffusionProfileId;
#define SURFACEDATA_BLEND_SSS_PROFILE(surfaceData, name, mask) BlendLayeredSSSprofile(MERGE_NAME(surfaceData, 0) MERGE_NAME(., name), MERGE_NAME(surfaceData, 1) MERGE_NAME(., name), MERGE_NAME(surfaceData, 2) MERGE_NAME(., name), MERGE_NAME(surfaceData, 3) MERGE_NAME(., name), mask);
#define SURFACEDATA_BLEND_DIFFUSION_PROFILE(surfaceData, name, mask) BlendLayeredDiffusionProfile(MERGE_NAME(surfaceData, 0) MERGE_NAME(., name), MERGE_NAME(surfaceData, 1) MERGE_NAME(., name), MERGE_NAME(surfaceData, 2) MERGE_NAME(., name), MERGE_NAME(surfaceData, 3) MERGE_NAME(., name), mask);
#define PROP_BLEND_SCALAR(name, mask) BlendLayeredScalar(name##0, name##1, name##2, name##3, mask);
void GetLayerTexCoord(float2 texCoord0, float2 texCoord1, float2 texCoord2, float2 texCoord3,

surfaceData.tangentWS = normalize(input.worldToTangent[0].xyz); // The tangent is not normalize in worldToTangent for mikkt. Tag: SURFACE_GRADIENT
surfaceData.subsurfaceMask = SURFACEDATA_BLEND_SCALAR(surfaceData, subsurfaceMask, weights);
surfaceData.thickness = SURFACEDATA_BLEND_SCALAR(surfaceData, thickness, weights);
surfaceData.diffusionProfile = SURFACEDATA_BLEND_SSS_PROFILE(surfaceData, diffusionProfile, weights);
surfaceData.diffusionProfile = SURFACEDATA_BLEND_DIFFUSION_PROFILE(surfaceData, diffusionProfile, weights);
// Layered shader support SSS and Transmission features
surfaceData.materialFeatures = 0;

#endif
#ifdef _MATERIAL_FEATURE_TRANSMISSION
// TEMP: The UI must control if we have transmission or not.
// Currently until we update the UI, this is control in the diffusion profile
uint transmissionMode = BitFieldExtract(asuint(_TransmissionFlags), 2u * surfaceData.diffusionProfile, 2u);
// Caution: Because of this dynamic test we don't know anymore statically if we have transmission, which mess with performance.
// in deferred case as we still have both sss and transmission until we update the UI it should be the same perf
if (transmissionMode != TRANSMISSION_MODE_NONE)
#ifdef _MATERIAL_FEATURE_TRANSMISSION
// TEMP: The UI must control if we have transmission or not.
// Currently until we update the UI, this is control in the diffusion profile
uint transmissionMode = BitFieldExtract(asuint(_TransmissionFlags), 2u * surfaceData.diffusionProfile, 2u);
// Caution: Because of this dynamic test we don't know anymore statically if we have transmission, which mess with performance.
// in deferred case as we still have both sss and transmission until we update the UI it should be the same perf
if (transmissionMode != TRANSMISSION_MODE_NONE)
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION;
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION;
}
#endif

8
Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/CommonAssets/Tests_Diffusion_Profile_Settings.asset


scatteringDistance: {r: 1, g: 0, b: 0, a: 1}
transmissionTint: {r: 1, g: 1, b: 1, a: 1}
texturingMode: 0
transmissionMode: 0
transmissionMode: 1
thicknessRemap: {x: 0, y: 5}
worldScale: 1
ior: 1.4

scatteringDistance: {r: 0, g: 1, b: 0, a: 1}
transmissionTint: {r: 1, g: 1, b: 1, a: 1}
texturingMode: 0
transmissionMode: 0
transmissionMode: 1
thicknessRemap: {x: 0, y: 5}
worldScale: 1
ior: 1.4

scatteringDistance: {r: 0, g: 0, b: 1, a: 1}
transmissionTint: {r: 1, g: 1, b: 1, a: 1}
texturingMode: 1
transmissionMode: 0
transmissionMode: 1
thicknessRemap: {x: 0, y: 5}
worldScale: 1
ior: 1.4

scatteringDistance: {r: 1, g: 1, b: 1, a: 1}
transmissionTint: {r: 1, g: 1, b: 1, a: 1}
texturingMode: 1
transmissionMode: 0
transmissionMode: 1
thicknessRemap: {x: 0, y: 5}
worldScale: 1
ior: 1.4

正在加载...
取消
保存