Game Development Community

Atlas Normal mapping?

by Jacob Dankovchik · in Torque Game Engine Advanced · 10/13/2005 (4:31 pm) · 8 replies

I've seen someone who had this working before and was wondering if anyone else has done this. And if so, would you be willing to post the solution? I'd like to mess around a bit with this and have a look. :)

#1
10/14/2005 (2:23 pm)
I did play around with this, and a quick hack (ie no source changes needed) is take one of the detail textures (there are 2) and make a normalmap from it.. change the Pixel shader to do a DOT3 thing on it and mutliply the final color by that (before the fog lerp).

a more robust solution would be to dig down into AtlasInstance and load up a normalmap there..
#2
10/14/2005 (4:12 pm)
Could you perhaps post your modified shader? I'm messin around a bit with this myself but I dont really know if im close to anything or what..
#3
10/14/2005 (6:33 pm)
Heh, looks like (in my tree at least-prolly old) the second detail texture is just a differently scaled version of the first detail texture..oh well i'll figure it out and post here.. if some body doesnt beat me to it..
#4
10/14/2005 (6:55 pm)
Nevermind, I already got it working. ;)

However its still just a detail texture so it tiles all ugly and doesn't work how I want. Next step is to see if I can load a second TQT texture file. Perhaps a fully normal mapped terrain like that will have some very good results.. L3DT can export its normal map that it uses for lightmap calculations. So if you were able to apply that and have it shade normally in realtime.. Would that not act as a sort of dynamic shadowing on the terrain? Or am I thinking a bit too much of it?
#5
10/14/2005 (7:01 pm)
Yah, I had it working at one time but when i loaded 1 big normalmap, my system went to a crawl, like so i backed off it..Current head may have fixed the second detail texture tho..
#6
10/15/2005 (12:18 am)
It seems like using one of the many noise pixel shaders would be the way to go to generate "detail normal maps". It wouldn't take as much texture ram, and would be fun to implement! ;)
#7
10/18/2005 (1:51 pm)
GREAT idea brian..
#8
10/24/2005 (8:21 pm)
To use an alternate second detail texture in atlas:
(add mDetail2XX stuff after mDetailXXX stuff)

atlasInstance.h
AtlasInstance : public SceneObject add
StringTableEntry        mDetail2Name;
   GFXTexHandle            mDetail2Tex;


atlasInstance.cpp

AtlasInstance::AtlasInstance() add
mDetail2Name = StringTable->insert("terrain_water_demo/data/terrains/details/detail1"); //default to 1st detal
AtlasInstance::onAdd() add
mDetail2Tex.set(mDetail2Name, &GFXDefaultStaticDiffuseProfile);
AtlasInstance::renderObject change GFX->setTexture(3, mDetailTex);
to
GFX->setTexture(3, mDetail2Tex);
AtlasInstance::initPersistFields() add
addField("detail2Texture",  TypeFilename,  Offset(mDetail2Name,     AtlasInstance), "Detail texture.");
AtlasInstance::packUpdate add
stream->writeString(mDetail2Name);
AtlasInstance::unpackUpdate add
mDetail2Name    = stream->readSTString();

hope i didnt miss anything..;)