Game Development Community

Trouble texturing TerrainFile terrain

by Jacob Gostylo · in Torque Game Engine · 08/20/2006 (1:09 am) · 1 replies

I am using the resource:
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7262
done by Derk Adams to generate a Terrain. I am going the 'load heightmap' way of doing it.

The short of this resource is that you create a TerrainFile, set its mHeightMap to the intensity of the color of each pixel in a loaded image and then mess with the alpha to blend the named textures to get the desired output.

The terrain gets saved and the height part of the terrain looks correct. My problem is that the textures are constantly coming out very distorted and they flicker. I am currently using the grass, sand, and patchy textures from the example. (The example looks fine when running from my exe)

My guess is that something is not getting set up in the TerrainFile correctly before it is saved. In my code (because it was in the resource code) I see that the array mBaseMaterialMap gets all its values set to 0. It is never accessed again. The type is U8 and I don't know what that is supposed to represent in mBaseMaterialMap. This could be part of the problem.

Can anyone tell me what is required to be set up in a TerrainFile object before it is saved so that its texturing information is correct? I have found little documentation or comments to help me on this one.

#1
08/21/2006 (10:16 am)
New bit of information. I moved my game to a machine that used Direct3D and the textures worked (after changing the options to D3D). Does anyone know of any bugs having to do with terrain texturing using OpenGL? Specifically I am running a Radeon 9700 Pro. The guy I am working with has the same texturing issue as me and he is using a Radeon card as well though it is a different model.

I still think it is odd because the FPS demo textures just fine on my machine and I am using the same textures that the FPS demo is using.

Edit: I just found out that the texturing is fine on my system when I switch to D3D. It has other rendering problems under that setting though. I guess this is an OpenGL/Radeon bug...? Does anyone know a way to get around this bug or know of a Torque fix for this bug? My video drivers are completely up to date and have been for a week so that should not be an issue.