rayzee 4.8.12 → 4.8.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rayzee",
3
- "version": "4.8.12",
3
+ "version": "4.8.13",
4
4
  "type": "module",
5
5
  "description": "Real-time WebGPU path tracing engine built on Three.js",
6
6
  "main": "dist/rayzee.umd.js",
@@ -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,
1217
+ userData.intensity / Math.PI, // Adjust intensity for better visual results
1218
1218
  userData.width,
1219
1219
  userData.height
1220
1220
  );
@@ -391,11 +391,12 @@ export const traverseBVHShadow = Fn( ( [
391
391
  bvhBuffer,
392
392
  triangleBuffer,
393
393
  materialBuffer,
394
+ maxShadowDist,
394
395
  ] ) => {
395
396
 
396
397
  const closestHit = HitInfo( {
397
398
  didHit: false,
398
- dst: float( 1e20 ),
399
+ dst: maxShadowDist,
399
400
  hitPoint: vec3( 0.0 ),
400
401
  normal: vec3( 0.0 ),
401
402
  uv: vec2( 0.0 ),
@@ -79,6 +79,7 @@ export const traceShadowRay = Fn( ( [
79
79
 
80
80
  const transmittance = float( 1.0 ).toVar();
81
81
  const rayOrigin = origin.toVar();
82
+ const remainingDist = float( maxDist ).toVar();
82
83
 
83
84
  const MAX_SHADOW_TRANSMISSIONS = 8;
84
85
 
@@ -91,10 +92,11 @@ export const traceShadowRay = Fn( ( [
91
92
  bvhBuffer,
92
93
  triangleBuffer,
93
94
  materialBuffer,
95
+ remainingDist,
94
96
  ) );
95
97
 
96
- // No hit or hit beyond light distance
97
- If( shadowHit.didHit.not().or( shadowHit.dst.greaterThan( maxDist ) ), () => {
98
+ // No hit within remaining distance to light
99
+ If( shadowHit.didHit.not(), () => {
98
100
 
99
101
  Break();
100
102
 
@@ -139,8 +141,9 @@ export const traceShadowRay = Fn( ( [
139
141
 
140
142
  } );
141
143
 
142
- // Continue ray
144
+ // Continue ray past transmissive surface
143
145
  rayOrigin.assign( shadowHit.hitPoint.add( dir.mul( 0.001 ) ) );
146
+ remainingDist.subAssign( shadowHit.dst.add( 0.001 ) );
144
147
 
145
148
  } ).ElseIf( shadowMaterial.transparent, () => {
146
149
 
@@ -154,8 +157,9 @@ export const traceShadowRay = Fn( ( [
154
157
 
155
158
  } );
156
159
 
157
- // Continue ray
160
+ // Continue ray past transparent surface
158
161
  rayOrigin.assign( shadowHit.hitPoint.add( dir.mul( 0.001 ) ) );
162
+ remainingDist.subAssign( shadowHit.dst.add( 0.001 ) );
159
163
 
160
164
  } ).Else( () => {
161
165