Download

Keeping a material "upright"

Hi guys,

I have been playing around with materials trying to work out how to keep a material upright. Basically I have a mesh that rotates, but as it rotates I would like the texture to stay pointing up. I have tried various approaches but have yet to be able to work it out.

Any tips or tricks to achieve this would be greatly appreciated.

Thanks!

If I understand your request correctly, you can solve it by using the WorldAlignedTexture node in your material. That aligns the textures to the world instead of the object.
Connect a Texture2D node to the WorldAlignedtexture and connect the WorldAlignedTexture output the diffuse input. Repeat for each texture you use, like normal, roughness etc.

This is half way to the effect I am after and is one of the ways I have been trying to figure it out. It keeps the texture aligned but is bound to world location. I need the texture to move with the object it is applied to if that makes sense.

I think I know what you mean. Is it something like this?
http://www.chrisalbeluhn.com/UDK_Asset_Position_Offsets_Texturet_Tutorial.html
That should work for UE4 too. The example there is a little more complex, but the basic principles, using Object World Position hopefully still works.

materialHelp.png

This is an image of what I mean, I tried your adivce Frepp73 but it is not quite what I am looking for. In the image think of the actor as the grey box. I require the texture to move with the actor in world space but to always remain upright. So if the box was to roll the arrow texture would always need to be pointing straight up.

That arrow could be a decal. You could rotate the object and it would still project onto it but you would have to keep the decal location updated which Im sure you could do with blueprint.
Maybe this might help https://www.youtube.com/watch?v=IHMsubEpPq4
That video shows you how to set up a material that is only applied in a certain direction and the texture moves with the object. The video is for UDK but the same can be done in ue4