AlphaMap in TerrainGrid problem

I’m setting alphamap in TerrainGridListener.tileAttached in similar way as TerrainGridAlphaMapTest but it uses just 1/4 of texture and selection of quater is random or maybe based on camera or something. I just tried TerrainGridAlphaMapTest and it looks like having same issue:

Textures are flipped in testdata and so it should be continous. As you can see just bottom left part of alphamap is mapped to top right quad.

Workedaround this by changing totalSize to quadSize in UpdateQuadCache terrainquad creation.

q = new TerrainQuad(getName() + “Quad” + temp, patchSize, quadSize, quadSize, heightMapAt == null ? null : heightMapAt.getHeightMap(), lodCalculatorFactory);

what is are the size parameters you initialize the grid with? Eg. for a grid of size 513 has tiles of size 257. You will always need an alphamap of the size of a tile. Your workaround works as long as your grid is 513. This part of the test is known to be broken. I’ll shrink the alphamaps to the required size as soon as I get the time for it.

I have 513 as total size in Grid constructor, tiles size is 257 and resizing alphamaps didn’t help. Having alphamap 257x257px, all it does is change in resolution (quality) of texture.

I’m not saing that the workaround is good, it’s workaround not fix. Fix would be using tilesize of tile to which the material was set, but I really dont know how to do this.

I’m glad you tried this out. Thanks. I really thought that it was only a matter of size, but I’ll take a look where it goes wrong. :slight_smile:

I sorted out the problem, now it should work with the latest svn commit. I have introduced a new boolean parameter to the TerrainLighting shader called “isTerrainGrid”. You can try it with the updated TerrainGridAlphaMapTest.

It’s awesome, but to be honest I’m too lazy to compile it :). I’ll try it tomorrow using latest nightbuild.

Marvelous, you fixed the bug I was going to report. Works great anthyon o/

I have a small problem with TerrainLighting.j3md which I don’t have with other Terrain Materials. The light creates strange markings on the ground. I also noticed the textures aren’t very “shiny” when exposed to light…

Is it normal ? How can I fix it ?

ah, that is a bit of a bug with the normals not taking into account the terrain’s scale. Are you scaling the terrain on the y-axis?

Not on the Y axis, but I scale it on X and Z.

Any news about this problem ? I’ve been recommended to scale the TerrainQuad on X,Y and Z equally… But it really bothers me to do so. I need to scale on X and Z, but not Y. If I did, it means I have to divide the heightmap by my scale, and multiply it everytime I do a getHeight. Do not want…

Also, any news about disabling LOD on TerrainGrid ?