Hey,
is it possible to use such animated textures with JME3? –Animated Procedural Textures–
In the case it works, do I have to bear in mind something special when using this kind of textures?
greetings
you mean just changing the uv coordintes ?
[java]public void transformUV(Mesh meshToLoad, Mesh whereToSave,Vector2f uvMoveOffset,float uvRotateAngle,Vector2f uvScaleAmount)
{
VertexBuffer loadUVBuffer = meshToLoad.getBuffer(Type.TexCoord);
float[] uvArray = BufferUtils.getFloatArray((FloatBuffer) loadUVBuffer.getData());
for (int i = 0; i < uvArray.length; i+=2)
{
float u = uvArray;
float v = uvArray;
//Translation by uvMoveOffset
u = u + uvMoveOffset.x;
v = v + uvMoveOffset.y;
//Rotation by uvRotateAngle
u = u * FastMath.cos(uvRotateAngle) - v * FastMath.sin(uvRotateAngle);
v = u * FastMath.sin(uvRotateAngle) + v * FastMath.cos(uvRotateAngle);
//Scale by uvScaleAmount
u = u * uvScaleAmount.x;
v = v * uvScaleAmount.y;
uvArray = u;
uvArray = v;
}
VertexBuffer saveUVBuffer = whereToSave.getBuffer(Type.TexCoord);
saveUVBuffer.updateData(BufferUtils.createFloatBuffer(uvArray));
}[/java]
I’m not sure if this has the same effect like the animated texture in the tutorial I posted. It is a prerendered animation of a procedural texture. In your example I’d use a mesh with a static texture. Or am I wrong? Would moving the uvMoveOffset on the z axis with a static texture still produce a cloudy/watery effect?