@@ -132,7 +132,7 @@ class OutlineRenderer {
132132 } ) ;
133133
134134 // custom shader pass for the outline camera
135- this . outlineShaderPass = this . outlineCameraEntity . camera . setShaderPass ( 'OutlineShaderPass ' ) ;
135+ this . outlineShaderPass = this . outlineCameraEntity . camera . setShaderPass ( 'pcOutline ' ) ;
136136
137137 // function called after the camera has rendered the outline objects to the texture
138138 this . postRender = ( cameraComponent ) => {
@@ -168,27 +168,13 @@ class OutlineRenderer {
168168 } ) ;
169169
170170 this . quadRenderer = new QuadRender ( this . shaderBlend ) ;
171-
172- this . whiteTex = new Texture ( device , {
173- name : 'OutlineWhiteTexture' ,
174- width : 1 ,
175- height : 1 ,
176- format : PIXELFORMAT_SRGBA8 ,
177- mipmaps : false
178- } ) ;
179- const pixels = this . whiteTex . lock ( ) ;
180- pixels . set ( new Uint8Array ( [ 255 , 255 , 255 , 255 ] ) ) ;
181- this . whiteTex . unlock ( ) ;
182171 }
183172
184173 /**
185174 * Destroy the outline renderer and its resources.
186175 */
187176 destroy ( ) {
188177
189- this . whiteTex . destroy ( ) ;
190- this . whiteTex = null ;
191-
192178 this . outlineCameraEntity . destroy ( ) ;
193179 this . outlineCameraEntity = null ;
194180
@@ -248,7 +234,7 @@ class OutlineRenderer {
248234
249235 if ( options . pass === outlineShaderPass ) {
250236
251- // custom shader for the outline shader pass, renders single color meshes using emissive color
237+ // custom shader for the outline shader pass, preserving material opacity
252238 const opts = new StandardMaterialOptions ( ) ;
253239 opts . defines = options . defines ;
254240 opts . opacityMap = options . opacityMap ;
@@ -272,11 +258,10 @@ class OutlineRenderer {
272258 return options ;
273259 } ;
274260
275- // set emissive color override for the outline shader pass only
261+ // set the color consumed only by the pcOutline shader variant
276262 _tempColor . linear ( color ) ;
277263 const colArray = new Float32Array ( [ _tempColor . r , _tempColor . g , _tempColor . b ] ) ;
278- meshInstance . setParameter ( 'material_emissive' , colArray , 1 << this . outlineShaderPass ) ;
279- meshInstance . setParameter ( 'texture_emissiveMap' , this . whiteTex , 1 << this . outlineShaderPass ) ;
264+ meshInstance . setParameter ( 'pcOutlineColor' , colArray ) ;
280265 }
281266 } ) ;
282267
@@ -297,7 +282,7 @@ class OutlineRenderer {
297282 meshInstances . forEach ( ( meshInstance ) => {
298283 if ( meshInstance . material instanceof StandardMaterial ) {
299284 meshInstance . material . onUpdateShader = null ;
300- meshInstance . deleteParameter ( 'material_emissive ' ) ;
285+ meshInstance . deleteParameter ( 'pcOutlineColor ' ) ;
301286 }
302287 } ) ;
303288 }
0 commit comments