Skip to content

WebGLRenderer: Added map support to RectAreaLight.#32496

Draft
mrdoob wants to merge 5 commits into
devfrom
rectarealight-map
Draft

WebGLRenderer: Added map support to RectAreaLight.#32496
mrdoob wants to merge 5 commits into
devfrom
rectarealight-map

Conversation

@mrdoob

@mrdoob mrdoob commented Dec 6, 2025

Copy link
Copy Markdown
Owner

Related issue: #9234

Description

  • Adds map property to RectAreaLight for texturing the light surface
  • Implements LTC-based texture sampling for both specular and diffuse lighting
  • Updates RectAreaLightHelper to display the light's texture

There are still a couple of bugs that I need to address.

Screen.Recording.2025-12-06.at.20.26.46_.mov

For testing:
https://raw.githack.com/mrdoob/three.js/rectarealight-map/examples/webgl_lights_rectarealight_map.html

@github-actions

github-actions Bot commented Dec 6, 2025

Copy link
Copy Markdown

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 355.12
84.44
362.7
85.9
+7.58 kB
+1.46 kB
WebGPU 616.43
171.09
616.43
171.09
+0 B
+0 B
WebGPU Nodes 615.03
170.83
615.03
170.83
+0 B
+0 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 487.46
119.37
495.04
120.84
+7.58 kB
+1.48 kB
WebGPU 687.34
186.69
687.44
186.7
+98 B
+12 B
WebGPU Nodes 637.18
173.9
637.28
173.91
+98 B
+11 B

@WestLangley

Copy link
Copy Markdown
Collaborator

Very nice!

  1. For a very-informative, temporary, test case, replace the car with a plane.
// scene.add( carModel );

const geometry = new THREE.PlaneGeometry( 10, 10, 10 );
const mesh = new THREE.Mesh( geometry, bodyMaterial );
bodyMaterial.color.setHex( 0xffffff );
mesh.position.y = 5;
scene.add( mesh );
  1. Also, the video is currently static in MacOS Safari, and that makes for an even better test case.

@mrdoob

mrdoob commented Dec 6, 2025

Copy link
Copy Markdown
Owner Author
  1. For a very-informative, temporary, test case, replace the car with a plane.
// scene.add( carModel );

const geometry = new THREE.PlaneGeometry( 10, 10, 10 );
const mesh = new THREE.Mesh( geometry, bodyMaterial );
bodyMaterial.color.setHex( 0xffffff );
mesh.position.y = 5;
scene.add( mesh );

Oh! So much noise. I guess that's the hash blur...

Screenshot 2025-12-07 at 08 40 01
  1. Also, the video is currently static in MacOS Safari, and that makes for an even better test case.

Damn it Safari!

@mrdoob

mrdoob commented Dec 7, 2025

Copy link
Copy Markdown
Owner Author

Ops!

Looks like I committed webgpu_postprocessing_ssgi.html‎ by mistake... but without the RapierPhysics.js fixes it won't work.

Well, in case anyone tried to see the example... this is how it's supposed to look like:

Screen.Recording.2025-12-07.at.20.37.33.mov

@Mugen87

Mugen87 commented Dec 7, 2025

Copy link
Copy Markdown
Collaborator

Instead of updating webgpu_postprocessing_ssgi, would it be possible to create a new physics demo instead (e.g. physics_rapier_ssgi)?

For further development, it's important to have a static SSGI scene with no dynamic elements so it's easier to compare and validate changes in SSGINode.

@mrdoob

mrdoob commented Dec 8, 2025

Copy link
Copy Markdown
Owner Author

Wasn't planning on committing that ssgi physics test.

I could create a new example but I'm not happy with it yet.

@mrdoob mrdoob force-pushed the rectarealight-map branch from 5415d53 to 6caa5b6 Compare December 9, 2025 17:34
@aaaidan

aaaidan commented Jan 7, 2026

Copy link
Copy Markdown

This is an extremely exciting and useful feature. A texture will massively expand the use cases for the area light. I’m going to check out this branch to check in on progress, but please let me know if there’s anything specific we spectators can do to help (e.g. any kind of testing, api opinions, etc)

good luck 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants