|
|
|
|
|
|
// /We need to decompress the normal ourselve here as UnpackNormalRGB will return a surface gradient |
|
|
|
float3 normalOS = SAMPLE_TEXTURE2D(ADD_IDX(_NormalMapOS), SAMPLER_NORMALMAP_IDX, ADD_IDX(layerTexCoord.base).uv).xyz * 2.0 - 1.0; |
|
|
|
// no need to renormalize normalOS for SurfaceGradientFromPerturbedNormal |
|
|
|
normalTS = SurfaceGradientFromPerturbedNormal(TransformWorldToObjectDir(input.worldToTangent[2]), normalOS); |
|
|
|
normalTS = SurfaceGradientFromPerturbedNormal(input.worldToTangent[2], TransformObjectToWorldDir(normalOS)); |
|
|
|
#else |
|
|
|
float3 normalOS = UnpackNormalRGB(SAMPLE_TEXTURE2D(ADD_IDX(_NormalMapOS), SAMPLER_NORMALMAP_IDX, ADD_IDX(layerTexCoord.base).uv), 1.0); |
|
|
|
normalTS = TransformObjectToTangent(normalOS, input.worldToTangent); |
|
|
|