Unlimited Terrain Engine Using Heightmaps

Can u give zipped whole folder ?? I create my own end it doesn't work :frowning:

Hey



I have a question about the TerrainPassNode. It doesn't seem to scale properly.



This is my code:



passNode=new TerrainPassNode();

passNode.setRenderMode(TerrainPass.MODE_BEST);

passNode.attachChild(page);

passNode.setRenderState(buf);

passNode.setRenderState(cs);

passNode.setTileScale(90);

       

passNode.addDetail(basetex,null);

passNode.addDetail(detailtex0,alphatex0);

passNode.addDetail(detailtex1,alphatex1);

passNode.addDetail(detailtex2,alphatex2);

passNode.addDetail(detailtex3,alphatex3,250);



rootNode.attachChild(passNode);



sPass.setRenderShadows(true);

sPass.setLightingMethod(ShadowedRenderPass.LightingMethod.Additive);

sPass.add(passNode);

pManager.add(sPass);







This is the outcome:



Shader:

uniform sampler2D tex0,tex1,tex2,tex3,tex4,tex5,tex6,tex7,tex8;

void main(){

    vec2 tca = gl_TexCoord[0].xy;



  vec4 r = texture2D(tex0,tca * 90.0);

  r = mix(r,texture2D(tex1,tca * 90.0),texture2D(tex2,tca).a);

  r = mix(r,texture2D(tex3,tca * 90.0),texture2D(tex4,tca).a);

  r = mix(r,texture2D(tex5,tca * 90.0),texture2D(tex6,tca).a);

  gl_FragColor = mix(r,texture2D(tex7,tca * 90.0),texture2D(tex8,tca).a);

}





What am i doing wrong?

I answer myself



This seems to fix it:



public class SplatEnv {



    public void addLayer(Layer t){

        layers.add(t);

        if (t instanceof AlphaDetailLayer){

            float ls=((AlphaDetailLayer)t).tileScale;

            if(ls>1)

            ((AlphaDetailLayer)t).setScale(ls);

        else 

            ((AlphaDetailLayer)t).setScale(state.tile_scale);



        }else if (t instanceof BaseLayer){

            ((BaseLayer)t).setScale(state.tile_scale);

        }

        refresh();

    }

Trussell said:

This system is designed to hold a bunch of little heightmaps.. If you cut your big heightmap up into a bunch of smaller ones this would be what you're looking for. Loading one huge heightmap usually causes memory problems and sloooowwwwws down your game.


I see its been a few months since you have added to this thread, and in light of you wanting to add LOD, Im left to wonder how close you are on this, or if maybe you have given up on this in lieu of letting mapspinner's streaming take the lead ? (as they seem to do the same things anyway , as much as my meager jME knowledge goes )

thx
nl

I'm in University and, as such, haven't had time to do any work on extra projects. I don't plan to implement LOD any time soon but the code is there for you if you wish to attempt it.

Trussell said:

I'm in University and, as such, haven't had time to do any work on extra projects. I don't plan to implement LOD any time soon but the code is there for you if you wish to attempt it.


Okay thx mucho for reply.

cheers
nl