mirror of
https://github.com/lubosz/overte.git
synced 2025-04-19 17:03:43 +02:00
Recompute Y from X/Z for normal maps
This commit is contained in:
parent
7cb2bff4c5
commit
ea2b188b64
1 changed files with 3 additions and 1 deletions
|
@ -64,7 +64,9 @@ float fetchRoughnessMap(vec2 uv) {
|
|||
uniform sampler2D normalMap;
|
||||
vec3 fetchNormalMap(vec2 uv) {
|
||||
// unpack normal, swizzle to get into hifi tangent space with Y axis pointing out
|
||||
return normalize(texture(normalMap, uv).rbg -vec3(0.5, 0.5, 0.5));
|
||||
vec2 t = 2.0 * (texture(normalMap, uv).rg - vec2(0.5, 0.5));
|
||||
vec2 t2 = t*t;
|
||||
return normalize(vec3(t.x, sqrt(1 - t2.x - t2.y), t.y));
|
||||
}
|
||||
<@endif@>
|
||||
|
||||
|
|
Loading…
Reference in a new issue