Skip to content

Shader issue in WebGLBackend with WebXR when using Line2 and LineSegments2 #31084

Open
@danrossi

Description

@danrossi

Description

I am trying to migrate the WebXR controller line to WebGPURenderer to also support linewidths and somehow drop off in opacity. There seems to be a shader compile issue when going into WebXR. It may not be liking the position and colors arrays given.

Error given

Error 0 - VALIDATE_STATUS false

Program Info Log: Vertex shader is not compiled.

ERROR: 0:107: 'cameraProjectionMatrix' : undeclared identifier
ERROR: 0:107: 'expression' :  left of '[' is not of type array, matrix, or vector 
ERROR: 0:107: 'expression' :  left of '[' is not of type array, matrix, or vector 
ERROR: 0:133: 'cameraProjectionMatrix' : undeclared identifier
ERROR: 0:134: 'cameraProjectionMatrix' : undeclared identifier

Reproduction steps

1.Setup Line2 or LineSegments2
2. Launch into WebXR with the emulator, Rift, Quest etc
3. Shader compile error in the console will appear

Code

const line = new LineSegments2( );
line.geometry.setPositions([ 10, 10, -10, 0, 0, -0.8 ]);
line.geometry.setColors([ 0.5, 0.5, 0.5, 0, 0, 0 ]);
line.material.linewidth = 4;
line.material.color.setHex(0xffffff);
line.computeLineDistances();
line.scale.set( 1, 1, 1 );

or

 const line = new Line2( );
 line.material.linewidth = 4;
 line.material.color.setHex(0xffffff);
 line.geometry.setPositions([ 10, 10, -10, 0, 0, -0.8 ]);
line.geometry.setColors([ 0.5, 0.5, 0.5, 0, 0, 0 ]);

Live example

Screenshots

No response

Version

r176

Device

Desktop

Browser

Chrome

OS

Windows

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions