3D point - to - texture coordinate
by Sam Redfern · in Torque Game Engine · 12/21/2006 (2:41 am) · 4 replies
I'm hoping to dynamically modify vehicle textures by painting bullethole images onto them as they get shot: see picture below:

The problem is how to calculate the texture coordinate of a 3D point. Does anyone know how to do this? - I have never really got into the details of polygon pushing much. (Also, a collision point will of course be on the car's collision mesh rather than its render mesh, but a "nearest match" approach could be used).
Thanks..

The problem is how to calculate the texture coordinate of a 3D point. Does anyone know how to do this? - I have never really got into the details of polygon pushing much. (Also, a collision point will of course be on the car's collision mesh rather than its render mesh, but a "nearest match" approach could be used).
Thanks..
About the author
#2
Looks promising, what was the roadblock? I don't think Neo is right, my cars already have their own copies of textures, which are blended with rusted versions at load-time. Once each has its own texture, you can continue to modify them without needing any additional textures in memory.
I much prefer the idea of painting over a texture's pixels (which will be aligned to their shape), rather than adding traditional 3D decal objects (which will always be flat polys).. I already have code for dynamically modifying a texture's pixels..
I'm on TGE
thanks...
12/21/2006 (6:04 am)
Michael,Looks promising, what was the roadblock? I don't think Neo is right, my cars already have their own copies of textures, which are blended with rusted versions at load-time. Once each has its own texture, you can continue to modify them without needing any additional textures in memory.
I much prefer the idea of painting over a texture's pixels (which will be aligned to their shape), rather than adding traditional 3D decal objects (which will always be flat polys).. I already have code for dynamically modifying a texture's pixels..
I'm on TGE
thanks...
#3
12/21/2006 (6:13 am)
I'll dig up the code and shoot you an e-mail (listed in your profile) with what I have. You can use it at least to get the texture coordinates, and then apply your own effects instead of the decal which I was going to use.
#4
12/21/2006 (6:22 am)
Cool, that would be really useful if I can get it to do what I need. Thanks :-)
Employee Michael Perry
ZombieShortbus
Decals on DTS objects
The response to my post was kind of a road block. I do have a method for translating from 3D world space (collision point of projectile on object), to 2D UV coordinates of a texture.
Are you using TGE or TGEA?