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: Basic BSDFs of MeshStandardMaterial and NodeBuilder simplification #22398

Merged
merged 3 commits into from
Aug 24, 2021

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented Aug 24, 2021

  • Basic BSDFs MeshStandardMaterial -> roughnessNode, metalnessNode, normalNode
  • Simplification of NodeBuilder code generator and depedencies (biggest update of this PR)
  • NormalMap Support
  • 30+ math functions to MathNode
  • ColorSpaceNode all three.js encoding functions (automatic use in TextureNode)
  • Temporary variable system: TempNode
  • StructNode Support
  • New LightContext ( more generic )
  • ExpressionNode for inline code

WebGPU - Selective Lights
https://raw.githack.com/sunag/three.js/dev-nodematerial-igalia-1/examples/webgpu_lights_selective.html

image

// PhysicalLightingModel example
// ReflectedLight use the same standard native of threejs

const glslCode = 
`void ( inout ReflectedLight reflectedLight, vec3 lightDirection, vec3 lightColor ) {

	RE_Direct_Physical( reflectedLight, lightDirection, lightColor );

}`

const physicalLightingModel = new FunctionNode(  glslCode   ).setIncludes( [ RE_Direct_Physical ] );

@sunag
Copy link
Collaborator Author

sunag commented Aug 24, 2021

Sorry the big code!! The nexts PR will be smaller packages.

One question, I can remove Phong Material support to WebGPU in order to simplify?
This can be added by the user using Custom lighting model.

@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 24, 2021

One question, I can remove Phong Material support to WebGPU in order to simplify?

I would say yes.

@mrdoob mrdoob added this to the r132 milestone Aug 24, 2021
@mrdoob
Copy link
Owner

mrdoob commented Aug 24, 2021

Yay!

@mrdoob
Copy link
Owner

mrdoob commented Aug 24, 2021

Hmm, I think there is something wrong with the normal map code though:

Screen.Recording.2021-08-24.at.11.14.13.AM.mov

@sunag
Copy link
Collaborator Author

sunag commented Aug 24, 2021

Hmm, I think there is something wrong with the normal map code though:

Well noticied, fixed :)

image

@@ -36,9 +36,11 @@ class ContextNode extends Node {

generate( builder, output ) {

const type = this.getType( builder );
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems type is not used in this method.

const type = this.getType( builder );
const inputs = this.inputs;

const shaderStage = builder.getShaderStage();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Another unused variable.

const propertyName = builder.getPropertyName( nodeVary );

// force nodeVary.snippet work in vertex stage
const flowData = builder.flowNodeFromShaderStage( NodeShaderStage.Vertex, this.value, type, propertyName );
Copy link
Collaborator

Choose a reason for hiding this comment

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

And here, too.

@mrdoob
Copy link
Owner

mrdoob commented Aug 24, 2021

Merging this. I think we can leave the unused vars clean up for another PR.

@mrdoob mrdoob merged commit 8f04662 into mrdoob:dev Aug 24, 2021
@mrdoob
Copy link
Owner

mrdoob commented Aug 24, 2021

Thanks! Welcome back! 🤗

@sunag
Copy link
Collaborator Author

sunag commented Aug 24, 2021

@mrdoob Thank you again!!! I am very happy to have returned. 🎉

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.

3 participants