Twisted tunnel material

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:

or:

This is the current result:

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)

2 Likes

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

2 Likes

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?

2 Likes

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

2 Likes

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).

2 Likes

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.

2 Likes

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)

1 Like

This gives the object twist

twist

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

2 Likes

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

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.

1 Like

I tried it as a PP, very weird / cosmic :smiley:

1 Like

Ooh, this helps a lot! Thank you :slight_smile: 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!

2 Likes

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.

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

1 Like

I just had to try after you said that :laughing:
HallwayTwist

2 Likes

:rofl:

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!

1 Like

Can you show what you have?

1 Like

Hey, yeah certainly!

I think this is the closest I’ve gotten:

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:

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!

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:

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

2 Likes

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

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

2 Likes

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!

1 Like