I’m currently trying to create a custom Material / LightingModel using the NodeMaterial implementation (namely, MToon for three-vrm.)
I have bumped into an issue that, when I create MaterialReferenceNode in texture type, I cannot sample the referenced texture with irregular UVs (specifically, I want to sample the texture in MatCap UV.)
Do you have any idea to achieve this?
Yes, I’m already extending NodeMaterial and LightingModel and the material already uses the default uv for ordinary map textures like map or emissiveMap.
AND I need another uv for the matcap use. Looking at the codes you’ve mentioned,
I noticed that TextureNode has a node inlet .uvNode, and MaterialReferenceNode has a property .node which is an actual TextureNode under the hood.
If I change the .uvNode like this it samples using matcap uv.
Is this an intended way to use this?
Each Node can use builder.context differently, this helps to apply settings that cannot be passed at declaration time, creating a layer in which the Node can retrieve the ideal settings for that flow.