Skip to content

Commit fe76ac8

Browse files
Add a test scene for HDRenderLoop
The scene use few rocks and normal map
1 parent c9aa951 commit fe76ac8

29 files changed

Lines changed: 3435 additions & 27 deletions

Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/TemplateDisneyGGX.hlsl

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,24 @@ PackedVaryings VertDefault(Attributes input)
114114
// Fill SurfaceData/Lighting data function
115115
//-------------------------------------------------------------------------------------
116116

117+
float3 TransformTangentToWorld(float3 normalTS, float4 tangentToWorld[3])
118+
{
119+
#if 0
120+
// regular normal
121+
float3 normalWS = normalize(tangentToWorld[2].xyz);
122+
#else
123+
// Do mul martix
124+
float3 tangent = tangentToWorld[0].xyz;
125+
float3 binormal = tangentToWorld[1].xyz;
126+
float3 normal = tangentToWorld[2].xyz;
127+
128+
// TO check: do we need to normalize ?
129+
float3 normalWS = normalize(tangent * normalTS.x + binormal * normalTS.y + normal * normalTS.z);
130+
#endif
131+
132+
return normalWS;
133+
}
134+
117135
SurfaceData GetSurfaceData(Varyings input)
118136
{
119137
SurfaceData data;
@@ -124,7 +142,10 @@ SurfaceData GetSurfaceData(Varyings input)
124142
data.specularColor = _SpecColor;
125143
data.smoothness = _Smoothness;
126144

127-
data.normal = input.tangentToWorld[2].xyz;//UnpackNormalDXT5nm(tex2D(_NormalMap, input.texCoord0));
145+
// TODO: think about using BC5
146+
float3 normalTS = UnpackNormalDXT5nm(tex2D(_NormalMap, input.texCoord0));
147+
// data.normal = input.tangentToWorld[2].xyz;
148+
data.normal = TransformTangentToWorld(normalTS, input.tangentToWorld);
128149

129150
// TODO: Sample lightmap/lightprobe/volume proxy
130151
// This should also handle projective lightmap

Assets/ScriptableRenderLoop/fptl/lightlistbuild-clustered.compute.meta

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)