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

NodeMaterial: Fix env map for lambert and phong. #28812

Merged
merged 1 commit into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/nodes/materials/MeshLambertNodeMaterial.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import NodeMaterial, { addNodeMaterial } from './NodeMaterial.js';
import BasicEnvironmentNode from '../lighting/BasicEnvironmentNode.js';
import PhongLightingModel from '../functions/PhongLightingModel.js';

import { MeshLambertMaterial } from '../../materials/MeshLambertMaterial.js';
Expand All @@ -21,6 +22,14 @@ class MeshLambertNodeMaterial extends NodeMaterial {

}

setupEnvironment( builder ) {

const envNode = super.setupEnvironment( builder );

return envNode ? new BasicEnvironmentNode( envNode ) : null;

}

setupLightingModel( /*builder*/ ) {

return new PhongLightingModel( false ); // ( specular ) -> force lambert
Expand Down
8 changes: 8 additions & 0 deletions src/nodes/materials/MeshPhongNodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import NodeMaterial, { addNodeMaterial } from './NodeMaterial.js';
import { shininess, specularColor } from '../core/PropertyNode.js';
import { materialShininess, materialSpecular } from '../accessors/MaterialNode.js';
import { float } from '../shadernode/ShaderNode.js';
import BasicEnvironmentNode from '../lighting/BasicEnvironmentNode.js';
import PhongLightingModel from '../functions/PhongLightingModel.js';

import { MeshPhongMaterial } from '../../materials/MeshPhongMaterial.js';
Expand All @@ -27,6 +28,13 @@ class MeshPhongNodeMaterial extends NodeMaterial {

}

setupEnvironment( builder ) {

const envNode = super.setupEnvironment( builder );

return envNode ? new BasicEnvironmentNode( envNode ) : null;

}
setupLightingModel( /*builder*/ ) {

return new PhongLightingModel();
Expand Down