Is that dashed line already drawn with a shader? If so I’d just offset the position along the line (used to determine if the dash is rendered or not) by time. I did flowing water like that (but it was offsettitng the texture coordinates)
Are you able to show how you create the curved line currently?
No the dashed line I edited in GIMP for representation for this forum topic.
This is my code:
private Geometry drawLine2(Vector3f startPoint, Vector3f endPoint, float curveLength) {
Vector3f[] controlPoints = new Vector3f[4];
controlPoints[0] = startPoint;
controlPoints[1] = startPoint.add(curveLength, 0, 0);
controlPoints[2] = endPoint.subtract(curveLength, 0, 0);
controlPoints[3] = endPoint;
Spline spline = new Spline(Spline.SplineType.Bezier, controlPoints, 20, false);
Curve curve = new Curve(spline, 40);
Geometry lineGeom = new Geometry("line", curve);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); // create a simple material
mat.setColor("Color", ColorRGBA.Yellow); // set color of material to blue
lineGeom.setMaterial(mat);
lineGeom.getMaterial().getAdditionalRenderState().setLineWidth(1);
return lineGeom;
}
The example I use when wanting to know how to set things on a Mesh is Quad.java.
It’s not the most efficient way to set texture coordinates on a mesh if you are going to do it a lot… but it works fine and is simple to cut/paste that section of code. Especially if you already know you will have a fixed number of coordinates.
Edit: though if you find a material to do it then you only have to set the texture coordinates once and copying that code from Quad.java is the easiest way.
Thanks for all references and help by all.
I finally got a solution and just had to add the TextureCoords to the Curve mesh.
Using a material with a dashed texture and an animated UV movement to get the effect.
And here is an image of a more complex setup. Here you can see why I wanted to implement it.
The view now gives a beter and clear view of flow in the brain.