rayzee 4.8.13 → 4.8.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/rayzee.es.js +16 -14
- package/dist/rayzee.es.js.map +1 -1
- package/dist/rayzee.umd.js +2 -2
- package/dist/rayzee.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/PathTracerApp.js +9 -1
- package/src/Processor/AssetLoader.js +1 -1
- package/src/RenderSettings.js +1 -0
- package/src/TSL/LightsSampling.js +6 -7
package/package.json
CHANGED
package/src/PathTracerApp.js
CHANGED
|
@@ -67,6 +67,7 @@ export class PathTracerApp extends EventDispatcher {
|
|
|
67
67
|
* @param {HTMLCanvasElement} canvas - Canvas element for rendering
|
|
68
68
|
* @param {Object} [options] - Engine options
|
|
69
69
|
* @param {boolean} [options.autoResize=true] - Automatically listen for window resize events
|
|
70
|
+
* @param {boolean} [options.showStats=true] - Show the performance stats panel
|
|
70
71
|
* @param {HTMLElement} [options.statsContainer] - DOM element to append the stats panel to (defaults to document.body)
|
|
71
72
|
*/
|
|
72
73
|
constructor( canvas, options = {} ) {
|
|
@@ -76,6 +77,7 @@ export class PathTracerApp extends EventDispatcher {
|
|
|
76
77
|
this.canvas = canvas;
|
|
77
78
|
this.denoiserCanvas = null;
|
|
78
79
|
this._autoResize = options.autoResize !== false;
|
|
80
|
+
this._showStats = options.showStats !== false;
|
|
79
81
|
this._statsContainer = options.statsContainer || null;
|
|
80
82
|
|
|
81
83
|
// ── Settings (single source of truth for all render parameters) ──
|
|
@@ -507,7 +509,7 @@ export class PathTracerApp extends EventDispatcher {
|
|
|
507
509
|
this.stages.pathTracer.setupMaterial();
|
|
508
510
|
|
|
509
511
|
// Setup stats panel
|
|
510
|
-
this._initStats();
|
|
512
|
+
if ( this._showStats ) this._initStats();
|
|
511
513
|
|
|
512
514
|
this.isInitialized = true;
|
|
513
515
|
console.log( 'WebGPU Path Tracer App initialized' );
|
|
@@ -2236,6 +2238,12 @@ export class PathTracerApp extends EventDispatcher {
|
|
|
2236
2238
|
|
|
2237
2239
|
},
|
|
2238
2240
|
|
|
2241
|
+
handleInteractionModeEnabled: ( value ) => {
|
|
2242
|
+
|
|
2243
|
+
this.setInteractionModeEnabled( value );
|
|
2244
|
+
|
|
2245
|
+
},
|
|
2246
|
+
|
|
2239
2247
|
};
|
|
2240
2248
|
|
|
2241
2249
|
}
|
|
@@ -1214,7 +1214,7 @@ export class AssetLoader extends EventDispatcher {
|
|
|
1214
1214
|
|
|
1215
1215
|
const light = new RectAreaLight(
|
|
1216
1216
|
new Color( ...userData.color ),
|
|
1217
|
-
userData.intensity / Math.PI, // Adjust intensity for better visual results
|
|
1217
|
+
userData.intensity * 0.1 / Math.PI, // Adjust intensity for better visual results
|
|
1218
1218
|
userData.width,
|
|
1219
1219
|
userData.height
|
|
1220
1220
|
);
|
package/src/RenderSettings.js
CHANGED
|
@@ -40,6 +40,7 @@ const SETTING_ROUTES = {
|
|
|
40
40
|
|
|
41
41
|
// ── Multi-stage / special handling ────────────────────────────
|
|
42
42
|
|
|
43
|
+
interactionModeEnabled: { handler: 'handleInteractionModeEnabled', reset: false },
|
|
43
44
|
maxSamples: { handler: 'handleMaxSamples', reset: false },
|
|
44
45
|
transparentBackground: { handler: 'handleTransparentBackground' },
|
|
45
46
|
exposure: { handler: 'handleExposure' },
|
|
@@ -145,7 +145,7 @@ export const sampleRectAreaLight = Fn( ( [ light, rayOrigin, ruv, lightSelection
|
|
|
145
145
|
const cosAngle = dot( direction.negate(), lightNormal ).toVar();
|
|
146
146
|
|
|
147
147
|
ls_lightType.assign( int( LIGHT_TYPE_AREA ) );
|
|
148
|
-
ls_emission.assign( light.color.mul( light.intensity )
|
|
148
|
+
ls_emission.assign( light.color.mul( light.intensity ) );
|
|
149
149
|
ls_distance.assign( dist );
|
|
150
150
|
ls_direction.assign( direction );
|
|
151
151
|
// Guard division: ensure denominator is never zero
|
|
@@ -205,7 +205,7 @@ export const sampleCircAreaLight = Fn( ( [ light, rayOrigin, ruv, lightSelection
|
|
|
205
205
|
const cosAngle = dot( direction.negate(), lightNormal ).toVar();
|
|
206
206
|
|
|
207
207
|
ls_lightType.assign( int( LIGHT_TYPE_AREA ) );
|
|
208
|
-
ls_emission.assign( light.color.mul( light.intensity )
|
|
208
|
+
ls_emission.assign( light.color.mul( light.intensity ) );
|
|
209
209
|
ls_distance.assign( dist );
|
|
210
210
|
ls_direction.assign( direction );
|
|
211
211
|
// Guard division
|
|
@@ -1062,15 +1062,14 @@ export const calculateDirectLightingUnified = Fn( ( [
|
|
|
1062
1062
|
const lightPdfWeighted = lightSample.pdf.mul( lightWeight ).toVar();
|
|
1063
1063
|
const brdfPdfWeighted = bPdf.mul( brdfWeight ).toVar();
|
|
1064
1064
|
|
|
1065
|
-
// Apply power heuristic for area lights
|
|
1065
|
+
// Apply power heuristic only for area lights — the BRDF path can
|
|
1066
|
+
// intersect area lights, so both strategies contribute and MIS is valid.
|
|
1067
|
+
// Point/spot/directional lights are delta or non-intersectable by the
|
|
1068
|
+
// BRDF path, so MIS would only reduce energy without compensation.
|
|
1066
1069
|
If( lightSample.lightType.equal( int( LIGHT_TYPE_AREA ) ), () => {
|
|
1067
1070
|
|
|
1068
1071
|
misW.assign( powerHeuristic( { pdf1: lightPdfWeighted, pdf2: brdfPdfWeighted } ) );
|
|
1069
1072
|
|
|
1070
|
-
} ).ElseIf( bounceIndex.equal( int( 0 ) ).and( lightSample.lightType.equal( int( LIGHT_TYPE_DIRECTIONAL ) ) ), () => {
|
|
1071
|
-
|
|
1072
|
-
misW.assign( powerHeuristic( { pdf1: lightPdfWeighted, pdf2: brdfPdfWeighted } ) );
|
|
1073
|
-
|
|
1074
1073
|
} );
|
|
1075
1074
|
|
|
1076
1075
|
} );
|