浏览代码

Merge pull request #1880 from Unity-Technologies/fabric_normal_decal

Supporting Normal Buffer Writing and Decals for the fabric shader
/hdrp-staging
GitHub 6 年前
当前提交
d5d3d79d
共有 4 个文件被更改,包括 17 次插入0 次删除
  1. 2
      com.unity.render-pipelines.high-definition/HDRP/Material/Decal/DecalUtilities.hlsl
  2. 8
      com.unity.render-pipelines.high-definition/HDRP/Material/Fabric/Fabric.hlsl
  3. 2
      com.unity.render-pipelines.high-definition/HDRP/Material/Fabric/Fabric.shader
  4. 5
      com.unity.render-pipelines.high-definition/HDRP/Material/Fabric/FabricData.hlsl

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


if (mask & DBUFFERHTILEBIT_MASK)
{
#ifdef DECALS_4RT // only smoothness in 3RT mode
#if !defined(UNITY_MATERIAL_FABRIC)
#endif
surfaceData.ambientOcclusion = surfaceData.ambientOcclusion * decalSurfaceData.MAOSBlend.y + decalSurfaceData.mask.y;
#endif
surfaceData.perceptualSmoothness = surfaceData.perceptualSmoothness * decalSurfaceData.mask.w + decalSurfaceData.mask.z;

8
com.unity.render-pipelines.high-definition/HDRP/Material/Fabric/Fabric.hlsl


#endif
}
NormalData ConvertSurfaceDataToNormalData(SurfaceData surfaceData)
{
NormalData normalData;
normalData.normalWS = surfaceData.normalWS;
normalData.perceptualRoughness = PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness);
return normalData;
}
//-----------------------------------------------------------------------------
// conversion function for forward
//-----------------------------------------------------------------------------

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


HLSLPROGRAM
#define WRITE_NORMAL_BUFFER
#define SHADERPASS SHADERPASS_DEPTH_ONLY
#include "HDRP/ShaderVariables.hlsl"
#include "HDRP/Material/Material.hlsl"

//#pragma multi_compile LIGHTLOOP_SINGLE_PASS LIGHTLOOP_TILE_PASS
#define LIGHTLOOP_TILE_PASS
#pragma multi_compile USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST
#pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT
#define SHADERPASS SHADERPASS_FORWARD
#include "HDRP/ShaderVariables.hlsl"

5
com.unity.render-pipelines.high-definition/HDRP/Material/Fabric/FabricData.hlsl


#include "CoreRP/ShaderLibrary/Sampling/SampleUVMapping.hlsl"
#include "HDRP/Material/MaterialUtilities.hlsl"
#include "HDRP/Material/BuiltinUtilities.hlsl"
#include "HDRP/Material/Decal/DecalUtilities.hlsl"
void GetSurfaceAndBuiltinData(FragInputs input, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)
{

#ifdef _ALPHATEST_ON
DoAlphaTest(alpha, _AlphaCutoff);
#endif
#if HAVE_DECALS
AddDecalContribution(posInput, surfaceData, alpha);
#endif
#if defined(DEBUG_DISPLAY)

正在加载...
取消
保存