@@ -39,6 +39,7 @@ export class NodeRenderGraphGeometryRendererBlock extends NodeRenderGraphBlock {
39
39
40
40
this . registerOutput ( "outputDepth" , NodeRenderGraphBlockConnectionPointTypes . BasedOnInput ) ;
41
41
this . registerOutput ( "geomViewDepth" , NodeRenderGraphBlockConnectionPointTypes . TextureViewDepth ) ;
42
+ this . registerOutput ( "geomNormViewDepth" , NodeRenderGraphBlockConnectionPointTypes . TextureNormalizedViewDepth ) ;
42
43
this . registerOutput ( "geomScreenDepth" , NodeRenderGraphBlockConnectionPointTypes . TextureScreenDepth ) ;
43
44
this . registerOutput ( "geomViewNormal" , NodeRenderGraphBlockConnectionPointTypes . TextureViewNormal ) ;
44
45
this . registerOutput ( "geomWorldNormal" , NodeRenderGraphBlockConnectionPointTypes . TextureWorldNormal ) ;
@@ -177,6 +178,13 @@ export class NodeRenderGraphGeometryRendererBlock extends NodeRenderGraphBlock {
177
178
@editableInPropertyPage ( "View depth type" , PropertyTypeForEdition . TextureType , "GEOMETRY BUFFERS" )
178
179
public viewDepthType = Constants . TEXTURETYPE_FLOAT ;
179
180
181
+ // Normalized view depth
182
+ @editableInPropertyPage ( "Normalized view depth format" , PropertyTypeForEdition . TextureFormat , "GEOMETRY BUFFERS" )
183
+ public normalizedViewDepthFormat = Constants . TEXTUREFORMAT_RED ;
184
+
185
+ @editableInPropertyPage ( "Normalized view depth type" , PropertyTypeForEdition . TextureType , "GEOMETRY BUFFERS" )
186
+ public normalizedViewDepthType = Constants . TEXTURETYPE_HALF_FLOAT ;
187
+
180
188
// Screen depth
181
189
@editableInPropertyPage ( "Screen depth format" , PropertyTypeForEdition . TextureFormat , "GEOMETRY BUFFERS" )
182
190
public screenDepthFormat = Constants . TEXTUREFORMAT_RED ;
@@ -283,74 +291,82 @@ export class NodeRenderGraphGeometryRendererBlock extends NodeRenderGraphBlock {
283
291
return this . _outputs [ 1 ] ;
284
292
}
285
293
294
+ /**
295
+ * Gets the geometry normalized view depth component
296
+ */
297
+ public get geomNormViewDepth ( ) : NodeRenderGraphConnectionPoint {
298
+ return this . _outputs [ 2 ] ;
299
+ }
300
+
286
301
/**
287
302
* Gets the geometry screen depth component
288
303
*/
289
304
public get geomScreenDepth ( ) : NodeRenderGraphConnectionPoint {
290
- return this . _outputs [ 2 ] ;
305
+ return this . _outputs [ 3 ] ;
291
306
}
292
307
293
308
/**
294
309
* Gets the geometry view normal component
295
310
*/
296
311
public get geomViewNormal ( ) : NodeRenderGraphConnectionPoint {
297
- return this . _outputs [ 3 ] ;
312
+ return this . _outputs [ 4 ] ;
298
313
}
299
314
300
315
/**
301
316
* Gets the world geometry normal component
302
317
*/
303
318
public get geomWorldNormal ( ) : NodeRenderGraphConnectionPoint {
304
- return this . _outputs [ 4 ] ;
319
+ return this . _outputs [ 5 ] ;
305
320
}
306
321
307
322
/**
308
323
* Gets the geometry local position component
309
324
*/
310
325
public get geomLocalPosition ( ) : NodeRenderGraphConnectionPoint {
311
- return this . _outputs [ 5 ] ;
326
+ return this . _outputs [ 6 ] ;
312
327
}
313
328
314
329
/**
315
330
* Gets the geometry world position component
316
331
*/
317
332
public get geomWorldPosition ( ) : NodeRenderGraphConnectionPoint {
318
- return this . _outputs [ 6 ] ;
333
+ return this . _outputs [ 7 ] ;
319
334
}
320
335
321
336
/**
322
337
* Gets the geometry albedo component
323
338
*/
324
339
public get geomAlbedo ( ) : NodeRenderGraphConnectionPoint {
325
- return this . _outputs [ 7 ] ;
340
+ return this . _outputs [ 8 ] ;
326
341
}
327
342
328
343
/**
329
344
* Gets the geometry reflectivity component
330
345
*/
331
346
public get geomReflectivity ( ) : NodeRenderGraphConnectionPoint {
332
- return this . _outputs [ 8 ] ;
347
+ return this . _outputs [ 9 ] ;
333
348
}
334
349
335
350
/**
336
351
* Gets the geometry velocity component
337
352
*/
338
353
public get geomVelocity ( ) : NodeRenderGraphConnectionPoint {
339
- return this . _outputs [ 9 ] ;
354
+ return this . _outputs [ 10 ] ;
340
355
}
341
356
342
357
/**
343
358
* Gets the geometry linear velocity component
344
359
*/
345
360
public get geomLinearVelocity ( ) : NodeRenderGraphConnectionPoint {
346
- return this . _outputs [ 10 ] ;
361
+ return this . _outputs [ 11 ] ;
347
362
}
348
363
349
364
protected override _buildBlock ( state : NodeRenderGraphBuildState ) {
350
365
super . _buildBlock ( state ) ;
351
366
352
367
const textureActivation = [
353
368
this . geomViewDepth . isConnected ,
369
+ this . geomNormViewDepth . isConnected ,
354
370
this . geomScreenDepth . isConnected ,
355
371
this . geomViewNormal . isConnected ,
356
372
this . geomWorldNormal . isConnected ,
@@ -368,6 +384,7 @@ export class NodeRenderGraphGeometryRendererBlock extends NodeRenderGraphBlock {
368
384
369
385
this . outputDepth . value = this . _frameGraphTask . outputDepthTexture ;
370
386
this . geomViewDepth . value = this . _frameGraphTask . geometryViewDepthTexture ;
387
+ this . geomNormViewDepth . value = this . _frameGraphTask . geometryNormViewDepthTexture ;
371
388
this . geomScreenDepth . value = this . _frameGraphTask . geometryScreenDepthTexture ;
372
389
this . geomViewNormal . value = this . _frameGraphTask . geometryViewNormalTexture ;
373
390
this . geomWorldNormal . value = this . _frameGraphTask . geometryWorldNormalTexture ;
@@ -386,6 +403,7 @@ export class NodeRenderGraphGeometryRendererBlock extends NodeRenderGraphBlock {
386
403
387
404
const textureFormats = [
388
405
this . viewDepthFormat ,
406
+ this . normalizedViewDepthFormat ,
389
407
this . screenDepthFormat ,
390
408
this . viewNormalFormat ,
391
409
this . worldNormalFormat ,
@@ -398,6 +416,7 @@ export class NodeRenderGraphGeometryRendererBlock extends NodeRenderGraphBlock {
398
416
] ;
399
417
const textureTypes = [
400
418
this . viewDepthType ,
419
+ this . normalizedViewDepthType ,
401
420
this . screenDepthType ,
402
421
this . viewNormalType ,
403
422
this . worldNormalType ,
@@ -410,6 +429,7 @@ export class NodeRenderGraphGeometryRendererBlock extends NodeRenderGraphBlock {
410
429
] ;
411
430
const bufferTypes = [
412
431
Constants . PREPASS_DEPTH_TEXTURE_TYPE ,
432
+ Constants . PREPASS_NORMALIZED_VIEW_DEPTH_TEXTURE_TYPE ,
413
433
Constants . PREPASS_SCREENSPACE_DEPTH_TEXTURE_TYPE ,
414
434
Constants . PREPASS_NORMAL_TEXTURE_TYPE ,
415
435
Constants . PREPASS_WORLD_NORMAL_TEXTURE_TYPE ,
@@ -441,6 +461,8 @@ export class NodeRenderGraphGeometryRendererBlock extends NodeRenderGraphBlock {
441
461
codes . push ( `${ this . _codeVariableName } .dontRenderWhenMaterialDepthWriteIsDisabled = ${ this . dontRenderWhenMaterialDepthWriteIsDisabled } ;` ) ;
442
462
codes . push ( `${ this . _codeVariableName } .viewDepthFormat = ${ this . viewDepthFormat } ;` ) ;
443
463
codes . push ( `${ this . _codeVariableName } .viewDepthType = ${ this . viewDepthType } ;` ) ;
464
+ codes . push ( `${ this . _codeVariableName } .normalizedViewDepthFormat = ${ this . normalizedViewDepthFormat } ;` ) ;
465
+ codes . push ( `${ this . _codeVariableName } .normalizedViewDepthType = ${ this . normalizedViewDepthType } ;` ) ;
444
466
codes . push ( `${ this . _codeVariableName } .screenDepthFormat = ${ this . screenDepthFormat } ;` ) ;
445
467
codes . push ( `${ this . _codeVariableName } .screenDepthType = ${ this . screenDepthType } ;` ) ;
446
468
codes . push ( `${ this . _codeVariableName } .localPositionFormat = ${ this . localPositionFormat } ;` ) ;
@@ -471,6 +493,8 @@ export class NodeRenderGraphGeometryRendererBlock extends NodeRenderGraphBlock {
471
493
serializationObject . dontRenderWhenMaterialDepthWriteIsDisabled = this . dontRenderWhenMaterialDepthWriteIsDisabled ;
472
494
serializationObject . viewDepthFormat = this . viewDepthFormat ;
473
495
serializationObject . viewDepthType = this . viewDepthType ;
496
+ serializationObject . normalizedViewDepthFormat = this . normalizedViewDepthFormat ;
497
+ serializationObject . normalizedViewDepthType = this . normalizedViewDepthType ;
474
498
serializationObject . screenDepthFormat = this . screenDepthFormat ;
475
499
serializationObject . screenDepthType = this . screenDepthType ;
476
500
serializationObject . localPositionFormat = this . localPositionFormat ;
@@ -501,6 +525,8 @@ export class NodeRenderGraphGeometryRendererBlock extends NodeRenderGraphBlock {
501
525
this . dontRenderWhenMaterialDepthWriteIsDisabled = serializationObject . dontRenderWhenMaterialDepthWriteIsDisabled ;
502
526
this . viewDepthFormat = serializationObject . viewDepthFormat ;
503
527
this . viewDepthType = serializationObject . viewDepthType ;
528
+ this . normalizedViewDepthFormat = serializationObject . normalizedViewDepthFormat ?? Constants . TEXTUREFORMAT_RED ;
529
+ this . normalizedViewDepthType = serializationObject . normalizedViewDepthType ?? Constants . TEXTURETYPE_UNSIGNED_BYTE ;
504
530
this . screenDepthFormat = serializationObject . screenDepthFormat ;
505
531
this . screenDepthType = serializationObject . screenDepthType ;
506
532
this . localPositionFormat = serializationObject . localPositionFormat ;
0 commit comments