@volter/blender-engine 0.1.88 → 0.1.90

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.
@@ -363,15 +363,23 @@ ${compiled.uvs.map(n => `varying vec2 ${uvVarying(n)};`).join('\n')}`;
363
363
  '#include <project_vertex>',
364
364
  `vBlenderObjectPosition = transformed;
365
365
  vBlenderObjectNormal = objectNormal;
366
- mat4 blenderWorldMatrix = modelMatrix;
366
+ vec4 blenderWorldPosition = vec4(transformed, 1.0);
367
+ #ifdef USE_INSTANCING
368
+ blenderWorldPosition = instanceMatrix * blenderWorldPosition;
369
+ #endif
367
370
  #ifdef USE_BATCHING
368
- blenderWorldMatrix = blenderWorldMatrix * batchingMatrix;
371
+ blenderWorldPosition = batchingMatrix * blenderWorldPosition;
369
372
  #endif
370
- #ifdef USE_INSTANCING
371
- blenderWorldMatrix = blenderWorldMatrix * instanceMatrix;
373
+ vBlenderWorldPosition = (modelMatrix * blenderWorldPosition).xyz;
374
+ // Three already computed inverse-transpose(modelView) * objectNormal,
375
+ // including the supported instance/batch normal transforms. Multiplying by
376
+ // transpose(view) removes that view transform without another matrix inverse.
377
+ // Our instance planners retain ordinary draws for shear/singular transforms.
378
+ vec3 blenderWorldNormal = transpose(mat3(viewMatrix)) * transformedNormal;
379
+ #ifdef FLIP_SIDED
380
+ blenderWorldNormal = -blenderWorldNormal;
372
381
  #endif
373
- vBlenderWorldPosition = (blenderWorldMatrix * vec4(transformed, 1.0)).xyz;
374
- vBlenderWorldNormal = normalize(transpose(inverse(mat3(blenderWorldMatrix))) * objectNormal);
382
+ vBlenderWorldNormal = normalize(blenderWorldNormal);
375
383
  vBlenderOrco = blenderOrco;
376
384
  ${compiled.attributes.map(n => `${attributeVarying(n)} = ${graphAttributeName(n)};`).join('\n')}
377
385
  ${compiled.uvs.map(n => `${uvVarying(n)} = ${attribute(channels[n] ?? 0)};`).join('\n')}
@@ -109,7 +109,7 @@ export function applyPhysicalMaterial(material: THREE.MeshPhysicalMaterial, inpu
109
109
  blenderWorldExtinction: {value: new THREE.Vector3()}};
110
110
  uniforms.set(material, values);
111
111
  const held = values;
112
- material.customProgramCacheKey = () => `blender-principled-physical-v5${graphProgramKey(material)}`;
112
+ material.customProgramCacheKey = () => `blender-principled-physical-v6${graphProgramKey(material)}`;
113
113
  material.onBeforeRender = (renderer, scene, camera, geometry, object) => {
114
114
  bindNamedUvChannels(material, geometry);
115
115
  bindGraphDraw(material, geometry, renderer, scene, camera, object, graphShadow);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@volter/blender-engine",
3
3
  "author": "Volter AI, Inc.",
4
4
  "license": "GPL-3.0-or-later",
5
- "version": "0.1.88",
5
+ "version": "0.1.90",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },