# Is it possible to "lock" a worldaligned texture?

**URL:** <https://forums.unrealengine.com/t/is-it-possible-to-lock-a-worldaligned-texture/392536>\
**Category:** Rendering\
**Tags:** node, unreal-engine, lock, question\
**Created:** [May 3, 2017, 12:09am UTC](https://forums.unrealengine.com/t/is-it-possible-to-lock-a-worldaligned-texture/392536 "2017-05-03T00:09:53Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_c93a180c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c93a180c](https://forums.unrealengine.com/u/anonymous_user_c93a180c)\
**Post date:** [May 3, 2017, 12:09am UTC](https://forums.unrealengine.com/t/is-it-possible-to-lock-a-worldaligned-texture/392536/1 "2017-05-03T00:09:53Z")

</div>

I somewhat recently discovered the worldalignedtexture node, and it has revolutionized how I design environments. However, I am wondering if I can use it with animated objects without the texture changing.

So more specifically, I am wondering if it is even possible to “lock” or “bake” a world aligned texture when an actor is spawned, so that it can be moved, rotated, or animated without the texture changing. For example, say I wanted to model a boulder with a world aligned rock texture for variation, with moss on the top side, and be able to roll the boulder, and for the texture to perfectly roll with it, as if worldalignedtexture wasn’t used at all.

---

<div class="post-metadata">

**Author:** ![dillzilla](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dillzilla](https://forums.unrealengine.com/u/dillzilla)\
**Post date:** [May 3, 2017, 2:28am UTC](https://forums.unrealengine.com/t/is-it-possible-to-lock-a-worldaligned-texture/392536/2 "2017-05-03T02:28:13Z")

</div>

a world aligned texture is locked by definition. what you want is to shift it’s coordinates based off the object it’s on yes? if so then this should solve your issue. also if you are using world aligned texture i believe you plug in the 1-x into the WorldPosition input. if that doesn’t work remove the 1-x and try again.

 ![136573-untitled.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/7/9/a795bab304fa94d9f4d69a0d012ab13b30affe16.png)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_c93a180c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c93a180c](https://forums.unrealengine.com/u/anonymous_user_c93a180c)\
**Post date:** [May 3, 2017, 4:35am UTC](https://forums.unrealengine.com/t/is-it-possible-to-lock-a-worldaligned-texture/392536/3 "2017-05-03T04:35:24Z")

</div>

Thanks for the reply! However, I suppose I could have been a little more specific.

The main thing I’m trying to accomplish, is to get an animated actor to initially have its texture world aligned, and then somehow locked, so that the texture appears to be baked onto the mesh. A much better example would be applying a world aligned texture to a few tree actors, mainly for some texture variation, but have them animated to move with the wind, and not look like the texture is morphing because certain vertices are changing their world space location. Does that make sense?

To some, this may seem like an unnecessary thing to accomplish, but if I can get it to work, it can produce some truly powerful results. What I like so much about world aligned textures, is the fact that they appear seamless, and I would like to be able to use them for detail texturing on actors like characters, because it can cover up seams very nicely. Is what I’m trying to do even possible? I tried your method, dillzilla, and it didn’t do what I wanted.

---

<div class="post-metadata">

**Author:** ![Deathrey](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Deathrey](https://forums.unrealengine.com/u/Deathrey)\
**Post date:** [May 11, 2017, 12:43pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-lock-a-worldaligned-texture/392536/4 "2017-05-11T12:43:48Z")

</div>

Yeah it is possible. You need to project textures in mesh local space rather than world space. You would need to modify WorldAlignedTexture material function for this yourself though.

---

<div class="post-metadata">

**Author:** ![Oskar\_Swierad](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/oskar_swierad/32/465778_2.png) [@Oskar\_Swierad](https://forums.unrealengine.com/u/Oskar_Swierad)\
**Post date:** [May 14, 2017, 7:41am UTC](https://forums.unrealengine.com/t/is-it-possible-to-lock-a-worldaligned-texture/392536/5 "2017-05-14T07:41:25Z")

</div>

If I recall correctly, there’s a local counterpart to this node: ObjectAlignedTexture.  
If there isn’t, go inside this node (it’s a function) and Transform world position into local space.  
But that only works for object position/rotation anim. Moving vertices are why standard UVs were invented. For baking, you can recreate the setup in Substance Painter (using Fill type of layers with Triplanar option).

---

<div class="post-metadata">

**Author:** ![Imagine-Games](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Imagine-Games](https://forums.unrealengine.com/u/Imagine-Games)\
**Post date:** [June 1, 2018, 5:25pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-lock-a-worldaligned-texture/392536/6 "2018-06-01T17:25:37Z")

</div>

im wondering if you ever got a solution to this… im using world aligned because it fixed so many of my UV problems directly in unreal editor, but if i have something like a moving iceberg using world aligned texture it looks ultra silly…

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_c93a180c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c93a180c](https://forums.unrealengine.com/u/anonymous_user_c93a180c)\
**Post date:** [June 4, 2018, 5:44pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-lock-a-worldaligned-texture/392536/7 "2018-06-04T17:44:28Z")

</div>

I found something close to what I wanted, but not exactly. I had to do some ‘under-the-hood’ experimentation to get it to work properly.

Basically, I looked through the engine content folders and found a material function called “LocalAlignedTexture”, or something like that. I don’t believe it was a finished function, as it didn’t seem to work properly by itself. So I messed around with it until I got it to accomplish what I wanted.

When applied to an actor, it would seamlessly wrap the texture around the whole object, and when rotated, the texture stayed fixed. This is really nice for doors that swing on a hinge, and don’t need an intentionally mapped out texture (I used it for a basic white door with a couple different wood grain textures). It’s especially nice, because you don’t have to manually map out the UVs for the mesh–although you will need to give your mesh an ‘automatic UV’ layout to avoid texture stretching.

Will this work for your project? It sounds like it. But my original intention was to be able to do this with a texture ‘start position’, which would be linked to the actors starting point, and then be locked. The local aligned function I used locks the texture, but I believe it will map out the same exact way on a duplicate actor at a different world location.

To summarize, I had two intentions:

1. Texture automatically wraps around actor seamlessly so I don’t have to go through the hassle of manually UV mapping every mesh.
2. Give texture a ‘start position’ that is offset by world location, and remains locked when moved or rotated.

I found a way to accomplish the first intention, so my problem is half solved. If you or anyone else have an idea that might work for the second part, let me know!

Imagine-Games, if this looks like any kind of solution to you, let me know, and I can post a screenshot of the function I modified.

---

<div class="post-metadata">

**Author:** ![Imagine-Games](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Imagine-Games](https://forums.unrealengine.com/u/Imagine-Games)\
**Post date:** [June 4, 2018, 5:51pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-lock-a-worldaligned-texture/392536/8 "2018-06-04T17:51:35Z")

</div>

thanks for your detailed explanation. I found out a solution on my own as well here is a screenshot

 ![243137-uselocalposition.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/2/9/c29a64f2092419caf7ac231eb0d0859b1fed93c7.png)

by using world aligned function with a world position using a local position function it locked into place (so the icebergs material are locked onto it even if it is moving)

I did it for the same reason as you, as the icebergs used where originally very low poly and then i subdivided them and I don’t have much time to setup uv maps for each and everything in the game so world aligned seems like a quick fix for almost everything that has an issue with the uv map

---

<div class="post-metadata">

**Author:** ![script526](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@script526](https://forums.unrealengine.com/u/script526)\
**Post date:** [June 9, 2018, 8:47pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-lock-a-worldaligned-texture/392536/9 "2018-06-09T20:47:30Z")

</div>

Buddy could you please show us how you created a UseLocalPosition node?

---

<div class="post-metadata">

**Author:** ![script526](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@script526](https://forums.unrealengine.com/u/script526)\
**Post date:** [June 9, 2018, 9:23pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-lock-a-worldaligned-texture/392536/10 "2018-06-09T21:23:41Z")

</div>

Oh sorry, it’s a simple switch statement. Anyway, your method doesn’t solve the problem at least in my case. World Position node doesn’t affect (texture still swimming while the object is moving). The Local Position node works fine but the texture is stretching.

---

<div class="post-metadata">

**Author:** ![Imagine-Games](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Imagine-Games](https://forums.unrealengine.com/u/Imagine-Games)\
**Post date:** [June 10, 2018, 12:57am UTC](https://forums.unrealengine.com/t/is-it-possible-to-lock-a-worldaligned-texture/392536/11 "2018-06-10T00:57:01Z")

</div>

[Rule The World: using local position to lock world aligned material ... - YouTube](https://youtu.be/F4n5KxZS38E) i made a quick video showing how it worked for me… so the object is now moving but the materials are locked onto it… and there is a scale setting so you can fine tune the texture stretching depending the static mesh you use and how you scale it…

---

<div class="post-metadata">

**Author:** ![script526](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@script526](https://forums.unrealengine.com/u/script526)\
**Post date:** [June 10, 2018, 1:05am UTC](https://forums.unrealengine.com/t/is-it-possible-to-lock-a-worldaligned-texture/392536/12 "2018-06-10T01:05:46Z")

</div>

Wow thank you for the video! I’ll try out scaling feature tomorrow and give you a feedback!

Don’t remove the video please.

---

<div class="post-metadata">

**Author:** ![script526](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@script526](https://forums.unrealengine.com/u/script526)\
**Post date:** [June 10, 2018, 12:39pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-lock-a-worldaligned-texture/392536/13 "2018-06-10T12:39:02Z")

</div>

So I’ve played around your material and found out what the issue is. Texture projects fine while the mesh is facing X or –X direction. When I rotate the mesh — texture gets distorted. Texture stretches if rotating the object after simulation is being started as well. Moreover, I’ve tested this material with the starter content simple objects and I ended up with the same issue so there’s nothing wrong with my mesh I believe. Scale parameter doesn’t help unfortunately.

I believe you will get the same stretching if you try rotating your object.

Facing X

 ![243791-facingx.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/0/d/f0d5b03dc3d5b61911dd35d645b1698db090c274.jpeg)

Rotated by 30

 ![243793-rotated-by30.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/c/f/ccf53cd3519150b4d3393887da076201fe126555.jpeg)

Rotated by 60

 ![243794-rotated-by60.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/3/0/630f00762152987c0d5577417debc57a848abb39.jpeg)

Rotated by 90

 ![243792-rotated-by-90.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/f/b/6fbabb9f1e68fcbe731a1ee50dd543eb7a5f2795.jpeg)

 ![243798-material.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/c/b/8cb3dab17b1684e80f43eef430333f0170475d9e.jpeg)

As you can see while rotating the object texture starts fading out and instead of perfectly applied image I start getting the stretched one. That’s weird.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_c93a180c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c93a180c](https://forums.unrealengine.com/u/anonymous_user_c93a180c)\
**Post date:** [June 14, 2018, 4:01am UTC](https://forums.unrealengine.com/t/is-it-possible-to-lock-a-worldaligned-texture/392536/14 "2018-06-14T04:01:43Z")

</div>

I’ll have to post the function graph that I edited, because I initially ran into the same problem. I was able to get rid of it. Not in the way that I wanted, necessarily, but it worked. I’ll try and post that soon.

---

<div class="post-metadata">

**Author:** ![script526](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@script526](https://forums.unrealengine.com/u/script526)\
**Post date:** [June 14, 2018, 12:22pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-lock-a-worldaligned-texture/392536/15 "2018-06-14T12:22:58Z")

</div>

Nice. Would be interesting.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_c93a180c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c93a180c](https://forums.unrealengine.com/u/anonymous_user_c93a180c)\
**Post date:** [June 19, 2018, 1:15am UTC](https://forums.unrealengine.com/t/is-it-possible-to-lock-a-worldaligned-texture/392536/16 "2018-06-19T01:15:59Z")

</div>

The first image is the ‘LocalAlignedTexture’ material function, located in the Engine Content folder (just search “local” and it will pop up). If you look closely, you’ll notice there’s a section of the material that apparently never got finished. And the part that is causing the weird texture tearing, is the XY Output. If you look at it, you’ll see that the texture is one flat color.

 ![244744-mat1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/d/b/1db8abc726630730a2ab73939e899c37fb216fdb.png)

The second image is my modified version, which includes the ability to rotate the texture (useful for using material instances for wood grain textures on doors). If you look at the graph, you should be able to figure out what I did differently, although please notice that the ‘texcoord’ nodes are [0], [0], and [2]. This is because using [1] results in the flat color, which in turn causes tearing. I don’t fully understand how all of this works, and I’m sure there’s a more efficient way to do it, but obviously the UE4 team didn’t even take the time to finish it, so I at least took it a step further.

 ![244745-mat2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/c/b/9cb679d4f29e000037261e87b53170b61a406ab4.png)

Let me know if any part of this is confusing, and I’ll do my best to explain. Please also let me know if it works for you!

---

<div class="post-metadata">

**Author:** ![enearle](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@enearle](https://forums.unrealengine.com/u/enearle)\
**Post date:** [June 19, 2018, 5:54am UTC](https://forums.unrealengine.com/t/is-it-possible-to-lock-a-worldaligned-texture/392536/17 "2018-06-19T05:54:40Z")

</div>

This can’t be the correct method, but I would think there would be a way to subtract the objects movement from texture coords using panning. I suppose this could be useful if you wanted to interpolate between world aligned and object aligned at run time. I’m sure there is some psychedelic effect that could make use of this but likely nothing useful.

Anyway that’s my 2 cents. XD

---

<div class="post-metadata">

**Author:** ![script526](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@script526](https://forums.unrealengine.com/u/script526)\
**Post date:** [June 21, 2018, 11:20pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-lock-a-worldaligned-texture/392536/18 "2018-06-21T23:20:22Z")

</div>

And what is your actual material looks like?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_c93a180c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c93a180c](https://forums.unrealengine.com/u/anonymous_user_c93a180c)\
**Post date:** [June 29, 2018, 1:44am UTC](https://forums.unrealengine.com/t/is-it-possible-to-lock-a-worldaligned-texture/392536/19 "2018-06-29T01:44:20Z")

</div>

So I went back and put my material on a different mesh, and discovered that it wasn’t actually working the way I though it was. Coincidentally, the meshes I had used all worked well with it, and right after I posted the graph above, I tried it on a new mesh, and it didn’t work right. SO, I’m checking out a tutorial today for something completely unrelated, and stumble across this:

> **[Vector Material Expressions](https://docs.unrealengine.com/5.2/en-US/vector-material-expressions-in-unreal-engine/)**
>
> Material expressions that output a vector value, such as a position or normal.

From the gifs, it seems to do EXACTLY what I wanted, and was available the whole time, and I just never found it :S At any rate, I’m testing it out right now, though not entirely successfully, but I think I’m finally on the right track!

---

<div class="post-metadata">

**Author:** ![Imagine-Games](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Imagine-Games](https://forums.unrealengine.com/u/Imagine-Games)\
**Post date:** [June 29, 2018, 3:48am UTC](https://forums.unrealengine.com/t/is-it-possible-to-lock-a-worldaligned-texture/392536/20 "2018-06-29T03:48:01Z")

</div>

hey im sorry ive been away from my main work computer as im moving and so havent been able to update, but this weekend i move in and ill see if i can offer any additional help

[Next page](https://forums.unrealengine.com/t/is-it-possible-to-lock-a-worldaligned-texture/392536.md?page=2)
