Sha256: 6dcc90465cc38dade3b86f92ce63bf93358195cd5e69828a8e0c73ade5eb9636
Contents?: true
Size: 698 Bytes
Versions: 21
Compression:
Stored size: 698 Bytes
Contents
#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; // Per-Pixel Tangent Space Normal Mapping // http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) { vec3 q0 = dFdx( eye_pos.xyz ); vec3 q1 = dFdy( eye_pos.xyz ); vec2 st0 = dFdx( vUv.st ); vec2 st1 = dFdy( vUv.st ); vec3 S = normalize( q0 * st1.t - q1 * st0.t ); vec3 T = normalize( -q0 * st1.s + q1 * st0.s ); vec3 N = normalize( surf_norm ); vec3 mapN = texture( normalMap, vUv ).xyz * 2.0 - 1.0; mapN.xy = normalScale * mapN.xy; mat3 tsn = mat3( S, T, N ); return normalize( tsn * mapN ); } #endif
Version data entries
21 entries across 21 versions & 2 rubygems
Version | Path |
---|---|
mittsu-0.1.0 | lib/mittsu/renderers/shaders/shader_chunk/normalmap_pars_fragment.glsl |