rayzee 5.4.3 → 5.5.0

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/src/TSL/Struct.js CHANGED
@@ -172,47 +172,25 @@ export const UVCache = struct( {
172
172
  allSameUV: 'bool',
173
173
  } );
174
174
 
175
- // Enhanced material cache
175
+ // Material cache — precomputed BRDF terms for the current surface hit.
176
+ // Fields are split into two groups:
177
+ // 1. BRDF evaluation: F0, NoV, diffuseColor, isPurelyDiffuse, alpha, k, alpha2
178
+ // 2. BRDF weight calc: invRoughness, metalFactor, iorFactor, maxSheenColor
176
179
  export const MaterialCache = struct( {
177
180
  F0: 'vec3', // Base reflectance
178
181
  NoV: 'float', // Normal dot View
179
- diffuseColor: 'vec3', // Precomputed diffuse color
180
- specularColor: 'vec3', // Precomputed specular color
181
- isMetallic: 'bool', // metalness > 0.7
182
+ diffuseColor: 'vec3', // Precomputed diffuse color (only for isPurelyDiffuse fast path)
182
183
  isPurelyDiffuse: 'bool', // Optimized path flag
183
- hasSpecialFeatures: 'bool', // Has transmission, clearcoat, etc.
184
184
  alpha: 'float', // roughness squared
185
185
  k: 'float', // Geometry term constant
186
186
  alpha2: 'float', // roughness to the fourth power
187
- // Flattened texture samples (TSL doesn't support nested struct types)
188
- tsAlbedo: 'vec4',
189
- tsEmissive: 'vec3',
190
- tsMetalness: 'float',
191
- tsRoughness: 'float',
192
- tsNormal: 'vec3',
193
- tsHasTextures: 'bool',
194
-
195
- // BRDF optimization: precomputed shared values
187
+ // BRDF weight calculation: precomputed shared values
196
188
  invRoughness: 'float', // 1.0 - roughness
197
189
  metalFactor: 'float', // 0.5 + 0.5 * metalness
198
190
  iorFactor: 'float', // min(2.0 / ior, 1.0)
199
191
  maxSheenColor: 'float', // max component of sheen color
200
192
  } );
201
193
 
202
- // Update PathState to include texture samples
203
- export const PathState = struct( {
204
- brdfWeights: BRDFWeights, // Cached BRDF weights
205
- samplingInfo: ImportanceSamplingInfo, // Cached importance sampling info
206
- materialCache: MaterialCache, // Cached material properties
207
- materialClass: MaterialClassification, // Cached material classification
208
- weightsComputed: 'bool', // Flag to track if weights are computed
209
- texturesLoaded: 'bool', // Flag to track if textures are loaded
210
- classificationCached: 'bool', // Flag for material classification
211
- materialCacheCached: 'bool', // Flag for material cache creation
212
- pathImportance: 'float', // Cached path importance estimate
213
- lastMaterialIndex: 'int', // Track material changes to preserve cache
214
- } );
215
-
216
194
  export const SamplingStrategyWeights = struct( {
217
195
  envWeight: 'float',
218
196
  specularWeight: 'float',