@@ -543,7 +543,14 @@ function vtkWebGPUCellArrayMapper(publicAPI, model) {
543543 const edgeColor = ppty . getEdgeColorByReference ?. ( ) ;
544544 if ( edgeColor ) model . UBO . setArray ( 'EdgeColor' , [ ...edgeColor , 1.0 ] ) ;
545545 model . UBO . setValue ( 'LineWidth' , ppty . getLineWidth ( ) ) ;
546- model . UBO . setValue ( 'Opacity' , ppty . getOpacity ( ) ) ;
546+ const edgeLikeRepresentation =
547+ model . primitiveType === PrimitiveTypes . TriangleEdges ||
548+ model . primitiveType === PrimitiveTypes . TriangleStripEdges ||
549+ ppty . getRepresentation ( ) === Representation . WIREFRAME ;
550+ model . UBO . setValue (
551+ 'Opacity' ,
552+ edgeLikeRepresentation ? ppty . getEdgeOpacity ( ) : ppty . getOpacity ( )
553+ ) ;
547554 model . UBO . setValue ( 'PropID' , model . WebGPUActor . getPropID ( ) ) ;
548555 const cp = publicAPI . getCoincidentParameters ( ) ;
549556 model . UBO . setValue ( 'CoincidentFactor' , cp . factor ) ;
@@ -825,13 +832,14 @@ function vtkWebGPUCellArrayMapper(publicAPI, model) {
825832 let code = fDesc . getCode ( ) ;
826833
827834 // Code that runs if the fragment shader includes normals
828- if (
829- code . includes ( 'var normal:' ) &&
835+ const hasNormal = code . includes ( 'var normal:' ) ;
836+ const needLighting =
837+ hasNormal &&
830838 model . useRendererMatrix &&
831839 ! isEdges ( hash ) &&
832840 ! model . is2D &&
833- ! hash . includes ( 'sel' )
834- ) {
841+ ! hash . includes ( 'sel' ) ;
842+ if ( needLighting ) {
835843 const lightingCode = [
836844 // Vectors needed for light calculations
837845 ' let fragPos = vec3<f32>(input.vertexVC.xyz);' ,
@@ -1236,9 +1244,16 @@ function vtkWebGPUCellArrayMapper(publicAPI, model) {
12361244 // --- Normals ---
12371245 const usage = publicAPI . getUsage ( representation , primType ) ;
12381246 model . _usesCellNormals = false ;
1247+ // Add normals for triangles/strips, AND for lines in wireframe mode (converted from triangles)
1248+ const isWireframeFromTriangles =
1249+ representation === Representation . WIREFRAME &&
1250+ ( primType === PrimitiveTypes . Triangles ||
1251+ primType === PrimitiveTypes . TriangleStrips ) ;
12391252 if (
12401253 ! model . is2D && // no lighting on Property2D
1241- ( usage === BufferUsage . Triangles || usage === BufferUsage . Strips )
1254+ ( usage === BufferUsage . Triangles ||
1255+ usage === BufferUsage . Strips ||
1256+ isWireframeFromTriangles )
12421257 ) {
12431258 const normals = pd . getPointData ( ) . getNormals ( ) ;
12441259 // https://vtk.org/doc/nightly/html/classvtkPolyDataTangents.html
0 commit comments