Skip to content

Commit 5bf53ee

Browse files
authored
NodeMaterialObserver: Fix missing intensity uniform updates. (#31120)
1 parent f7ad644 commit 5bf53ee

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

examples/webgpu_materials_lightmap.html

+19-6
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,17 @@
2424
import * as THREE from 'three';
2525
import { vec4, color, positionLocal, mix } from 'three/tsl';
2626

27-
import Stats from 'three/addons/libs/stats.module.js';
27+
import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
2828

2929
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
3030

31-
let container, stats;
31+
let container;
3232
let camera, scene, renderer;
3333

34+
const params = {
35+
intensity: 1
36+
};
37+
3438
init();
3539

3640
async function init() {
@@ -93,10 +97,20 @@
9397
controls.maxPolarAngle = 0.9 * Math.PI / 2;
9498
controls.enableZoom = false;
9599

96-
// STATS
100+
// GUI
101+
102+
const gui = new GUI();
103+
104+
gui.add( params, 'intensity', 0, 1 ).name( 'Light Map Intensity' ).onChange( ( value ) => {
105+
106+
for ( const material of object.material ) {
107+
108+
material.lightMapIntensity = value;
109+
110+
}
97111

98-
stats = new Stats();
99-
container.appendChild( stats.dom );
112+
} );
113+
gui.open();
100114

101115
//
102116

@@ -118,7 +132,6 @@
118132
function animate() {
119133

120134
renderer.render( scene, camera );
121-
stats.update();
122135

123136
}
124137

src/materials/nodes/manager/NodeMaterialObserver.js

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const refreshUniforms = [
55
'anisotropyMap',
66
'anisotropyRotation',
77
'aoMap',
8+
'aoMapIntensity',
89
'attenuationColor',
910
'attenuationDistance',
1011
'bumpMap',
@@ -17,15 +18,18 @@ const refreshUniforms = [
1718
'dispersion',
1819
'displacementMap',
1920
'emissive',
21+
'emissiveIntensity',
2022
'emissiveMap',
2123
'envMap',
24+
'envMapIntensity',
2225
'gradientMap',
2326
'ior',
2427
'iridescence',
2528
'iridescenceIOR',
2629
'iridescenceMap',
2730
'iridescenceThicknessMap',
2831
'lightMap',
32+
'lightMapIntensity',
2933
'map',
3034
'matcap',
3135
'metalness',

0 commit comments

Comments
 (0)