Triplanar mapping from Local Space - problem when scaling. How to make it work?

World Space Aligned function that comes with Unreal cannot be used when objects are rotated:


So I modify a copy of the function so that the projection is in Local Space; like this:

The rotation problem is fixed, However now I cannot scale the object independently from the texture…
world2

I try to subtract the position of the object from the AbsoluteWorldPosition, then use TransformVector to ignore the local scale:

This doesn’t work either.
I try to turn off Tangent Space Normal and I did a lot of other variations…
tan5

But so far - nothing. Please help.
To summarize - I need Triplanar mapping done from Local Space that is independent from scaling the object in the world.

You can do this sort of thing

Which will not change scale with the object, but is not triplanar.

object radius

It sounds like what you want is one foot in the world projection, and one in local…

2 Likes

The trick you just show ( very nice ) works ONLY if you scale the object Uniformly… Otherwise - don’t… And this is a bummer for me.
I seek the ability for not uniform scaling of the objects, while preserving the ratio of the texture. this is why I am thinking about triplanar mapping in the first place.
I am looking cluelessly at some other nodes here like:
o01

(sorry for the edit, something gliched)

Bounds based stuff is no good, I know that much. If you rotate a cube, the bounds are all over the place!

bounds

The thing is, the standard nodes do work with rotation, it’s just that you want the texture to rotate with the object. ( right? ). Which is a UV thing, which is local.

it’s just that you want the texture to rotate with the object. ( right? )

Correct.

Basically I have many minimal cubic-form props that with little non uniform scaling and rotation - could look very different. I want to add stone and other textures on them that doesn’t distort when doing this.
Otherwise I have added correctly orientated Box UVs on the props, if this is helpful at all…

If you only rotate them on certain axis, you can get away with bounds, maybe…

One axis of rotation will be totally sufficient if I can scale the object non-uniformly… do you have idea how to hook up this kind of thing sir?

I have an idea. Why not use the object scale independently with this node?

image

or

image

To be honest I am clueless where this should be hooked up really. I am hooking nodes somewhat randomly for days already and my opinion that I can brute force solutions like that diminishes hah… I don’t have the needed knowledge.

I will come back to you tomorrow…

1 Like

Hello!
Perhaps it helps!

material-ignores-object-scale-and-tiles-by-position

1 Like

Nice gimmick, could be quite useful but works ONLY with planes unfortunately.

A complete solution for Object Aligned Triplanar Material was given by [bgolus] Ben Golus here:

Big shout for Ben Golus, truly a Valhalla level of work!

Also I found second solution from Arkiras

Looks nice :slight_smile: Is it working for you?

The Ben Golus’s version is perhaps on the heavy side, but yeah, definitely works.

Try Object Radius instead of Object Bounds, I find it’s much more stable

Here we are two years later. Is there a version of this code that works with UE 5.2 and up. some of the inputs are changed now