@@ -81,7 +81,7 @@ function createMatrixPair( leftSpec, rightSpec ) {
8181 return [
8282 r [ 0 ] , g [ 0 ] , b [ 0 ] , // Column 0: coefficients for input R
8383 r [ 1 ] , g [ 1 ] , b [ 1 ] , // Column 1: coefficients for input G
84- r [ 2 ] , g [ 2 ] , b [ 2 ] // Column 2: coefficients for input B
84+ r [ 2 ] , g [ 2 ] , b [ 2 ] // Column 2: coefficients for input B
8585 ] ;
8686
8787 }
@@ -117,67 +117,67 @@ const ANAGLYPH_MATRICES = {
117117 // Paper: Left=[R,0,0], Right=[0,0,Lum]
118118 [ AnaglyphAlgorithm . TRUE ] : {
119119 [ AnaglyphColorMode . RED_CYAN ] : createMatrixPair (
120- { r : [ 1 , 0 , 0 ] } , // Left: R -> outR
121- { g : LUM , b : LUM } // Right: Lum -> outG, Lum -> outB
120+ { r : [ 1 , 0 , 0 ] } , // Left: R -> outR
121+ { g : LUM , b : LUM } // Right: Lum -> outG, Lum -> outB
122122 ) ,
123123 [ AnaglyphColorMode . MAGENTA_CYAN ] : createMatrixPair (
124- { r : [ 1 , 0 , 0 ] , b : [ 0 , 0 , 0.5 ] } , // Left: R -> outR, partial B -> outB
125- { g : LUM , b : [ 0 , 0 , 0.5 ] } // Right: Lum -> outG, partial B
124+ { r : [ 1 , 0 , 0 ] , b : [ 0 , 0 , 0.5 ] } , // Left: R -> outR, partial B -> outB
125+ { g : LUM , b : [ 0 , 0 , 0.5 ] } // Right: Lum -> outG, partial B
126126 ) ,
127127 [ AnaglyphColorMode . MAGENTA_GREEN ] : createMatrixPair (
128- { r : [ 1 , 0 , 0 ] , b : LUM } , // Left: R -> outR, Lum -> outB
129- { g : LUM } // Right: Lum -> outG
128+ { r : [ 1 , 0 , 0 ] , b : LUM } , // Left: R -> outR, Lum -> outB
129+ { g : LUM } // Right: Lum -> outG
130130 )
131131 } ,
132132
133133 // Grey Anaglyph - Luminance-based, no color, minimal ghosting
134134 // Paper: Left=[Lum,0,0], Right=[0,0,Lum]
135135 [ AnaglyphAlgorithm . GREY ] : {
136136 [ AnaglyphColorMode . RED_CYAN ] : createMatrixPair (
137- { r : LUM } , // Left: Lum -> outR
138- { g : LUM , b : LUM } // Right: Lum -> outG, Lum -> outB
137+ { r : LUM } , // Left: Lum -> outR
138+ { g : LUM , b : LUM } // Right: Lum -> outG, Lum -> outB
139139 ) ,
140140 [ AnaglyphColorMode . MAGENTA_CYAN ] : createMatrixPair (
141- { r : LUM , b : [ 0.15 , 0.29 , 0.06 ] } , // Left: Lum -> outR, half-Lum -> outB
142- { g : LUM , b : [ 0.15 , 0.29 , 0.06 ] } // Right: Lum -> outG, half-Lum -> outB
141+ { r : LUM , b : [ 0.15 , 0.29 , 0.06 ] } , // Left: Lum -> outR, half-Lum -> outB
142+ { g : LUM , b : [ 0.15 , 0.29 , 0.06 ] } // Right: Lum -> outG, half-Lum -> outB
143143 ) ,
144144 [ AnaglyphColorMode . MAGENTA_GREEN ] : createMatrixPair (
145- { r : LUM , b : LUM } , // Left: Lum -> outR, Lum -> outB
146- { g : LUM } // Right: Lum -> outG
145+ { r : LUM , b : LUM } , // Left: Lum -> outR, Lum -> outB
146+ { g : LUM } // Right: Lum -> outG
147147 )
148148 } ,
149149
150150 // Colour Anaglyph - Full color, high retinal rivalry
151151 // Paper: Left=[R,0,0], Right=[0,G,B]
152152 [ AnaglyphAlgorithm . COLOUR ] : {
153153 [ AnaglyphColorMode . RED_CYAN ] : createMatrixPair (
154- { r : [ 1 , 0 , 0 ] } , // Left: R -> outR
155- { g : [ 0 , 1 , 0 ] , b : [ 0 , 0 , 1 ] } // Right: G -> outG, B -> outB
154+ { r : [ 1 , 0 , 0 ] } , // Left: R -> outR
155+ { g : [ 0 , 1 , 0 ] , b : [ 0 , 0 , 1 ] } // Right: G -> outG, B -> outB
156156 ) ,
157157 [ AnaglyphColorMode . MAGENTA_CYAN ] : createMatrixPair (
158- { r : [ 1 , 0 , 0 ] , b : [ 0 , 0 , 0.5 ] } , // Left: R -> outR, partial B -> outB
159- { g : [ 0 , 1 , 0 ] , b : [ 0 , 0 , 0.5 ] } // Right: G -> outG, partial B -> outB
158+ { r : [ 1 , 0 , 0 ] , b : [ 0 , 0 , 0.5 ] } , // Left: R -> outR, partial B -> outB
159+ { g : [ 0 , 1 , 0 ] , b : [ 0 , 0 , 0.5 ] } // Right: G -> outG, partial B -> outB
160160 ) ,
161161 [ AnaglyphColorMode . MAGENTA_GREEN ] : createMatrixPair (
162- { r : [ 1 , 0 , 0 ] , b : [ 0 , 0 , 1 ] } , // Left: R -> outR, B -> outB
163- { g : [ 0 , 1 , 0 ] } // Right: G -> outG
162+ { r : [ 1 , 0 , 0 ] , b : [ 0 , 0 , 1 ] } , // Left: R -> outR, B -> outB
163+ { g : [ 0 , 1 , 0 ] } // Right: G -> outG
164164 )
165165 } ,
166166
167167 // Half-Colour Anaglyph - Luminance for left red, full color for right cyan
168168 // Paper: Left=[Lum,0,0], Right=[0,G,B]
169169 [ AnaglyphAlgorithm . HALF_COLOUR ] : {
170170 [ AnaglyphColorMode . RED_CYAN ] : createMatrixPair (
171- { r : LUM } , // Left: Lum -> outR
172- { g : [ 0 , 1 , 0 ] , b : [ 0 , 0 , 1 ] } // Right: G -> outG, B -> outB
171+ { r : LUM } , // Left: Lum -> outR
172+ { g : [ 0 , 1 , 0 ] , b : [ 0 , 0 , 1 ] } // Right: G -> outG, B -> outB
173173 ) ,
174174 [ AnaglyphColorMode . MAGENTA_CYAN ] : createMatrixPair (
175- { r : LUM , b : [ 0.15 , 0.29 , 0.06 ] } , // Left: Lum -> outR, half-Lum -> outB
175+ { r : LUM , b : [ 0.15 , 0.29 , 0.06 ] } , // Left: Lum -> outR, half-Lum -> outB
176176 { g : [ 0 , 1 , 0 ] , b : [ 0.15 , 0.29 , 0.06 ] } // Right: G -> outG, half-Lum -> outB
177177 ) ,
178178 [ AnaglyphColorMode . MAGENTA_GREEN ] : createMatrixPair (
179- { r : LUM , b : LUM } , // Left: Lum -> outR, Lum -> outB
180- { g : [ 0 , 1 , 0 ] } // Right: G -> outG
179+ { r : LUM , b : LUM } , // Left: Lum -> outR, Lum -> outB
180+ { g : [ 0 , 1 , 0 ] } // Right: G -> outG
181181 )
182182 } ,
183183
@@ -223,16 +223,16 @@ const ANAGLYPH_MATRICES = {
223223 // Paper: Left=[0,0.7G+0.3B,0,0], Right=[0,G,B]
224224 [ AnaglyphAlgorithm . OPTIMISED ] : {
225225 [ AnaglyphColorMode . RED_CYAN ] : createMatrixPair (
226- { r : [ 0 , 0.7 , 0.3 ] } , // Left: 0.7G+0.3B -> outR
227- { g : [ 0 , 1 , 0 ] , b : [ 0 , 0 , 1 ] } // Right: G -> outG, B -> outB
226+ { r : [ 0 , 0.7 , 0.3 ] } , // Left: 0.7G+0.3B -> outR
227+ { g : [ 0 , 1 , 0 ] , b : [ 0 , 0 , 1 ] } // Right: G -> outG, B -> outB
228228 ) ,
229229 [ AnaglyphColorMode . MAGENTA_CYAN ] : createMatrixPair (
230230 { r : [ 0 , 0.7 , 0.3 ] , b : [ 0 , 0 , 0.5 ] } , // Left: 0.7G+0.3B -> outR, partial B
231- { g : [ 0 , 1 , 0 ] , b : [ 0 , 0 , 0.5 ] } // Right: G -> outG, partial B
231+ { g : [ 0 , 1 , 0 ] , b : [ 0 , 0 , 0.5 ] } // Right: G -> outG, partial B
232232 ) ,
233233 [ AnaglyphColorMode . MAGENTA_GREEN ] : createMatrixPair (
234234 { r : [ 0 , 0.7 , 0.3 ] , b : [ 0 , 0 , 1 ] } , // Left: 0.7G+0.3B -> outR, B -> outB
235- { g : [ 0 , 1 , 0 ] } // Right: G -> outG
235+ { g : [ 0 , 1 , 0 ] } // Right: G -> outG
236236 )
237237 } ,
238238
@@ -241,20 +241,20 @@ const ANAGLYPH_MATRICES = {
241241 // Paper matrix [8]: Left=[0.439R+0.447G+0.148B, 0, 0], Right=[0, 0.095R+0.934G+0.005B, 0.018R+0.028G+1.057B]
242242 [ AnaglyphAlgorithm . COMPROMISE ] : {
243243 [ AnaglyphColorMode . RED_CYAN ] : createMatrixPair (
244- { r : [ 0.439 , 0.447 , 0.148 ] } , // Left: weighted RGB -> outR
244+ { r : [ 0.439 , 0.447 , 0.148 ] } , // Left: weighted RGB -> outR
245245 {
246- g : [ 0.095 , 0.934 , 0.005 ] , // Right: weighted RGB -> outG
247- b : [ 0.018 , 0.028 , 1.057 ] // Right: weighted RGB -> outB
246+ g : [ 0.095 , 0.934 , 0.005 ] , // Right: weighted RGB -> outG
247+ b : [ 0.018 , 0.028 , 1.057 ] // Right: weighted RGB -> outB
248248 }
249249 ) ,
250250 [ AnaglyphColorMode . MAGENTA_CYAN ] : createMatrixPair (
251251 {
252252 r : [ 0.439 , 0.447 , 0.148 ] ,
253- b : [ 0.009 , 0.014 , 0.074 ] // Partial blue from left
253+ b : [ 0.009 , 0.014 , 0.074 ] // Partial blue from left
254254 } ,
255255 {
256256 g : [ 0.095 , 0.934 , 0.005 ] ,
257- b : [ 0.009 , 0.014 , 0.528 ] // Partial blue from right
257+ b : [ 0.009 , 0.014 , 0.528 ] // Partial blue from right
258258 }
259259 ) ,
260260 [ AnaglyphColorMode . MAGENTA_GREEN ] : createMatrixPair (
@@ -275,7 +275,7 @@ const ANAGLYPH_MATRICES = {
275275 *
276276 * This implementation uses CameraUtils.frameCorners() to align stereo
277277 * camera frustums to a virtual screen plane, providing accurate depth
278- * perception with zero parallax at the screen distance.
278+ * perception with zero parallax at the plane distance.
279279 *
280280 * @augments StereoCompositePassNode
281281 * @three_import import { anaglyphPass, AnaglyphAlgorithm, AnaglyphColorMode } from 'three/addons/tsl/display/AnaglyphPassNode.js';
@@ -317,8 +317,8 @@ class AnaglyphPassNode extends StereoCompositePassNode {
317317 this . eyeSep = 0.064 ;
318318
319319 /**
320- * The distance from the viewer to the virtual screen plane
321- * where zero parallax (screen depth) occurs.
320+ * The distance in world units from the viewer to the virtual
321+ * screen plane where zero parallax (screen depth) occurs.
322322 * Objects at this distance appear at the screen surface.
323323 * Objects closer appear in front of the screen (negative parallax).
324324 * Objects further appear behind the screen (positive parallax).
@@ -329,7 +329,7 @@ class AnaglyphPassNode extends StereoCompositePassNode {
329329 * @type {number }
330330 * @default 0.5
331331 */
332- this . screenDistance = 0.5 ;
332+ this . planeDistance = 0.5 ;
333333
334334 /**
335335 * The current anaglyph algorithm.
@@ -462,12 +462,12 @@ class AnaglyphPassNode extends StereoCompositePassNode {
462462 _eyeL . copy ( camera . position ) . addScaledVector ( _right , - halfSep ) ;
463463 _eyeR . copy ( camera . position ) . addScaledVector ( _right , halfSep ) ;
464464
465- // Calculate screen center (at screenDistance in front of the camera center)
466- _screenCenter . copy ( camera . position ) . addScaledVector ( _forward , - this . screenDistance ) ;
465+ // Calculate screen center (at planeDistance in front of the camera center)
466+ _screenCenter . copy ( camera . position ) . addScaledVector ( _forward , - this . planeDistance ) ;
467467
468468 // Calculate screen dimensions from camera FOV and aspect ratio
469469 const DEG2RAD = Math . PI / 180 ;
470- const halfHeight = this . screenDistance * Math . tan ( DEG2RAD * camera . fov / 2 ) ;
470+ const halfHeight = this . planeDistance * Math . tan ( DEG2RAD * camera . fov / 2 ) ;
471471 const halfWidth = halfHeight * camera . aspect ;
472472
473473 // Calculate screen corners
0 commit comments