envMap requires active preview scene to load

This commit is contained in:
Jason Gardner 2024-12-22 14:13:53 -06:00
parent ba15f2e251
commit 180a691bc5

View File

@ -103,6 +103,12 @@ class TextureGroup {
normalScale: new THREE.Vector2(-1),
});
}
if (PreviewScene.active) {
const g = new THREE.PMREMGenerator(Preview.selected.renderer);
material.envMap = g.fromScene(Canvas.scene, 0.0, 100, 1024).texture;
}
let textures = this.getTextures();
let color_tex = textures.find(t => t.pbr_channel == 'color');
let normal_tex = textures.find(t => t.pbr_channel == 'normal');