# Twisted tunnel material

**URL:** <https://forums.unrealengine.com/t/twisted-tunnel-material/560498>\
**Category:** Rendering\
**Tags:** Post-Processing, unreal-engine, UE5-0, Rendering\
**Created:** [May 18, 2022, 6:46pm UTC](https://forums.unrealengine.com/t/twisted-tunnel-material/560498 "2022-05-18T18:46:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jessihax0r](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jessihax0r](https://forums.unrealengine.com/u/jessihax0r)\
**Post date:** [May 18, 2022, 6:46pm UTC](https://forums.unrealengine.com/t/twisted-tunnel-material/560498/1 "2022-05-18T18:46:26Z")

</div>

Hey everyone!

I have very limited experience when it comes to creating materials / shaders and I’m completely stumped trying to create a warping/twisting tunnel effect.

The look I’m trying to recreate it something like this:

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/d/f/2df46bd67fce79c7117fe2d39f8fedbf63e3f5b0.jpeg "Unity twisted corridor created using Curved World shader") ](https://www.youtube.com/watch?v=Ylw_aPFPDjk)

or:

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/c/a/1ca4574ccb6ed4e985709021a5999c34ed969896.jpeg)

This is the current result:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/a/6/ea6debe54c3f0b4c201a4afae6ad2261d259faae.jpeg)

I have no idea how to go about twisting the mesh, bending it was relatively straight forward, but this is melting my brain. Perhaps I’m out in very deep water, but I figured I’d ask in case anyone could point me in the right direction!

Thanks in advance!

