Wall Cutout in Unity Shader Graph

preview_player
Показать описание
Many games need to make sure the focus is on the player or some other object, and walls are usually a hindrance. You could move the camera past the wall or render things over it.

In this tutorial, we'll just cut a hole in the wall instead. I've seen a wall cutout effect before in a handful of ways, so I'm going to take an alternative approach that doesn't use a stencil.
--------------
--------------
This project uses Unity 2020.2.1f1 and URP 10.2.2, but it should work with other versions.
--------------
------------

#unity #shaders #tutorial
Рекомендации по теме
Комментарии
Автор

I had tons of fun making this effect! Are there any effects like this that you think I should cover? Comment down below and remember to subscribe!

danielilett
Автор

Great video. I really like the effect, and the quality of the tutorial is top-tier. You're doing amazing work!

Masoniscool
Автор

That's a very elegant implementation! In my case i kept an array of all the materials derived from this shader and set the cutoutPos vector foreach material in that array, so I avoid the constant raycast and copying materials while allowing for a smooth transition of the hole between different walls.

_g_r_m_
Автор

Hey Daniel, this is an awesome tutorial, I was looking for ways to do this and the stencil buffer methods caused me a lot of headaches in the past. Keep making amazing videos <3 !

FTWRahul
Автор

How can I fix it if the cutout is in front of the player?

andrewo
Автор

Hey Daniel, really helpful tutorial, can you please make a tutorial to add a door frame out (transparent) to the wall dynamically. I have tried multiple solution but none is working

harshwardhanjethania
Автор

I love the video. The xray vision effect seems pretty cool. But I've got a question. Would it be possible to cut a whole in the shape of a mesh instead of a square or a circle? If so, how?

xroadabro
Автор

My two favourite Unity youtubers haven't posted in awhile (Brackey's quit and I don't know why Jason Wieman hasn't posted in a year). Your channel looks promising so I subbed :)

justinwhite
Автор

Is there a way to do the same thing but changing the shape depending on the Object you wanna see through the wall?. For example, in the case of this video the shape of the hole in the wall would be a Cube instead of just a circle...

mgmar
Автор

Awesome tutorial! My only issue is that I have multiple cutouts overlapping if there's more than one object in the way.

Spencer_Hill
Автор

Thx so much for your tutorial!!! could you please tell me how to do the taxicab distance? I'd like to have a square effect

changruizhu
Автор

Can this shader accept multiple holes on it? I'm wanting to use this along with a scrolling texture to make Fog of War on a plane that is above my map, which is also on a plane. I want to cut holes in the shader where the user has discovered. What do you think about that?

michaelcollins
Автор

How about stereo for VR? (SinglePass/MultyPass)

miloradtanevski
Автор

weirdly enough the whole wall becomes transparent, even when I rotate the camera. any solution?

ymedomri
Автор

Hi, great video as always! I'm trying to get kind of a "fog of war" effect, where depending on which level area we are at, only show that area to the player. I would like to have kind of a misty outline for the cutout that actually moves. How would you approach this kind of a problem?

torppe
Автор

For anybody running into the following problem: If you maximize your play viewport the cutout is in the wrong position, but it is fine as long as the play window is not maximized. Switch your play window's (game window) aspect ratio to 16:9 or something other than Free Aspect, then it will be fine.

ruhanpotgieter
Автор

is it possible to apply this shader and use the effect on other materials?

derBalu
Автор

I know this video is old, but what material and object do I apply the cutout to?
should i be applying the cutout to the walls, player, or other object?
the cutout is either always on or always off and im at a bit of a loss for what to do

carriganreilly
Автор

@daniel Ilett
the vector 3 offset and raycasthit dont work there seams to be synthax error could you help me out ?

buttlesstwigg
Автор

hey can you do it the cutout with texture?

Matt-qrsy