Game Development Community

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:

www.dark-wind.com/images/ss/ss10.jpg

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..

#1
12/21/2006 (5:40 am)
Well. . .I was going to work on this at a later date and time, but here is a link on a similar discussion:

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?
#2
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 :-)