How To Mask 3D cut-out with mouse using shader [Unity Tutorial]

preview_player
Показать описание
How to create Mask 3D cut-out with mouse using shader? Unity
This is the easiest way to mask Object in unity

Comment on any training you want 👊

"The channel name has changed from Golomoder to Game Dev Box"

-------------------------------------------------------------------------------------------------

🟩 Subscribe to GolomOder :

-------------------------------------------------------------------------------------------------

#learnunity​ #unitytutorial​ #Mask3D​

Remember to like and comment 🙌

If you have any questions post them in the comments and I'll do my best to answer them.
Рекомендации по теме
Комментарии
Автор

This is excellent, thank you so much. I was half-convinced a regular shader wasn't gonna work with URP, but it seems to be doing so so far! Thank you so much for taking care to make this. I know it's only a relatively small group of people who'll appreciate this, so really, thank you, for taking the time anyway <3

LilayM
Автор

2 years later and this video still helped me with exactly what I needed. Very short, simple and effective and can be adapted to me usable at run time easy. Thanks for the amazing tutorial.

genesisr
Автор

Thanks for da script homie. for anyone who's also trying to use shadows with this, you have to make make the Queue = "AlphaTest" in the shader, and change the render queue to 2452 in the MaskObject Script

grindersnitch
Автор

This was exactly what I was lookling for! Many thanks and ceep up the good work.

peterperkhed
Автор

AMAZING! I can't believe this was so hard to figure out how to fix, so thank you so much for this tutorial!

yourssincerely
Автор

Praise you, saved me a lot of shader research :)) Sometime the easiest solution works best

codingsloth
Автор

Finally, something that work on Android GJ TY FU XD

satiya_hotel
Автор

Thank you! I had a problem with hiding some materials, because my object has multiple materials, so I needed to change a little bit a script. If someone needed:

for (int i = 0; i < ObjMasked.Length; i++)
{
Material[] materials =
for (int j = 0; j < materials.Length; j++)
{
materials[j].renderQueue = 3002;
}
= materials;
}

VanJohn
Автор

Thank you so much! May I ask a question -- how to implement the opposite? For example, masked objects are only visible (instead of invisible) when the mouse moves to it

yoyopei
Автор

Very cool but im wpndering how i could invert it so that you can only see objects behind the sphere, im trying to make working portals in vr

GearMaster-kuxf
Автор

Thank you so much, this is such a useful feature!!!! Thank you!!!

DePistolero
Автор

Very practical inside game development

narmkh
Автор

will it be possible to cut just the content inside of the mask object, like a true boolean operation, leaving the content behind it still visible? im working with volumetric visualization based on textured planes, that will be perfect to slice through the volume using spheres or cubes, but the shader you showed on the video erases everything even behind the geometry of the mask object. thanks in advance

arthurbuccioli
Автор

I'm using this mask shader for this object that's under a transparent glass material and when the mask is active the mesh DOES disappear, but the glass material doesn't render above the object anymore. Is there a way to fix this? I still want the object to look like it's under the glass

pink_doodlr
Автор

Great tutorial and example. Can you please explain why Environment objects are not drawing on top of Mask Sphere. Given that Mask Sphere renders at 3001 and Blend Zero One means it will not render anything at source level and at that time no destination pixels were in frame buffer. Then render queue 3002 is rendered with all environment objects and they use default blend SrcAlpha OneMinusSrcAlpha. So those object should get rendered on top of Mask Sphere. Can you please help why this is not happening? Or render queue is ignored when using Blend? Thanks.

patelsagar
Автор

Doesn't work in URP with Depth turned on in pipeline

patryksliwa
Автор

Unity How To Mask 3D cut-out with mouse using shader

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MaskObject : MonoBehaviour
{
void Start()
{
for(int i = 0; i < maskObj.Length; i++)
{
= 3002;
}
}

void Update()
{
Vector3 = mouse Input.mousePosition;
Ray castRay =
Raycast hit;
if (Physics.Raycast(castRay, out hit, Mathf.Infinity))
{
transform.position = hit.point;
}
}
}

technofeeliak
Автор

This is amazing! Which Rendering Pipeline are you using btw? HDRP, URP, or SRP?

SuperNidey
Автор

Hello, nice video. Doesn't it work with URP? I tried this but it is not working. Am I missing anything?

akifzaman
Автор

This is awesome! I've been trying to do this in Shader Graph but couldn't get anything to work.

thuliumgames