-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
NodeMaterial: Add setupOutgoingLight().
#28941
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
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
|
|
||
| this.fog = true; | ||
| this.lights = true; | ||
| this.lights = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably better to set lights to false by default since we should not assume all custom node materials implement proper lighting models.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I totally agree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should do this with fog too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do that in a separate PR though. The testing for such changes can take a bit time.
Related issue: -
Description
Lit materials like lambert, phong or standard should be black if no lights are in the scene and no emissive is defined. This is currently not true for node materials since
diffuseColor.rgbis defined as the default outgoing light.For reproduction: https://jsfiddle.net/5kat2bom/1/
This issue is solved by adding
setupOutgoingLight()which checks iflightsis set totrue. If so, the default outgoing light is black. Otherwise it isdiffuseColor.rgb. The code is not inlined but insetupOutgoingLight()soMeshBasicNodeMaterialcan overwrite the implementation.