Created
October 9, 2017 10:28
-
-
Save yorung/64d8161e6999126f6ac3a15dce90fab4 to your computer and use it in GitHub Desktop.
Convert tangent space normal to world space normal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float3 gerstnerWaveN = CalcGerstnerWaveNormal(vertexPosition + ofsByGerstnerWave); | |
float3 gerstnerWaveB = CalcGerstnerWaveBinormal(vertexPosition + ofsByGerstnerWave); | |
float3 gerstnerWaveT = CalcGerstnerWaveTangent(vertexPosition + ofsByGerstnerWave); | |
float3x3 rotator; | |
rotator[0] = gerstnerWaveB; | |
rotator[1] = gerstnerWaveN; | |
rotator[2] = gerstnerWaveT; | |
output.normal = mul(water_normal.xyz, rotator); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment