Преглед изворни кода

DFGLUT: Mention direct lighting use in headers, fix generator output path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Mr.doob пре 1 недеља
родитељ
комит
d60e5bd868
3 измењених фајлова са 14 додато и 10 уклоњено
  1. 2 1
      src/nodes/functions/BSDF/DFGLUT.js
  2. 2 1
      src/renderers/shaders/DFGLUTData.js
  3. 10 8
      utils/generateDFGLUT.js

+ 2 - 1
src/nodes/functions/BSDF/DFGLUT.js

@@ -5,7 +5,8 @@ import { DataTexture } from '../../../textures/DataTexture.js';
 import { RGFormat, HalfFloatType, LinearFilter, ClampToEdgeWrapping } from '../../../constants.js';
 import { RGFormat, HalfFloatType, LinearFilter, ClampToEdgeWrapping } from '../../../constants.js';
 
 
 /**
 /**
- * Precomputed DFG LUT for Image-Based Lighting
+ * Precomputed DFG LUT for physically based specular lighting, used by both
+ * image-based lighting and direct-light multi-scattering energy compensation
  * Resolution: 16x16
  * Resolution: 16x16
  * Samples: 4096 per texel
  * Samples: 4096 per texel
  * Format: RG16F (2 half floats per texel: scale, bias)
  * Format: RG16F (2 half floats per texel: scale, bias)

+ 2 - 1
src/renderers/shaders/DFGLUTData.js

@@ -1,5 +1,6 @@
 /**
 /**
- * Precomputed DFG LUT for Image-Based Lighting
+ * Precomputed DFG LUT for physically based specular lighting, used by both
+ * image-based lighting and direct-light multi-scattering energy compensation
  * Resolution: 16x16
  * Resolution: 16x16
  * Samples: 4096 per texel
  * Samples: 4096 per texel
  * Format: RG16F (2 half floats per texel: scale, bias)
  * Format: RG16F (2 half floats per texel: scale, bias)

+ 10 - 8
utils/generateDFGLUT.js

@@ -1,8 +1,8 @@
 /**
 /**
  * DFG LUT Generator
  * DFG LUT Generator
  *
  *
- * Generates a precomputed lookup table for the split-sum approximation
- * used in Image-Based Lighting.
+ * Generates a precomputed lookup table for the split-sum approximation,
+ * used by image-based lighting and direct-light multi-scattering energy compensation.
  *
  *
  * Reference: "Real Shading in Unreal Engine 4" by Brian Karis
  * Reference: "Real Shading in Unreal Engine 4" by Brian Karis
  */
  */
@@ -243,7 +243,8 @@ function saveAsJavaScript( data ) {
 	}
 	}
 
 
 	const webgl = `/**
 	const webgl = `/**
- * Precomputed DFG LUT for Image-Based Lighting
+ * Precomputed DFG LUT for physically based specular lighting, used by both
+ * image-based lighting and direct-light multi-scattering energy compensation
  * Resolution: ${LUT_SIZE}x${LUT_SIZE}
  * Resolution: ${LUT_SIZE}x${LUT_SIZE}
  * Samples: ${SAMPLE_COUNT} per texel
  * Samples: ${SAMPLE_COUNT} per texel
  * Format: RG16F (2 half floats per texel: scale, bias)
  * Format: RG16F (2 half floats per texel: scale, bias)
@@ -285,7 +286,8 @@ import { DataTexture } from '../../../textures/DataTexture.js';
 import { RGFormat, HalfFloatType, LinearFilter, ClampToEdgeWrapping } from '../../../constants.js';
 import { RGFormat, HalfFloatType, LinearFilter, ClampToEdgeWrapping } from '../../../constants.js';
 
 
 /**
 /**
- * Precomputed DFG LUT for Image-Based Lighting
+ * Precomputed DFG LUT for physically based specular lighting, used by both
+ * image-based lighting and direct-light multi-scattering energy compensation
  * Resolution: ${LUT_SIZE}x${LUT_SIZE}
  * Resolution: ${LUT_SIZE}x${LUT_SIZE}
  * Samples: ${SAMPLE_COUNT} per texel
  * Samples: ${SAMPLE_COUNT} per texel
  * Format: RG16F (2 half floats per texel: scale, bias)
  * Format: RG16F (2 half floats per texel: scale, bias)
@@ -297,7 +299,7 @@ ${rows.join( ',\n' )}
 
 
 let lut = null;
 let lut = null;
 
 
-const DFG = /*@__PURE__*/ Fn( ( { roughness, dotNV } ) => {
+const DFGLUT = /*@__PURE__*/ Fn( ( { roughness, dotNV } ) => {
 
 
 	if ( lut === null ) {
 	if ( lut === null ) {
 
 
@@ -318,14 +320,14 @@ const DFG = /*@__PURE__*/ Fn( ( { roughness, dotNV } ) => {
 
 
 } );
 } );
 
 
-export default DFG;
+export default DFGLUT;
 `;
 `;
 
 
 	fs.writeFileSync( './src/renderers/shaders/DFGLUTData.js', webgl );
 	fs.writeFileSync( './src/renderers/shaders/DFGLUTData.js', webgl );
 	console.log( 'Saved WebGL version to ./src/renderers/shaders/DFGLUTData.js' );
 	console.log( 'Saved WebGL version to ./src/renderers/shaders/DFGLUTData.js' );
 
 
-	fs.writeFileSync( './src/nodes/functions/BSDF/DFG.js', webgpu );
-	console.log( 'Saved WebGPU version to ./src/nodes/functions/BSDF/DFG.js' );
+	fs.writeFileSync( './src/nodes/functions/BSDF/DFGLUT.js', webgpu );
+	console.log( 'Saved WebGPU version to ./src/nodes/functions/BSDF/DFGLUT.js' );
 
 
 }
 }
 
 

粤ICP备19079148号