Download

Local x,y,z coordinates for Decals?

I am trying to get local-to-the-decal-box position texture coordinates to work.
That is X,Y and Z.
I want these coordinates to follow if I move the decal box.

I have managed to do ‘projected’ 2D coordinates (no continous Z) and plain World Space coordinates.
But not position data local to the decal box.

Does anyone know how to do this?

Cheers, fred

You can do it by creating a Blueprint for your deecal. Then you need to create an MID for your decal material, and use the BP to specify 3 vectors, the X, Y and Z orientation vectors. Then in the decal material, you would use the function “Inverse Transform Matrix” using the X, Y and Z variables. Then you use WorldPosition as the vector to transform, and the result would be local position inside decal. Then you just need to divide it by the extents if you want it 0-1.

Sweet thanks a lot Ryan!
I’ll will try this!

Cheers, Fred

I got that working. Maybe it’s possible to get the translation offset together bundled with the three vectors but I didn’t figure that out so did like this instead.

loc_coord2.png

d748d4ab23c17a17bec9d7d5e712e746230dfa5b.png

Usually you would subtract ObjectPosition or ActorPosition just like you did there. Not sure if those nodes works for decals or not, so what you did is probably the best way to center it.