Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MeshBasicNodeMaterial: Add lightMap support. #28821

Merged
merged 3 commits into from
Jul 6, 2024
Merged

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Jul 5, 2024

Related issue: #28785

Description

This PR implements lightMap support to MeshBasicNodeMaterial.

MeshBasicNodeMaterial should not react on other source of irradiance like AmbientLight so it was necessary to add BasicLightMapNode to handle this exception.

Copy link

github-actions bot commented Jul 5, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
683.5 kB (169.2 kB) 683.5 kB (169.2 kB) +0 B

🌳 Bundle size after tree-shaking

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

Filesize dev Filesize PR Diff
460.6 kB (111.1 kB) 460.6 kB (111.1 kB) +0 B

@Mugen87 Mugen87 added this to the r167 milestone Jul 6, 2024

if ( builder.material.lightMap ) {

node = new IrradianceNode( materialLightMap );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we sould move this to StandardMeshNodeMaterial like setupEnvironment()?

Copy link
Collaborator Author

@Mugen87 Mugen87 Jul 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've asked this myself this as well but then I've realized when I do this setupLightMap() in NodeMaterial will be empty. The basic and standard materials share no common code in context of light maps like the setup of the environment map node in NodeMaterial.setupEnvironment(). Besides, we would have to implement setupLightMap() in phong, lambert and toon not just in MeshStandardNodeMaterial.

The light map handling in MeshBasicNodeMaterial is quite an exception and I thought it's more clear to completely overwrite the standard implementation from NodeMaterial .

That said, I'm not feeling strong about this issue. If you think it's more consistent to follow the approach of env maps, I'll create a setupLightMap() method for each material that supports light maps.

@sunag sunag merged commit bde222e into mrdoob:dev Jul 6, 2024
12 checks passed
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.

None yet

2 participants