Definitely, I'd love to take a look!Yeah targa is super simple, like dead obvious simple.

I wrote a GML implementation a while back.

If I still have it I can send it to you.

Here you go:@TheSnidr thank you for making this, it's very nice to have this 3d functionality in gm.

I was wondering if you would be able to add something to your example program that would translate from the 2d screen to 3d coordinates. Much like you already have, but where the mouse isn't tired to the camera so that I could gain functionality as in an RTS type game. The goal is to be able to take the ray and figure out what instance it is touching. I can manage that, but I don't understand the vector math to rework your example so that the vector goes through my mouse to a point in space and it is independent of the camera view.

I've looked online and in the legacy forums where I remembered some examples to do this, but I can't seem to make them work with what you've made. I've also tried reverse engineering what you have in your example, but the best I can figure is that the xFrom starts from a point behind the camera and passes directly through it to figure where the camera is pointing.

Any help you could provide would be greatly appreciated. Again, thanks for making this for the community!

Code:

```
/// @description smf_2d_to_3d_vector(camMat, angle, aspect, posX, posY)
/// @param camMat
/// @param angle
/// @param aspect
/// @param posX(0-1)
/// @param posY(0-1)
var ret,
camMat = argument0,
t = tan(argument1 * pi / 360),
_x = (1 - 2 * argument3) * t * argument2,
_y = (1 - 2 * argument4) * t;
ret = [ camMat[0] + camMat[4] * _x + camMat[8] * _y,
camMat[1] + camMat[5] * _x + camMat[9] * _y,
camMat[2] + camMat[6] * _x + camMat[10] * _y];
ret[3] = point_distance_3d(0, 0, 0, ret[0], ret[1], ret[2]);
if ret[3] != 0
{
ret[0] /= ret[3];
ret[1] /= ret[3];
ret[2] /= ret[3];
return ret;
}
return [1, 0, 0, 0];
```

Code:

```
/// @description smf_matrix_create_up(x, y, z, to[3], up[3])
/// @param x
/// @param y
/// @param z
/// @param to[3]
/// @param up[3]
//Creates a 4x4 matrix with the up-direction as master
var vTo, vUp, vSi;
vUp = smf_vector_normalize(argument4);
vTo = smf_vector_normalize(smf_vector_orthogonalize(vUp, argument3));
vSi = smf_vector_normalize(smf_vector_cross_product(vUp, vTo));
return [vTo[0], vTo[1], vTo[2], 0,
vSi[0], vSi[1], vSi[2], 0,
vUp[0], vUp[1], vUp[2], 0,
argument0, argument1, argument2, 1];
```

The normal map, specular map and parallax map are all combined to one single texture!

Last edited: