Atlas blended terrain problem.
by Tobias Niva · in Torque Game Engine Advanced · 10/17/2007 (8:23 am) · 11 replies
Hi.
Trying to get atlas blended terrain to work in 1.0.3 since it's supposed to able to lightmap (recieve shadows from the in-game sun).
I try to change the sun direction in the water_demo mission, and that blended terrain seems to "react" fine - so the build (d/l 1.0.3 from here) works fine and the example terrain looks great, and blends nicely between the LOD's of the terrain and textures.
But something is wrong with my own generated map - niva3d.com/temp/atlas_problem.jpg
I use a modified build-script (niva3d.com/temp/atlasbuild.cs) I found somewhere around here and my log says everything is fine - except for the "may have paging issues", that people around here says it's not to much to worry about (even though it sounds quite what the problem I am having?!).
I fiddled with the parameters in the script...but I can't get the damn textures to work, they"pop" in badly as I fly over the terrain...one see the seams between the different LOD (I assume) too obvious (se pic again).
I double checked everything and can't seem to figure this one out...some parameters from the build-script:
terrainSize = 1024;
terrainLevels = 4;
terrainMetersPerPixel = 1;
terrainScale = 0.002777;
virtualMapSize = 512 * 512;
One thing that I'm a little bit uncertain of (since I'm no coder) is the parameter of a lightmap (see script file).
Since I didn't lightmap my terrain, but build it from some tiles and a "mask" (RGBA png-file) I use a blank *.jpg (1024x1024 px) as lightmap sent to the script - but still I don't think this is the problem.
And further more I can't get the terrain NOT to have a detail texture - even though I remove it from the *.mis file AND remove it from the material.cs file in the terrain folder...
Anyone that know of a great "troubleshooter" on Atlas2? Searched my ass of, but always end up at TDN...which doesn't really help me out here.
Thanx in advance
Toby
Trying to get atlas blended terrain to work in 1.0.3 since it's supposed to able to lightmap (recieve shadows from the in-game sun).
I try to change the sun direction in the water_demo mission, and that blended terrain seems to "react" fine - so the build (d/l 1.0.3 from here) works fine and the example terrain looks great, and blends nicely between the LOD's of the terrain and textures.
But something is wrong with my own generated map - niva3d.com/temp/atlas_problem.jpg
I use a modified build-script (niva3d.com/temp/atlasbuild.cs) I found somewhere around here and my log says everything is fine - except for the "may have paging issues", that people around here says it's not to much to worry about (even though it sounds quite what the problem I am having?!).
I fiddled with the parameters in the script...but I can't get the damn textures to work, they"pop" in badly as I fly over the terrain...one see the seams between the different LOD (I assume) too obvious (se pic again).
I double checked everything and can't seem to figure this one out...some parameters from the build-script:
terrainSize = 1024;
terrainLevels = 4;
terrainMetersPerPixel = 1;
terrainScale = 0.002777;
virtualMapSize = 512 * 512;
One thing that I'm a little bit uncertain of (since I'm no coder) is the parameter of a lightmap (see script file).
Since I didn't lightmap my terrain, but build it from some tiles and a "mask" (RGBA png-file) I use a blank *.jpg (1024x1024 px) as lightmap sent to the script - but still I don't think this is the problem.
And further more I can't get the terrain NOT to have a detail texture - even though I remove it from the *.mis file AND remove it from the material.cs file in the terrain folder...
Anyone that know of a great "troubleshooter" on Atlas2? Searched my ass of, but always end up at TDN...which doesn't really help me out here.
Thanx in advance
Toby
About the author
Graphics Artist @ www.gimbalgames.se
#2
If you want it to vanish, you could simply modify the shader to scale it to 0.0
Can't you help much further, we concentrate on legacy as we have many buildings and the like we need to place which is a not that trivial problem with Atlas2 at the moment.
10/18/2007 (10:44 am)
The atlas detail texture is not set in the mis. It is hardcoded in the C++ source code.If you want it to vanish, you could simply modify the shader to scale it to 0.0
Can't you help much further, we concentrate on legacy as we have many buildings and the like we need to place which is a not that trivial problem with Atlas2 at the moment.
#3
height map :1025 X 1025(one greater than the actual one)
opacity map :same
light map :same
now parameters:
size :1024
resolution:4 (that is 4k X 4k)
error metric:1
tree depth:4
height scale:300/2^16(this depends on how high ur mountains are)
virtual size:32768
hopefully this will work.
shaon
10/18/2007 (12:17 pm)
Here is the settings which gives best results for me.height map :1025 X 1025(one greater than the actual one)
opacity map :same
light map :same
now parameters:
size :1024
resolution:4 (that is 4k X 4k)
error metric:1
tree depth:4
height scale:300/2^16(this depends on how high ur mountains are)
virtual size:32768
hopefully this will work.
shaon
#4
I can get things to work if I generate my opacity map and light map with "atlasGenerateTextureTOCFromLargeJPEG" and set it to split up the image according to the TREE DEPTH generated from the *.raw.
This on the other hand puts me with another problem - the opacity map SHOULD be *.png to get to use the 4th channel (alpha) for the 4th texture.
So my problem now is that I can't seem to "get atlasGenerateTextureTOCFromTiles" to use my "non-tiled" opacity and light map...
Do I HAVE to tile/split up these images "by hand" (Photoshop) to be able to use "...FromTiles" correctly?!?!
10/18/2007 (3:58 pm)
Another hmm...I can get things to work if I generate my opacity map and light map with "atlasGenerateTextureTOCFromLargeJPEG" and set it to split up the image according to the TREE DEPTH generated from the *.raw.
This on the other hand puts me with another problem - the opacity map SHOULD be *.png to get to use the 4th channel (alpha) for the 4th texture.
So my problem now is that I can't seem to "get atlasGenerateTextureTOCFromTiles" to use my "non-tiled" opacity and light map...
Do I HAVE to tile/split up these images "by hand" (Photoshop) to be able to use "...FromTiles" correctly?!?!
#5
10/20/2007 (12:31 am)
I did not use any tiles .you can use a single image by setting the num of tiles to 1.
#6
Ok...that's what I can't get to work. When I use "atlasGenerateTextureTOCFromTiles" and set the first param. to "1" - I get problems with the fading between texture-levels...since it seems not to get the "base-level" at all (level0).
Is there any "condition" between the different maps that has to be "fulfilled", to get it to work?!
Now I use;
terrainLevels = 4;
atlasGenerateTextureTOCFromTiles(1,"opacity.png","opacity.atlas",1);
atlasGenerateTextureTOCFromLargeJPEG("lightmap.jpg",4,"lightmap.atlas");
The *.png and *.jpg in this case both are 1024x1024 px - as the terrainSize is set to...
The lightmap (since tree depth 4 - corresponding to the tree depth for the geometry) fades fine and have "all levels")...but the weird opacity map makes the textures disappear when zoomed out/away from the terrain. Would want a similar "function" for that one, to "cut it up" in same levels as geom. and lightmap...
Tips?
/Toby
PS. Are you using TGEA 1.0.3 and the new ability to lightmap from within the engine/editor...or could this be the difference...that this "new feature" isn't really stable?!
10/22/2007 (9:42 am)
@Mahmudul:Ok...that's what I can't get to work. When I use "atlasGenerateTextureTOCFromTiles" and set the first param. to "1" - I get problems with the fading between texture-levels...since it seems not to get the "base-level" at all (level0).
Is there any "condition" between the different maps that has to be "fulfilled", to get it to work?!
Now I use;
terrainLevels = 4;
atlasGenerateTextureTOCFromTiles(1,"opacity.png","opacity.atlas",1);
atlasGenerateTextureTOCFromLargeJPEG("lightmap.jpg",4,"lightmap.atlas");
The *.png and *.jpg in this case both are 1024x1024 px - as the terrainSize is set to...
The lightmap (since tree depth 4 - corresponding to the tree depth for the geometry) fades fine and have "all levels")...but the weird opacity map makes the textures disappear when zoomed out/away from the terrain. Would want a similar "function" for that one, to "cut it up" in same levels as geom. and lightmap...
Tips?
/Toby
PS. Are you using TGEA 1.0.3 and the new ability to lightmap from within the engine/editor...or could this be the difference...that this "new feature" isn't really stable?!
#8
niva3d.com/temp/closeup.jpg
A closeup...
niva3d.com/temp/zoomedout.jpg
...and one zoomed out, whereas the "lack of textures" outside the closest "texture level" disappears (and "tile4.jpg" fills everything).
And here's one where I replaced the single opacity map (loaded with "...FromTiles(1,...") to the same stuff split up in 4 tiles, and loaded with "...FromTiles(2,...".
niva3d.com/temp/opac_tiled.jpg
Any ideas?!
Sure - I could do the "hand labour" of always splitting up my (planned to be hand drawn) opacity map - but this thing really annoys me... :(
/Toby
10/22/2007 (11:08 am)
Two first pics uses settings in post just above;niva3d.com/temp/closeup.jpg
A closeup...
niva3d.com/temp/zoomedout.jpg
...and one zoomed out, whereas the "lack of textures" outside the closest "texture level" disappears (and "tile4.jpg" fills everything).
And here's one where I replaced the single opacity map (loaded with "...FromTiles(1,...") to the same stuff split up in 4 tiles, and loaded with "...FromTiles(2,...".
niva3d.com/temp/opac_tiled.jpg
Any ideas?!
Sure - I could do the "hand labour" of always splitting up my (planned to be hand drawn) opacity map - but this thing really annoys me... :(
/Toby
#9
niva3d.com/temp/closeup.jpg
A closeup...
niva3d.com/temp/zoomedout.jpg
...and one zoomed out, whereas the "lack of textures" outside the closest "texture level" disappears (and "tile4.jpg" fills everything).
And here's one where I replaced the single opacity map (loaded with "...FromTiles(1,...") to the same stuff split up in 4 tiles, and loaded with "...FromTiles(2,...".
niva3d.com/temp/opac_tiled.jpg
Any ideas?!
Sure - I could do the "hand labour" of always splitting up my (planned to be hand drawn) opacity map - but this thing really annoys me... :(
/Toby
10/22/2007 (11:25 am)
Two first pics uses settings in post just above;niva3d.com/temp/closeup.jpg
A closeup...
niva3d.com/temp/zoomedout.jpg
...and one zoomed out, whereas the "lack of textures" outside the closest "texture level" disappears (and "tile4.jpg" fills everything).
And here's one where I replaced the single opacity map (loaded with "...FromTiles(1,...") to the same stuff split up in 4 tiles, and loaded with "...FromTiles(2,...".
niva3d.com/temp/opac_tiled.jpg
Any ideas?!
Sure - I could do the "hand labour" of always splitting up my (planned to be hand drawn) opacity map - but this thing really annoys me... :(
/Toby
#10
here are some snap shots:

10/22/2007 (11:27 am)
Opps similar prob with me when I see the terrain from a large distance.but close up seems okay.here are some snap shots:

#11
I guess I'll have to split up the opacity map into at least 4 maps then...since I plan to let the player see quite vast distances.
Thanx for your time though!
Nice hills BTW! :-)
/T
10/22/2007 (11:30 am)
Hmm. Ok.I guess I'll have to split up the opacity map into at least 4 maps then...since I plan to let the player see quite vast distances.
Thanx for your time though!
Nice hills BTW! :-)
/T
Tobias Niva
Maybe I'm slow (no coder - that's for sure)...but anyhow I kind of figured out something I think;
In the "topmost" layer/chunk, the opacity-map (*.png file for mask) seemes to get wrong size/"UV-coords", so the chunk is only masked with approx. a quarter of the mask...
Will continue troubleshooting...but would really appreciate any tips or guidance.
/T