jMonkeyEngine / jMonkeyEngine/sdk
ShaderNodes: Connecting Attribute to TextureFetch
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 348
- Forks
- 104
- Avg merge
- 4d 13h
- Merged PRs (30d)
- 3
Description
So when I connect the Attribute to the Texture Fetch, I get the following:
Error On line 0 : texCoord = Attribute.inTexCoord
->Undeclared nodeAttribute. Make sure this node is declared before the current node
Four times.
I don't know if this is relevant, but it seems like the order I add them to Nodes Editor or the order I connect those nodes.
Actually when saving the file and loading it again, I get an error:
Caused by: com.jme3.material.plugins.MatParseException: Error On line 26 : texCoord = Attribute.inTexCoord
->Undeclared nodeAttribute. Make sure this node is declared before the current node
at com.jme3.material.plugins.ShaderNodeLoaderDelegate.readInputMapping(ShaderNodeLoaderDelegate.java:758)
at com.jme3.material.plugins.ShaderNodeLoaderDelegate.readShaderNode(ShaderNodeLoaderDelegate.java:287)
at com.jme3.material.plugins.ShaderNodeLoaderDelegate.readNodes(ShaderNodeLoaderDelegate.java:872)
at com.jme3.material.plugins.ShaderNodeLoaderDelegate.readFragmentShaderNodes(ShaderNodeLoaderDelegate.java:387)
at com.jme3.material.plugins.J3MLoader.readTechniqueStatement(J3MLoader.java:592)
at com.jme3.material.plugins.J3MLoader.readTechnique(J3MLoader.java:637)
at com.jme3.material.plugins.J3MLoader.loadFromRoot(J3MLoader.java:779)
at com.jme3.material.plugins.J3MLoader.load(J3MLoader.java:800)
at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:260)
... 55 more
Shader Node:
MaterialDef Simple {
MaterialParameters {
Color TeamColor
Texture2D Mask
}
Technique {
WorldParameters {
WorldViewProjectionMatrix
}
VertexShaderNodes {
ShaderNode CommonVert {
Definition : CommonVert : Common/MatDefs/ShaderNodes/Common/CommonVert.j3sn
InputMappings {
worldViewProjectionMatrix = WorldParam.WorldViewProjectionMatrix
modelPosition = Global.position.xyz
}
OutputMappings {
Global.position = projPosition
}
}
}
FragmentShaderNodes {
ShaderNode TextureFetch {
Definition : TextureFetch : Common/MatDefs/ShaderNodes/Basic/TextureFetch.j3sn
InputMappings {
texCoord = Attribute.inTexCoord
textureMap = MatParam.Mask
}
}
ShaderNode ColorMult {
Definition : ColorMult : Common/MatDefs/ShaderNodes/Basic/ColorMult.j3sn
InputMappings {
color1 = TextureFetch.outColor
color2 = MatParam.TeamColor
}
OutputMappings {
Global.color = outColor
}
}
}
}
}
Judging by https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-core/src/main/resources/Common/MatDefs/Misc/UnshadedNodes.j3md, Attributes are now prefixed Attr not Attribute
Not so easy, I tried to change it, but then I get
Caused by: com.jme3.material.plugins.MatParseException: Error On line 26 : texCoord = Attr.inTexCoord
->Cannot have an attribute as input in a fragment shaderinTexCoord
at com.jme3.material.plugins.ShaderNodeLoaderDelegate.readInputMapping(ShaderNodeLoaderDelegate.java:713)
at com.jme3.material.plugins.ShaderNodeLoaderDelegate.readShaderNode(ShaderNodeLoaderDelegate.java:287)
at com.jme3.material.plugins.ShaderNodeLoaderDelegate.readNodes(ShaderNodeLoaderDelegate.java:872)
at com.jme3.material.plugins.ShaderNodeLoaderDelegate.readFragmentShaderNodes(ShaderNodeLoaderDelegate.java:387)
I'll ahve to look at it tomorrow.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ShaderNodeLoaderDelegate.java at readInputMapping and compare the fragment-node mappings with Common/MatDefs/Misc/UnshadedNodes.j3md. Reproduce the Attribute-to-TextureFetch connection and save/reload path. Done means the valid shader-node mapping is accepted without undeclared-node or fragment-attribute errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100