Game Development Community

Mapping one single texture to an entire Atlas instance?

by Tim Holt · in Torque Game Engine Advanced · 06/16/2006 (4:12 pm) · 6 replies

Trying right now to overlay a "normal" texture onto an entire Atlas instance (not a TQT) and running into some odd coordinate issues.

What I want is to drape one standard/normal (non-TQT) texture over the entire Atlas instance - just like how the TQT image is draped over it. Thinking it was just a matter of what coordinate I used in the shader, I tried this...
float4 shadowColor  = tex2D(shadowMap,  IN.texCoord);
...since this is the same coordinate (IN.texCoord) used to pull out the image from the TQT image. Unfortunatley, I get something like this...
www.fsl.orst.edu/lemma/gnnviz/images/shader_texture_clamp.png
So I went into AtlasInstance::renderObject where the shader is set up, and noticed that the TQT texture uses...
GFX->setTextureStageAddressModeU( 0, GFXAddressClamp );
   GFX->setTextureStageAddressModeV( 0, GFXAddressClamp );

That (I am assuming) makes the texture not tile. So I tried that, and no difference. In fact I tried running it with GFXAddressClamp and GFXAddressWrap - and it didn't seem to make a difference in how the results came out.

I also tried just scaling the coordinates. A quick count showed me I have 16 "tiles" of that shaded texture being overlayed on my terrain. So I thought "OK, scale the IN.texCoord by 16". Results unfortunately aren't right, and look like this...
www.fsl.orst.edu/lemma/gnnviz/images/shader_texture_scale16.png
The scale looks right, but as you can see it's only sampling a 1/16 square texture now.

And so dear readers... any suggestions on which coordinate I need to be using here to pull out the right pixels from my "overall" texture?

#1
06/16/2006 (6:20 pm)
Well I managed to kludge something together that works. Here's the sort of "cumulation" of my week so far...

www.fsl.orst.edu/lemma/gnnviz/images/close_far_texture_blend.png
So the distant forest you see is a smaller (1024x1024) png image draped over the entire 10x10km area, but only drawn at distance.
#2
06/18/2006 (9:41 pm)
Just to let you know. if you hit Ctrl+P, it takes a screen shot, in the root directory.
#3
06/21/2006 (9:54 am)
I hope this is resourced soon!!!!
#4
06/21/2006 (6:50 pm)
FYI I'm currently adding Parallax shaders for the distant terrain as an option. That will make (especially for my application) the distant forest view a lot more detailed looking. After I get that working it should be ready to resource.
#5
06/22/2006 (8:41 pm)
I really cant wait...I was trying to get a shader working that I used to use in game studio..unfortunatly im not so good at converting....that one used 2 alpha maps to desided how 4 textures got placed on the ground...it worked great for that engine...sorry to get off topic...cant wait for you to finish.....
#6
06/25/2006 (10:12 am)
Awsome!!