Game Development Community

Atlas: Texture Generator

by Ben Garney · in Torque Game Engine Advanced · 06/05/2005 (5:56 pm) · 44 replies

Howdy guys,

John Vanderbeck and I have been working hard on a texture generator for all you Atlas users out there. We have a first cut of it ready to go. It will generate super high res textures, do lighting, can be run offline or from scripts, and so on.

It's available at...

Code - www.ontargetgames.com/atlas/atlasTextureGen.zip
Docs - www.ontargetgames.com/atlas/AtlasTexGen.html

You will be prompted for a login. Username is tse, password is ggatlas117.

To get going, simply take the files from the .zip into your engine/atlas subdirectory, add them to your project (VC7 lets you just drag and drop :), recompile, and then follow the docs to get started.

John and I will be checking up on this thread, as well as hanging out in the IRC channel, so feel free to post or chat and we'll be there help you out.

Once we get the kinks out of this version, then I'll be checking it into CVS and updating all the project files.

Have fun! :)
#21
06/07/2005 (8:33 pm)
Well, it works but im still very bad at it. Need alot of practice.
#22
06/07/2005 (8:43 pm)
Dont' feel bad.

I wrote most of it and I can't even use it to make anything decent.
#23
06/11/2005 (9:52 pm)
I noticed something wierd. I am not sure if you fixed this, but the texture comes out mirrored and rotated 90 deg CCW.

After rotating it back and flipping in left to right. i found the terrain look much better.



If anyone is interested, I wrote a small tool to assmemble the chunks created by the texture generator into a large jpg file fit for proccessing. It faster to use than an image editor.

home.ripway.com/2005-2/263802/TSS/ChunkAsm.zip

to use it just type in the console ChunkAsm with the parameter you passed to writeOutput.
#24
06/12/2005 (10:53 am)
For some reason i'm getting negative height values. Like when i apply my texture layer by height, i have to start with a negative number and not with 0, otherwise parts of it don't get textured. I didn't notice any mention of this in the doc's though. Is this normal?
#25
06/12/2005 (12:51 pm)
Perfectly normal; the input integer heights go from about -32767 to 32767. Multiply by your scale factor and go.
#26
06/12/2005 (2:40 pm)
I find it rather confusing to translate between what you see in Terragen and what the engine sees. Its confusing and nothing seems to match up lol.

However I did add a feature to make it easier to understand. If you look at the output in the console fgrom when you loaded the heightmap you will see it indicates what the height ranges are for the heightmap.
#27
06/13/2005 (5:22 am)
John... you added this feature to see the height ranges??? If so can you post what you did so others can see it. I would love to know what Torque thinks my actual hieght range is.
#28
06/13/2005 (8:38 am)
Its already in there. Just look at the console output after your call to loadHeightmapU16()
#29
06/13/2005 (11:16 am)
Where is that called at? Is it in the main script. I havent really played with the new texture generator but i saw this feature and wondered what i would have to do to see this info.
#30
06/13/2005 (12:28 pm)
The zip comes with an example script and installation instructions. Drop it in, recompile, and go. Pretty soon I'm going to be checking this all into CVS. (Mostly an issue of free time - too much other cool stuff happening!)
#31
06/17/2005 (3:16 pm)
I was just looking at this code. and in the resetLayer function I noticed this line
dMemset(mLayers[layer].opacityMap, 0, mHeightField->realSize());

shouldn't this be
dMemset(mLayers[layer].opacityMap, 0, mHeightField->realSize() * mHeightField->realSize());

i thought the realSize gave the dinension of the heightfield square?

and also i noticed that there is a memory leak. addlayer alloc's the texture and opacity objects, but they are never deleted.
#32
06/17/2005 (7:07 pm)
Good catch on the resetLayer. I'll fix that right away. As for the texture/opacity objects -- they should be delted in the onRemove() method of the actual console object. But i'll double check on that.

Thanks for the bug report!
#33
06/17/2005 (10:34 pm)
*cough* seems I found another one in addLayer.
delete image;

layer.textureWidth = image->getWidth();
layer.textureHeight = image->getHeight();

I am writing in a new feature. that's how i am discovering all of these. I am not trying to pick apart your code! :)
#34
06/18/2005 (1:35 am)
Page suspended by host!!!!

:-(

Bummer.
#35
06/18/2005 (3:41 am)
Hrm can anyone else put this up for host? Would be much appreciated.. Playing right now :)
#36
06/18/2005 (6:42 am)
Grrr.. I'll get this fixed in a few minutes. My apologies.
#37
06/18/2005 (7:01 am)
Code - www.jwvanderbeck.com/atlas/atlasTextureGen.zip
Docs - www.jwvanderbeck.com/atlas/AtlasTexGen.html

You will be prompted for a login. Username is tse, password is ggatlas117.
#38
07/14/2005 (8:58 am)
Teensy lil leak as well:

atlasTextureGen.cpp @ line 616

char name[255]; // NEO: changed from: char* name = new char[255]

Never gets freed and seeing as its always 255 cant just declare it.

;p

~neo
#39
07/14/2005 (10:53 am)
You mean char name[255], right? :)
#40
07/14/2005 (11:30 am)
Doh, typo, yeah ;p