Skip to content

Commit 37f8fae

Browse files
authored
WebGPURenderer: Introduce ProjectorLight (#1645)
* WebGPURenderer: Introduce ProjectorLight * Update three.js * Add examples * Update * Update patch and delete examples * Add src * Update patch and delete src
1 parent 8474603 commit 37f8fae

File tree

11 files changed

+187
-179
lines changed

11 files changed

+187
-179
lines changed

examples-testing/changes.patch

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9226,7 +9226,7 @@ index 5adfc8e6..6f3772f0 100644
92269226
// generate a random color and update texture data
92279227

92289228
diff --git a/examples-testing/examples/webgl_materials_texture_rotation.ts b/examples-testing/examples/webgl_materials_texture_rotation.ts
9229-
index 90b9416d..e6034b82 100644
9229+
index eedc80c6..e5c7131f 100644
92309230
--- a/examples-testing/examples/webgl_materials_texture_rotation.ts
92319231
+++ b/examples-testing/examples/webgl_materials_texture_rotation.ts
92329232
@@ -3,7 +3,10 @@ import * as THREE from 'three';
@@ -15126,14 +15126,12 @@ index c3d50629..3b56b5a6 100644
1512615126
material.colorNode = color(hexColor);
1512715127
material.lights = false;
1512815128
diff --git a/examples-testing/examples/webgpu_lights_spotlight.ts b/examples-testing/examples/webgpu_lights_spotlight.ts
15129-
index 83860e63..557ec97b 100644
15129+
index b9388d9b..dbd27d70 100644
1513015130
--- a/examples-testing/examples/webgpu_lights_spotlight.ts
1513115131
+++ b/examples-testing/examples/webgpu_lights_spotlight.ts
15132-
@@ -1,14 +1,14 @@
15132+
@@ -1,13 +1,13 @@
1513315133
-import * as THREE from 'three';
15134-
-import { Fn, vec2, length, uniform, abs, max, min, sub, div, saturate, acos } from 'three/tsl';
1513515134
+import * as THREE from 'three/webgpu';
15136-
+import { Fn, vec2, length, uniform, abs, max, min, sub, div, saturate, acos, ShaderNodeObject } from 'three/tsl';
1513715135

1513815136
import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
1513915137

@@ -15148,7 +15146,7 @@ index 83860e63..557ec97b 100644
1514815146

1514915147
init();
1515015148

15151-
@@ -46,7 +46,7 @@ function init() {
15149+
@@ -45,7 +45,7 @@ function init() {
1515215150
const loader = new THREE.TextureLoader().setPath('textures/');
1515315151
const filenames = ['disturb.jpg', 'colors.png', 'uv_grid_opengl.jpg'];
1515415152

@@ -15157,21 +15155,7 @@ index 83860e63..557ec97b 100644
1515715155

1515815156
for (let i = 0; i < filenames.length; i++) {
1515915157
const filename = filenames[i];
15160-
@@ -65,10 +65,10 @@ function init() {
15161-
const ambient = new THREE.HemisphereLight(0xffffff, 0x8d8d8d, 0.15);
15162-
scene.add(ambient);
15163-
15164-
- const boxAttenuationFn = Fn(([lightNode], builder) => {
15165-
- const light = lightNode.light;
15166-
+ const boxAttenuationFn = Fn<[ShaderNodeObject<THREE.SpotLightNode>]>(([lightNode], builder) => {
15167-
+ const light = lightNode.light!;
15168-
15169-
- const sdBox = Fn(([p, b]) => {
15170-
+ const sdBox = Fn<[ShaderNodeObject<THREE.Node>, ShaderNodeObject<THREE.Node>]>(([p, b]) => {
15171-
const d = vec2(abs(p).sub(b)).toVar();
15172-
15173-
return length(max(d, 0.0)).add(min(max(d.x, d.y), 0.0));
15174-
@@ -189,8 +189,8 @@ function init() {
15158+
@@ -166,8 +166,8 @@ function init() {
1517515159
renderer.shadowMap.enabled = val;
1517615160

1517715161
scene.traverse(function (child) {

examples-testing/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const exceptionList = [
5959
'webgpu_instance_sprites',
6060
'webgpu_instance_uniform',
6161
'webgpu_lights_custom',
62+
'webgpu_lights_projector',
6263
'webgpu_lines_fat_wireframe',
6364
'webgpu_materials',
6465
'webgpu_mrt_mask',

0 commit comments

Comments
 (0)