(Sorry if this gets put in the wrong forum, the Tag system does not want to play nice)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [May 18, 2022, 6:57pm UTC](https://forums.unrealengine.com/t/twisted-tunnel-material/560498/2 "2022-05-18T18:57:17Z")

</div>

I think it’s the same thing as your first vid, it’s a shader, the mesh isn’t actually twisted.

There are tuuts about spherical shaders also.

Here’s one

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/7/c/37ca97c97e31a6e15df9ebaa669876a00c6bfcec.jpeg "Unreal Engine - Twist shader") ](https://www.youtube.com/watch?v=RpOESKjoCf4)

---

<div class="post-metadata">

**Author:** ![jessihax0r](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jessihax0r](https://forums.unrealengine.com/u/jessihax0r)\
**Post date:** [May 18, 2022, 7:35pm UTC](https://forums.unrealengine.com/t/twisted-tunnel-material/560498/3 "2022-05-18T19:35:15Z")

</div>

Hey, thanks for the answer!

My attempt is also done using a shader, however I can’t figure out how to get the twisting to work. I’ve been searching around a lot and can’t find any useful resources, just a handful of showcases like the one you posted. Do you have any tut/resource for the twisting effect?

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [May 18, 2022, 7:47pm UTC](https://forums.unrealengine.com/t/twisted-tunnel-material/560498/4 "2022-05-18T19:47:05Z")

</div>

This one is about a spherical shader, so it would be something like this but, err, twisted…

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/d/2/7d26adf9a01861c3e275602569fa8e4e2ecc5636.jpeg "Part 1: Spherical world - Curved World Shader / Animal Crossing Camera - Unreal Engine 4 Tutorial") ](https://www.youtube.com/watch?v=VCmDwfMz-jk)

---

<div class="post-metadata">

**Author:** ![jessihax0r](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jessihax0r](https://forums.unrealengine.com/u/jessihax0r)\
**Post date:** [May 18, 2022, 8:31pm UTC](https://forums.unrealengine.com/t/twisted-tunnel-material/560498/5 "2022-05-18T20:31:52Z")

</div>

Appreciate it, unfortunately it’s the twisting part that is the problem, the video just goes through the same things that I’ve already done in the bent tunnel that I posted in the OP.

I think that I somehow need to rotate the vertices depending on where in the world / how far away from the camera they are, this might be completely false assumptions, but I can’t really think of another way ( my attempts at this has been futile).

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [May 18, 2022, 9:02pm UTC](https://forums.unrealengine.com/t/twisted-tunnel-material/560498/6 "2022-05-18T21:02:20Z")

</div>

You need to twist them based on distance from the pivot point, I know that much.

What’s happening to the meshes in the foreground, is the crucial thing to observe.

---

<div class="post-metadata">

**Author:** ![RecourseDesign](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/recoursedesign/32/1194503_2.png) [@RecourseDesign](https://forums.unrealengine.com/u/RecourseDesign)\
**Post date:** [May 19, 2022, 10:16am UTC](https://forums.unrealengine.com/t/twisted-tunnel-material/560498/7 "2022-05-19T10:16:15Z")

</div>

If you’re always centered like in the corridor example you could maybe use a post-process volume that uses a spiral gradient as an offset to read the source screen pixels.  
It would kind of work like the drunk effect in the tutorial below (14:47)

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/d/e/7dea68e70accc1e676b80fb72dfdfa25ac75a8fc.jpeg "Six Post-Postprocess Effects - UE4 Tutorial") ](https://www.youtube.com/watch?v=_Yay-X_9Whg)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [May 19, 2022, 12:08pm UTC](https://forums.unrealengine.com/t/twisted-tunnel-material/560498/8 "2022-05-19T12:08:17Z")

</div>

This gives the object twist

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/2/c/c2c0423e2fbb9c47ec06af8c45913bb16c5e6742.png)

![twist](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/e/4/fe436844f4696b2a9873bce2fedf7fd0da5081ee.gif)

I’m assuming it’s something like this, but applied to distance from camera in a postprocess volume.

---

<div class="post-metadata">

**Author:** ![Suthriel](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/suthriel/32/1195643_2.png) [@Suthriel](https://forums.unrealengine.com/u/Suthriel)\
**Post date:** [May 19, 2022, 12:24pm UTC](https://forums.unrealengine.com/t/twisted-tunnel-material/560498/9 "2022-05-19T12:24:43Z")

</div>

That here is his material function, thats responsible for the spherical deformation:

 ![grafik](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/b/e/1be7032ae8603855435edcd8d44738334310fc34.jpeg)

So i would assume, you would have to replace the power node (which basically creates the spherical deformation) with a rotation around the center viewing axis, that is linked to the distance.

The creator of the twisting shader confirmed, that it´s based on vertex offset, and his function has to be integrated into every material, that should get this twist, so no post process.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [May 19, 2022, 1:15pm UTC](https://forums.unrealengine.com/t/twisted-tunnel-material/560498/10 "2022-05-19T13:15:15Z")

</div>

I tried it as a PP, very weird / cosmic 😃

---

<div class="post-metadata">

**Author:** ![jessihax0r](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jessihax0r](https://forums.unrealengine.com/u/jessihax0r)\
**Post date:** [May 19, 2022, 8:20pm UTC](https://forums.unrealengine.com/t/twisted-tunnel-material/560498/11 "2022-05-19T20:20:42Z")

</div>

Ooh, this helps a lot! Thank you 🙂 The rotate about axis function was giving me a huge headache and I couldn’t for the life of me figure out how I should connect things to it, this helps immensely!

Thanks everyone else as well for the answers, definitely going to be checking out the different options!

---

<div class="post-metadata">

**Author:** ![Suthriel](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/suthriel/32/1195643_2.png) [@Suthriel](https://forums.unrealengine.com/u/Suthriel)\
**Post date:** [May 19, 2022, 8:45pm UTC](https://forums.unrealengine.com/t/twisted-tunnel-material/560498/12 "2022-05-19T20:45:19Z")

</div>

Since you are way better with coding and stuff, than i am, maybe you can convert this unity shader graph to unreal ^.^ It´s the same effect, or at least a very similar, just done in Unity.

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/5/d/05d791e45c7da33169de73b1215e2f297cb078b6.jpeg "Twisted Corridor Effect in Unity Shader Graph") ](https://www.youtube.com/watch?v=CGI0SyiElfY)

Tried it, but i cant figure out, how their rotation node works, compared to those, that we have available.

---

<div class="post-metadata">

**Author:** ![RecourseDesign](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/recoursedesign/32/1194503_2.png) [@RecourseDesign](https://forums.unrealengine.com/u/RecourseDesign)\
**Post date:** [May 20, 2022, 2:56am UTC](https://forums.unrealengine.com/t/twisted-tunnel-material/560498/13 "2022-05-20T02:56:09Z")

</div>

> [@ClockworkOcean](#):
>
> I tried it as a PP, very weird / cosmic 😃

I just had to try after you said that 😆  
 ![HallwayTwist](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/d/8/1d88288e9c4447456b3c8df402d8b7cc59098087.gif)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [May 20, 2022, 7:12am UTC](https://forums.unrealengine.com/t/twisted-tunnel-material/560498/14 "2022-05-20T07:12:39Z")

</div>

🤣

---

<div class="post-metadata">

**Author:** ![jessihax0r](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jessihax0r](https://forums.unrealengine.com/u/jessihax0r)\
**Post date:** [May 20, 2022, 9:58am UTC](https://forums.unrealengine.com/t/twisted-tunnel-material/560498/15 "2022-05-20T09:58:35Z")

</div>

I’m getting closer to the result that I want, however, my biggest issue right now is twisting based on distance from the camera. I would want things close to the camera be not twisted at all, and the further away the more twists will happen.

It kinda works when there is one single object, but when the walls, ceiling and floor are different meshes, they all just twist in unison.

Any resource/nodes that anyone can recommend looking into? I tried checking the distance between the camera and the object and use that for the twist amount, but that just made everything go crazy, even if I multiplied it with a very small value hehe…

Does anyone know any good material/shader resources in general? I feel like I’m most likely missing a lot of the basics!

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [May 20, 2022, 10:09am UTC](https://forums.unrealengine.com/t/twisted-tunnel-material/560498/16 "2022-05-20T10:09:06Z")

</div>

Can you show what you have?

---

<div class="post-metadata">

**Author:** ![jessihax0r](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jessihax0r](https://forums.unrealengine.com/u/jessihax0r)\
**Post date:** [May 20, 2022, 11:20am UTC](https://forums.unrealengine.com/t/twisted-tunnel-material/560498/17 "2022-05-20T11:20:37Z")

</div>

Hey, yeah certainly!

I think this is the closest I’ve gotten:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/9/6/796fa37a0f3e182e28e813580448d6c9d1432658.png)

This does twist all the meshes, but it’s incredibly exaggerated and I don’t actually think things further away gets twisted differently. It also makes the whole mesh spin like crazy if you move the camera perpendicular to the mesh:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/f/e/8fe8543fb5abb754fdf722d8d782654daf14df42.jpeg)

This image is with a twist value of 0.0001. I’m basing this off of the Unity version that someone else posted, not really sure what is going wrong, possibly world/local space stuff!

---

<div class="post-metadata">

**Author:** ![jessihax0r](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jessihax0r](https://forums.unrealengine.com/u/jessihax0r)\
**Post date:** [May 20, 2022, 12:11pm UTC](https://forums.unrealengine.com/t/twisted-tunnel-material/560498/18 "2022-05-20T12:11:38Z")

</div>

Adding a bunch of scalars and multiplying the position with a small value kinda gives the look of warping, but it’s still incredibly wonky and it still doesn’t warp more depending on distance:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/f/9/1f9d82bb8c9f543d77686e2a666d5ecfb430f44a.png)

→

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/4/5/b45d4217d7b225cc2e041fc4127ede19bb5c5cdb.jpeg)

Feels like I’m butchering shaders, mainly just trial and error without much knowledge 😄

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [May 20, 2022, 12:12pm UTC](https://forums.unrealengine.com/t/twisted-tunnel-material/560498/19 "2022-05-20T12:12:41Z")

</div>

It’s good to establish distance after which no twisting will occur and work towards that

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/8/f/b8fe9eec255a9963c9915fc1b13648f13a8b2741.png)

So this will make the twist vary between 0 and 1 up to 5000, thereafter fixed at 1.

---

<div class="post-metadata">

**Author:** ![jessihax0r](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jessihax0r](https://forums.unrealengine.com/u/jessihax0r)\
**Post date:** [May 20, 2022, 2:05pm UTC](https://forums.unrealengine.com/t/twisted-tunnel-material/560498/20 "2022-05-20T14:05:41Z")

</div>

Daaamn, thanks for all your help!

Now it works as expected with some kinks here and there, I think I’ve probably frankenstein’d the hell out of this material, but it works for all intents and purposes. I’ll play around with it some more and then post a gif & the material!

[Next page](https://forums.unrealengine.com/t/twisted-tunnel-material/560498.md?page=2)
