Projecting a texture
by Justin Tolchin · in Torque Game Engine · 03/14/2005 (3:14 pm) · 7 replies
Hi all,
I couldn't find any resources/posts about how one would do this... does anybody know what it would take to project a texture on a large section of terrain? I'm not talking about projecting from actual geometry (like a shadow projection), but just from an image. I'm thinking of doing something like projecting a moving "cloud shadow" texture on the landscape, but I also want to project non-moving images as well. The only real "catch" is that I need the texture to be rendered on top of the terrain and any buildings on the terrain, but *not* on top of any player-controlled movable units.
I'm using the RTS kit at the moment but have also purchased TSE (just haven't gotten around to checking it out yet) so I'd love to have a "generic" solution, but a TSE-only solution will work too. Thanks to anyone who can help (and please use small words as I'm pretty clueless about graphics programming with Torque). :-)
Thanks!
I couldn't find any resources/posts about how one would do this... does anybody know what it would take to project a texture on a large section of terrain? I'm not talking about projecting from actual geometry (like a shadow projection), but just from an image. I'm thinking of doing something like projecting a moving "cloud shadow" texture on the landscape, but I also want to project non-moving images as well. The only real "catch" is that I need the texture to be rendered on top of the terrain and any buildings on the terrain, but *not* on top of any player-controlled movable units.
I'm using the RTS kit at the moment but have also purchased TSE (just haven't gotten around to checking it out yet) so I'd love to have a "generic" solution, but a TSE-only solution will work too. Thanks to anyone who can help (and please use small words as I'm pretty clueless about graphics programming with Torque). :-)
Thanks!
#2
03/15/2005 (9:29 am)
Thanks, Mark! I'll check it out.
#3
03/16/2005 (11:37 am)
Well I have to confess I read it and none of it meant much of anything to me. Too much theory, no code, and some math I don't understand. :-( I know it's really a long-shot but if anybody has any code to do this kind of thing please let me know. Thanks!
#4
1) Look for resources that deal with modifications to terrain texturing/rendering, in search for something that allowed me to get access to the terrain triangles/normals.
2) Study the terrain rendering code, to see how it renders the detail map and the emboss bump, and then determine the best way to render another texture layer on top of the existing terrain.
3) Work into rendering the extra texture layer with my cloud texture on it, probably using a modulate blend.
4) Find out how to generate UVs for that texture.
Moving clouds should be easy to do, since the UV generation could use the same code as the emboss bump effect, and just offset the UVs a little every frame, to make the cloud shadows move.
But adding extra projections could not be done the same way. Re-rendering the WHOLE terrain again for each new texture will be ugly. If the projections are small, I advice you to create an fxProjector object, and use the existing shadow projection code as a base to make it project arbitrary textures, using an arbitrary projection angle and direction.
03/16/2005 (2:32 pm)
If I were asked to add projective textures to my terrain I would:1) Look for resources that deal with modifications to terrain texturing/rendering, in search for something that allowed me to get access to the terrain triangles/normals.
2) Study the terrain rendering code, to see how it renders the detail map and the emboss bump, and then determine the best way to render another texture layer on top of the existing terrain.
3) Work into rendering the extra texture layer with my cloud texture on it, probably using a modulate blend.
4) Find out how to generate UVs for that texture.
Moving clouds should be easy to do, since the UV generation could use the same code as the emboss bump effect, and just offset the UVs a little every frame, to make the cloud shadows move.
But adding extra projections could not be done the same way. Re-rendering the WHOLE terrain again for each new texture will be ugly. If the projections are small, I advice you to create an fxProjector object, and use the existing shadow projection code as a base to make it project arbitrary textures, using an arbitrary projection angle and direction.
#5
03/21/2005 (1:06 pm)
Thanks Manoel. I think this will probably have to wait awhile until I have a better understanding of the key concepts, but I appreciate the advice.
#6
06/17/2005 (4:59 am)
Has anyone been able to do that?
Torque Owner Mz
You'll have to flex some coding muscles to get this done - as far as I know, no one's posted a ready-made torque resource for something like this.