I have been trying to render height maps to a texture using a frame buffer object. This works...although the performance is simply awful (3 fps). I think the problem rests in the fact the that the quad is still attached to the viewport after the terrain is rendered yet calling viewPort.detach(quad) results in the following, distorted image:
Here is the code I use to create the frame buffer, attach it to a viewport, and render the height map to a texture. The shader is running improved, texture-based, perlin noise.
Texture2D hm = new Texture2D(1024,1024,Format.RGBA32F); Quad quad = new Quad(2,2); mat = new Material(assetManager, "NoiseProgram.j3md"); geom = new Geometry("Quad",quad); geom.setMaterial(mat); mat.setTexture("permSampler2d", permutationTexture()); mat.setTexture("permGradSampler", gradientTexture()); FrameBuffer fbo = new FrameBuffer(1024,1024,1); fbo.setColorTexture(hm); vp.setOutputFrameBuffer(fbo); vp.attachScene(ge);
I may have not done a great job explaining the problem. Thanks for any help.