浏览代码

HDRenderLoop: fix issue with HeightMap

/main
sebastienlagarde 8 年前
当前提交
2591b2be
共有 3 个文件被更改,包括 5 次插入5 次删除
  1. 2
      Assets/ScriptableRenderLoop/HDRenderLoop/Material/LayeredLit/LayeredLit.shader
  2. 4
      Assets/ScriptableRenderLoop/HDRenderLoop/Material/Lit/Lit.shader
  3. 4
      Assets/ScriptableRenderLoop/HDRenderLoop/Material/Lit/LitData.hlsl

2
Assets/ScriptableRenderLoop/HDRenderLoop/Material/LayeredLit/LayeredLit.shader


PROP_DECL_TEX2D(_MaskMap);
PROP_DECL_TEX2D(_SpecularOcclusionMap);
PROP_DECL_TEX2D(_NormalMap);
PROP_DECL_TEX2D(_Heightmap);
PROP_DECL_TEX2D(_HeightMap);
PROP_DECL(float, _HeightScale);
PROP_DECL(float, _HeightBias);
PROP_DECL(float3, _EmissiveColor);

4
Assets/ScriptableRenderLoop/HDRenderLoop/Material/Lit/Lit.shader


TEXTURE2D(_NormalMap);
SAMPLER2D(sampler_NormalMap);
TEXTURE2D(_Heightmap);
SAMPLER2D(sampler_Heightmap);
TEXTURE2D(_HeightMap);
SAMPLER2D(sampler_HeightMap);
float _HeightScale;
float _HeightBias;

4
Assets/ScriptableRenderLoop/HDRenderLoop/Material/Lit/LitData.hlsl


return float2(0.0, 0.0);
#endif
}
#if !defined(LAYERED_LIT_SHADER)
void GetSurfaceAndBuiltinData(FragInput input, out SurfaceData surfaceData, out BuiltinData builtinData)

float3 V = GetWorldSpaceNormalizeViewDir(input.positionWS); // This should be remove by the compiler as we usually cal it before.
float height = SAMPLE_TEXTURE2D(_HeightMap, sampler_HeightMap, input.texCoord0).r * _HeightScale + _HeightBias;
// Transform view vector in tangent space
TransformWorldToTangent(V, input.tangentToWorld);
float3 viewDirTS = TransformWorldToTangent(V, input.tangentToWorld);
float2 offset = ParallaxOffset(viewDirTS, height);
input.texCoord0 += offset;
input.texCoord1 += offset;

正在加载...
取消
保存