|
@@ -1012,7 +1012,7 @@ THREE.ShaderLib = {
|
|
|
|
|
|
" const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );",
|
|
|
" const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );",
|
|
|
- " vec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );", // " vec4 res = fract( depth * bit_shift );",
|
|
|
+ " vec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );",
|
|
|
" res -= res.xxyz * bit_mask;",
|
|
|
" return res;",
|
|
|
|
|
@@ -1084,12 +1084,12 @@ THREE.ShaderLib = {
|
|
|
|
|
|
"vec4 pack1K ( float depth ) {",
|
|
|
|
|
|
- " depth /= 1000.0;",
|
|
|
- " const vec4 bitSh = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );",
|
|
|
- " const vec4 bitMsk = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );",
|
|
|
- " vec4 res = mod( depth * bitSh * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );",
|
|
|
- " res -= res.xxyz * bitMsk;",
|
|
|
- " return res; ",
|
|
|
+ " depth /= 1000.0;",
|
|
|
+ " const vec4 bitSh = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );",
|
|
|
+ " const vec4 bitMsk = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );",
|
|
|
+ " vec4 res = mod( depth * bitSh * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );",
|
|
|
+ " res -= res.xxyz * bitMsk;",
|
|
|
+ " return res; ",
|
|
|
|
|
|
"}",
|
|
|
|