I can build a material instance, give it to one or more geometry instances. I can change each of the geometries individually (setLocalTranslation (x, y, z)).
At the moment I can get any material-specific or texture-specific information in the “.frag” shader. If I were to give a copy of the material to every geometry, then I could give the respective material of a geometry the position of each geometry, but this is unattractive. I would want to stick with one instance of the material.
Can I and if so how, give geometry-specific information - like the LocalTranslation here - to the “.frag” shader?
I have several tiles with the same material. The tiles form my self-made map. Each part is of course shifted individually. Now I want to calculate a sphere that blends a mark / rune on the floor (better: over the texture of the floor) …
You already have access to the world position of the object so I’m just wondering why local position relative to the parent is needed. I don’t understand why whatever you are doing can’t be done in either model space or world space.
I don’t have time to look up the shader-specific syntax at the moment but in concept its:
World * vec3(0.0, 0.0, 0.0)
I know there are JME provided functions for getting the world transformation of a point. The world transform of 0, 0,0 is the world position of the object.
Looking for inPosition in the .vert will show you how the transform is done. It my be somethingWorldView(…) and if so then you’ll want somethingWorld(…) instead.
You don’t need inPositon in the .frag shader. inPosition is the position of the model vertext. You want the model position, ie: its own origin… which by definition is (0,0,0).
transformed into world space.
I think this will be a lot more obvious if you look at the shader source code. You must have some.