VileMK3
12-11-2009 18:34:05
Hey everyone,
I've seen several threads about these, every time with a different solution, not of which seem to work in my case.
I'm trying to get the heightfield I generate with flour to match the actual terrain in the program. I'm using the standard terrain.png you get with Ogre, converted it to 8-bit .Raw in photoshop and than used the following in flour: flour convert in: terrain.raw, into: heightfield, out: terrain.xhf, width: 513, height: 513, depth: 8
I get a .xhf file and than use it in my application.
Using the VisualDebugger I see a very different terrain from the one rendered so at first I thought it could be rotated so I rotated it 90° several times to see if it would match any better but itonly got worse.
Anyone have any suggestions as to what could cause this?
Druha
12-11-2009 19:42:49
Tt is not simply rotated. Terrain get flipped acros top left - bottom right diagonal of image. May be that's why you're getting wrong results
VileMK3
12-11-2009 19:53:12
Any suggestions on how to flip it correctly, without having to flip the png in Photoshop before exporting it to raw.
Druha
12-11-2009 20:14:46
There was a topic where this problem was described, and as I remebmer - no way to flip it except in your favorite Image Editor
VileMK3
12-11-2009 22:26:57
I just tried it and doesn't seem to work. I flipped the picture horizontally, vertically, both, rotated it 180° (even though that's the same) none of them match.
This is basically my code and the .cfg:
m_SceneMgr->setWorldGeometry("terrain.cfg");
NxOgre::HeightField* hf= NxOgre::HeightFieldManager::getSingleton()->load("Nxs:terrain3.xhf");
NxOgre::HeightFieldGeometry* hfg = new NxOgre::HeightFieldGeometry(hf,NxOgre::Vec3(1500,100,1500));
hfg->setLocalPose(NxOgre::Matrix44(NxOgre::Vec3(0,50,0)));
m_Scene->createSceneGeometry(hfg);
# The main world texture (if you wish the terrain manager to create a material for you)
WorldTexture=terrain_texture.jpg
# The detail texture (if you wish the terrain manager to create a material for you)
DetailTexture=terrain_detail.jpg
#number of times the detail texture will tile in a terrain tile
DetailTile=3
# Heightmap source
PageSource=Heightmap
# Heightmap-source specific settings
Heightmap.image=terrain.png
# If you use RAW, fill in the below too
# RAW-specific setting - size (horizontal/vertical)
#Heightmap.raw.size=513
# RAW-specific setting - bytes per pixel (1 = 8bit, 2=16bit)
#Heightmap.raw.bpp=2
# How large is a page of tiles (in vertices)? Must be (2^n)+1
PageSize=513
# How large is each tile? Must be (2^n)+1 and be smaller than PageSize
TileSize=65
# The maximum error allowed when determining which LOD to use
MaxPixelError=3
# The size of a terrain page, in world units
PageWorldX=1500
PageWorldZ=1500
# Maximum height of the terrain
MaxHeight=100
# Upper LOD limit
MaxMipMapLevel=5
And it's not the fact that I'm using setLocalPose or not either since I tried commeting it.
deshan
13-11-2009 03:09:21
VileMK3
13-11-2009 07:29:13
Hmm, but that article implies that the problem is still fixable by rotating or flipping... Guess I need to keep trying and see if I find it after flipping and rotating in every possible way X_X
deshan
13-11-2009 09:03:22
I need to keep trying and see if I find it after flipping and rotating in every possible way X_X
if you have managed to do that please post the solution here
deshan
14-11-2009 07:47:24
ok i think the problem is solved.
I have just go through the topic what druha put above and succeeded. Seems that is the solution. Terrain physics really works good.
Following are the two oics
1. is for ogre terrain.png
2. is for making the xhf
In phtoshop
1. image - >rotate canvas - > 90ccw
2. image - >rotate canvas - > flip canvas vertical
Thank You druha