-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
NodeMaterial - r8 #17265
NodeMaterial - r8 #17265
Conversation
I add a https://rawgit.com/sunag/three.js/dev-r8/examples/webgl_materials_nodes.html?e=sss&m=bunny https://rawgit.com/sunag/three.js/dev-r8/examples/webgl_materials_nodes.html?e=translucent&m=bunny |
@bhouston about subsurface model, this technique did not need a pre-generate map |
@sunag, there is a subsurface model being standardized via the glTF committee. It is either going to be based on the Enterprise PBR model here: with these parameters:
Or the Autodesk Standard Surface model here: https://autodesk.github.io/standard-surface/#closures/diffusetransmission There are two types of subsurface transmission, thin_walled and true subsurface scattering. They usually are both supported. |
@sunag I'm interested in helping move this PR forward. Would you like me to fix these merge conflicts? Are there other changes you want to make? |
@robertlong thank you in anticipation and I apologize to all for the delay with this PR. The fact is that I am not a believer in the approach that I used here for adopt or move forward the NodeMaterial for the core. I create a GLSLParse made NodeMaterial more flexible, in fact is possible to reuse part of the native code only getting the function of ShaderLib as Node, but the concept of create all other material in NodeMaterial is much verbose and hard to maintain. I see today GLSLParse as a Today I am developing a different approach to use in WebGPU ( #20254 (comment) ) that must follow this principle ( #18162 (comment) ) only cleanly without hacks. For this reason, I think about reusing part of this code in WebGPU version and close this PR for now. Suggestions? |
Considering how long it takes to make changes to My opinion still stands that it is more promising to start with a basic node material system in context of @sunag Since you are deep into node based materials I have an important request at you 😇 . I would be great if you start with small PRs instead of providing a single big PR that introduces As suggested here (#20254 (comment)) I would start with a simplified version of |
I guess that's fine. I was hoping to see node based materials land in core for WebGL/WebGL2 seeing as support for those are widespread already and will be for the foreseeable future. I get that it would be easier to integrate into a new renderer though. |
I am starting a new version of For this reason I am closing this PR. |
New features
GLSLParser
Auto resolve Three.JS and JavaScript primitives
Use
string
,number
orthree.js
primitives
directly in nodes argumentsGLSLParser
nodes
:keywords
analysis follows the correct hierarchy.Auto grouping OperatorNode
Use
AddNode
,SubNode
,MulNode
andDivNode
with more of two arguments.New approach for SwitchNode
New NodeMaterial Flow Context
With the new
NodeContext
inNodeMaterial
could get in your flow ofTextures
using customsamplers
in tree of nodes with caching of textures. For example, previouslyBumpMapNode
just work from of aTextureNode
input, now it is possible use tree inflow of texture making the system more flexible if used withtexture uv
interaction, likeblur
andbump map
nodes for example:Issue - #17230
Code example
Other features
NodeFunction
Examples
Car-paint
https://raw.githack.com/sunag/three.js/dev-r8/examples/webgl_materials_nodes.html?e=car-paint
Refraction + Reflection
https://raw.githack.com/sunag/three.js/dev-r8/examples/webgl_materials_nodes.html?e=node-refract
Toon + outline
https://raw.githack.com/sunag/three.js/dev-r8/examples/webgl_materials_nodes.html?e=toon
Plush using sheen
https://raw.githack.com/sunag/three.js/dev-r8/examples/webgl_materials_nodes.html?e=plush
BumpMap with desaturate and switch channel
https://raw.githack.com/sunag/three.js/dev-r8/examples/webgl_materials_nodes.html?e=bump