[TUTORIAL] Stencil buffer in Unity URP (cutting holes, impossible geometry, magic card)

Поделиться
HTML-код
  • Опубликовано: 11 дек 2024

Комментарии • 123

  • @TheInSinging
    @TheInSinging 10 месяцев назад +15

    THIS IS THE BEST TUTORIAL out there for URP / Stencil / Depth mask - for AR masking as well. Don't search further. I checked other tutorials, this one is the best. Thank you for your work!

    • @pixtrick
      @pixtrick  10 месяцев назад

      Thanks for the kind words ! :D

  • @TheKr0ckeR
    @TheKr0ckeR Год назад +11

    This is a high level video. Instead of showing what to do, you also explained how it works actually. Great tutorial.

    • @pixtrick
      @pixtrick  Год назад

      Thanks for these kind words :D

  • @kushs-labs
    @kushs-labs Год назад +5

    Thank you for this. And definitely yes regarding the Advanced Hole Cutting Techniques. Will be waiting for that video too.

    • @pixtrick
      @pixtrick  Год назад +1

      I'll add it on my list then ;)

  • @Smash_ter
    @Smash_ter Год назад +1

    11:50 you could also assign those faces as separate materials

    • @pixtrick
      @pixtrick  Год назад +1

      Definitely yeah, I didn't talk about the UV mapping either but that was not the sake of the video

    • @Smash_ter
      @Smash_ter Год назад

      @@pixtrick i feel the focus more on the stencil aspect was more important imo. And yet there's still a lot that i dont know about stencils like the satuates and wraps. This at least should help many get a decwnt understanding

  • @dedovskaya
    @dedovskaya Год назад +2

    It is the best tutorial on the Stencil buffer. Thank you so much for the great video!

    • @pixtrick
      @pixtrick  Год назад

      It's an honour ! Thank you so much !

  • @armint9109
    @armint9109 Год назад +1

    Thank you so much for the amazing explanation!

  • @thewightone7441
    @thewightone7441 Год назад

    I've been working on a feature for quite some time now, and recently came to the conclusion that shaders/stenciling was my best option. This video has brought me so close to the solution, but I fear I'm still too new to figure out the solution.
    Here's the context:
    I have a building exterior and interior. When the player enters the building, I want all exterior objects to fade into darkness, and interior objects to remain on screen (The walls move out of the way, so thats not the issue here). When the player exits, those objects fade back in.
    From my failed attempts and the info I got from this video, here's what I think I need to do:
    Separate interior objects from other objects by putting them on their own layer
    Have a world space blackout screen hover in front of the camera.
    Set the Blackout screen to its own layer "blackout"
    When I want to fade out all exterior objects, I call in the blackout screen
    Use a stencil that accomplishes the following:
    If an "interior" object has been rendered on this pixel, AND would be overwritten by a "blackout" pixel, use the "Interior" pixel.
    This seems to be very close to what you're doing in this video, so I am almost certain that this is the solution, but I can't seem to wrap my head around how this looks set up.

    • @pixtrick
      @pixtrick  Год назад

      I guess we already figured this out ;)

  • @-lunte.
    @-lunte. Год назад

    presentation quality off the charts! liked and subbed

    • @pixtrick
      @pixtrick  Год назад

      Thank you so much :D

  • @cenklar
    @cenklar 4 месяца назад

    Thanks! It's a great tutorial, worked perfectly right off the bat.

  • @dissonantprotean5495
    @dissonantprotean5495 Месяц назад +1

    I appreciate the video but honestly this is so fn complicated. UPDATE: I got it working. Took some real concentration 😅 appreciate your help here!

    • @pixtrick
      @pixtrick  Месяц назад

      Yeah, it is quite difficult to grasp. Glad you got it working though!

    • @dissonantprotean5495
      @dissonantprotean5495 Месяц назад

      @@pixtrick mostly, but I realize this doesn't completely work for my use-case. I need to make a hole in an object, but only if the "hole creator" object is actually visible, i.e. not occluded. With you example, the "hole creator" can be behind the object (occluded) and it will still make that part invisible.

    • @pixtrick
      @pixtrick  Месяц назад

      You would have to use the depth buffer on top of the stencil buffer for that. You can dm me on discord if you want to talk more about it

  • @fleity
    @fleity Год назад

    I will ask this here because your video is truly one of the best stencil buffer explanations I have seen over the years (especially considering read/write mask)^^
    You say turn off shadow casting for the ground. That is because the shadow caster pass does not care about the stencil value. That is really not ideal. I see the workaround of setting the walls to draw shadows both sided okay but it still feels a bit broken.. the same is true for for any kind of depth pre pass unfortunately. Since the ground is disabled from the regular rendering loop it does not show up in the depth pre pass at all which will prevent us from using depth priming as optimization and the objects will also be missing in the depth texture (except depth priming is disabled, but unfortunately this only applies the the game view, scene view is always using a depth pre pass).
    Btw SSAO in DepthNormals mode forces a depthNormals pre pass.. so the same issue applies here as well. That is why it was not working for stylie473joker5. After Opaque mode + priming disabled copies depth from the depth written by the color pass, but that works only in very few cases.
    Do you have any ideas how one could fix / work around that issue? The way you show here is the way everyone seems to implement stencil buffer usage in URP but it's seems incredibly limited due to these limitation. Thanks for thinking about it :)

    • @pixtrick
      @pixtrick  Год назад

      Hey! Thanks for the comment and the kind words I appreciate that!
      Now, about your question, I don't really think there's a real workaround for that, since the shadow caster pass uses the vertex data to draw shadows. Since the fake geometry created by the stencil buffer is not an actual geometry (I mean it is not some vertex data, it's just pixels on screen), the shadow caster pass cannot render there properly. Then, I don't really see any workaround for keeping the ground shadows while not rendering them into a hole. Now, if you really need your ground shadow (I assume it would be for like a platformer game or something), I would suggest not to use the stencil buffer unless you're really forced to. Use real geometries as much as you can. I think this is not (or maybe it is but it would be such a pain regarding performance) possible to draw shadows pixel by pixel, so that the shadows are not rendered into the hole but are rendered for the ground, but that is absolutely not reasonable.
      May I ask you what you are trying to achieve? Maybe there's a workaround in your situation and I would be glad to help :)
      Have a great day !

    • @fleity
      @fleity Год назад

      ​@@pixtrickThanks so much for the reply :)
      I think, I figured out two possible solutions by now but either way it sucks a bit that this is so exhausting to do. Beware this will be a long text, thanks for letting me rubberduck a bit.
      It is in fact not a plattformer, rather an isometric adventure type of game. I am making this example up but the situation is basically like this. Imagine a hill and ground mesh with a meteor crater on top. The crater is the hole I would like to stencil out. I can not build this right into the mesh because it is procedurally placed. Inside the crater I have a plane which reads the depth texture to create some fog-ish dust.
      Issue 1: Shadows of the hill are drawn without the stencil cutout hence everything in the crater is shadowed. Turning of the shadows would mean no shadows in the surrounding area by the hill.
      Issue 2: the information in the depth texture is also wrong. This is a bit harder to explain and needed a bit of digging in the frame debugger and render pipeline. The Render objects feature only writes to the cameras color target. The color target contains a depth channel but it is only used when certain conditions are met. For example in the game view, if depth priming is disabled and nothing else forces a depth pre pass (like ssao in depthNormals mode). The scene view always uses a depth pre pass not matter what we do.
      When we remove the ground from the regular render loop and only render it through render objects it is completely removed from the depth pre pass because the render objects feature does not set that up and the mask definition that we have set excludes it from ALL main passes (except for shadows...).
      I wonder why this isn't done in the render feature but that I guess that this is the reason why the feature still says experimental. Unity didnt figure out a way to make it compatible with any possible srp renderer. This is an issue what the typical "hey draw the characters silhouette" tutorials don't have because they draw the character in the regular loop too.
      As for solutions, one option I can make work is not using stencils at all. Render everything in the main loop, set the queue for ground materials to 1990 and create a depth mask shader + material that overwrites the depth where it is rendered with infinitely far away. Then everything that is rendering afterwards renders as usual and even shadows are correct (because the shadow passes use the depth only passes of the shaders too).
      The other solution is to modify the render objects feature to also create a depth pre pass or inject the missing draw calls into the existing pass with the correct stencil renderblock set and render the stencil render objects feature extremely early (before pre passes).
      Second solution is more flexible / cleaner and actually allows using the stencil buffer fully but it is much more work. I am at the point where stuff renders in the depth pass but not with stencils yet.
      I guess my issue here is simply summarized with: Render Objects does not work with depth pre pass, stencil in render objects does not work with shadows in URP, but it could, unity just didn't finish it yet 😕.

    • @pixtrick
      @pixtrick  Год назад

      Hmmm your thinking process might be good, but I think there's a much simpler solution for such a problem.
      Basically, your problem is : how to generate a hole in a procedurally generated terrain. To me, this is much simpler than having to deal with depth pre passes and everything, plus it would be much more cleaner. As I said before, you have to use real geometries as much as you can, and only use the stencil buffer when it's needed. To me, you shouldn't use the stencil buffer at all for this problem since the crater will not move in your scene (I mean I assume it won't move). I don't know how you generate your terrain and how it should look, but I think you should use techniques such as the wave function collapse that allows you to design "tiles" that you can put together in numerous ways. That way, you can keep a procedurally generated terrain and would only have to make a tile where there is the crater.
      If you still really want to use the stencil buffer, well don't xD
      I cannot really help since I think it would feel broken ether way. Still, it was extremely interesting to read your different solutions, but yeah to me you should change your approach to this problem.
      Hope that helps !

  • @HordorDev-ms7sj
    @HordorDev-ms7sj 5 месяцев назад

    This helps a lot! You make my day!🤫

  • @elisechevrier7996
    @elisechevrier7996 Год назад +1

    Trop bien ! Merci Pix !!

  • @bovineox1111
    @bovineox1111 8 месяцев назад

    Disabling the ground collider is fine for a single entity but you’re quite likely to have multiple entities and those will still rely on the ground entity!!

    • @pixtrick
      @pixtrick  8 месяцев назад +1

      Absolutely, that was just an example, it's totally up to you to improve this ;)
      In this case what you would do instead is disabling the collision between the 2 colliders basically

  • @watercat1248
    @watercat1248 7 месяцев назад

    I think this 3D mask system i was looking for i will definitely do some tests tomorrow.

    • @pixtrick
      @pixtrick  7 месяцев назад

      Don't hesitate to message me on discord if you need anything

  • @kahnetop
    @kahnetop 8 месяцев назад +1

    great explanation! is this possible in the build in render pipeline ? i struggle a lot to convert the technique correctly

    • @pixtrick
      @pixtrick  8 месяцев назад +1

      It is indeed possible, but you won't have access to the render features.
      Basically, the URP allows a per-layer rendering with its render features (so you don't have to worry about the materials of each object of the layer), whereas the built-in RP don't, so you'll have to write custom shaders to get the same result, it's a bit harder but 100% doable in my opinion.

    • @kahnetop
      @kahnetop 8 месяцев назад

      @@pixtrick thanks for the response!
      I finally succeeded!
      I think the hardest part was that i used Amplify and its stencil buffer parameters were some time buggy 😅
      But you're explanation was really great and help me find the way!!

  • @dpgames8165
    @dpgames8165 Год назад

    Man this is some good stuff!
    You should consider making a game someday! (:

    • @pixtrick
      @pixtrick  Год назад

      Perhaps someday ... Stay tuned ;)

  • @lulloxa
    @lulloxa Год назад

    Thanks a lot I really needed it ! It's very clear ! Another one ?

    • @pixtrick
      @pixtrick  Год назад +1

      For sure ! Stay tuned ;)

  • @hamzzashaffi
    @hamzzashaffi Год назад +1

    Thanks for sharing! :)

    • @pixtrick
      @pixtrick  Год назад +1

      It's my pleasure !

  • @stylie473joker5
    @stylie473joker5 Год назад +6

    Thank you for your hard work, The hole is working as intended however The wall i put the render feature on is being rendered transparent (i can see stuff behind it) any idea what am i missing ?
    Edit: its the Screen space ambient occlusion affecting the wall like that (disabling it fixes the issue). but that's not a good solution.
    Edit 2 : Ticking "After Opaque" in the Ambient Occlusion render feature fixed the issue.
    I hope it helps anyone having the same issue and thanks again for the awesome tutorial

    • @pixtrick
      @pixtrick  Год назад +3

      I didn't know there was such a weird interaction ! Thanks for sharing that :)

    • @fleity
      @fleity Год назад

      I can add a bit more information about why this wasn't working and kind of still is broken. See my other comment I left :)

  • @tufanaydin6340
    @tufanaydin6340 10 месяцев назад

    Thank you so much you done great job

  • @RindGame
    @RindGame 6 месяцев назад

    Nice Video, Learn A Lot

    • @pixtrick
      @pixtrick  6 месяцев назад

      That's good news!

  • @muhammedensarsandkc4466
    @muhammedensarsandkc4466 Год назад

    Just excellent.

  • @helikaon00
    @helikaon00 9 месяцев назад +1

    I can't seem to follow your instructions when it comes to NOT using a shader to solve it. You pop up the render object settings but I can't figure out how to set it up to work.
    I am trying to solve this without shaders because I am developing something that can't use normal shaders at all. It could use shader graph, but I don't know how to do this in shader graph either.

    • @pixtrick
      @pixtrick  9 месяцев назад

      Hey ! You just have to use a render feature then. Basically, instead of using a shader for the mask material, you just have to create a render feature with a Never stencil comparison operation, so that it won't show on screen. You can use any material you want for that mask then since it won't show on screen at all.
      EDIT : I forgot to mention that after doing that, you'll have to use the Fail operation instead of the Pass operation, because the comparison operation will always be false, so that the Pass operation will never trigger.

    • @helikaon00
      @helikaon00 9 месяцев назад +1

      Hmm, yeah, I just can't seem to figure it out. I was trying to make something for the Apple Vision Pro but you can't use normal shaders, you can only use shader graph (or other node based shading methods), because they use MaterialX which requires node based shading. Thanks for your help though! Appreciate you taking the time to respond.@@pixtrick

    • @cutsceneentertainment6706
      @cutsceneentertainment6706 4 месяца назад +1

      @@helikaon00 I struggled with the same thing and got it to work. I don't know if it will work for you or anyone else reading, but this is what I did:
      - Make sure that the culling mask dropdown menu of your main camera has both your walls layer and your occlusion object layer checked
      - Make sure the proper render pipeline asset (the one you have the stencil on) is set in the quality section of project settings
      - Make sure that in the "Filtering" section of the render pipeline asset inspector window, the Opaque Layer Mask dropdown has both your walls layer and your occlusion layer UNchecked
      - On the render feature for the walls, set Event to AfterRenderingOpaques, set the layer mask to your walls layer, enable Stencil and set its value to 1, and then go "Not Equal, Keep, Keep, Keep" for the next four dropdown menus, in that order from top to bottom.
      - On the render feature for the obscuring object, set Event to BeforeRenderingOpaques, set the layer mask to your obscuring object layer, enable Stencil and set its value to 1, and then go "Never, Keep, Replace, Keep" for the next four dropdown menus, in that order from top to bottom.
      Lastly, in case anyone wants this to only work when behind a wall, not in front, give your obscuring object a new script. Have it fire a raycast from itself to the main camera every frame. If the raycast is obstructed by any object in the wall layer, change it's scale to whatever size you want. Otherwise, change its scale to 0.
      I'm not a professional at this, I figured this out through trial and error. So if it doesn't work for you, I'm really sorry but I have no clue how to fix this. I just hate when people post "I figured it out" and don't say how, so hopefully this helps someone.

  • @mmertduman
    @mmertduman 4 месяца назад

    Great tutorial! I have a question, why do we create a new layer for each view? Can’t we modify the materials of each object and change their stencil ref values to be equal to 1 2 3 4 respectively and set the test to equal? I don’t want to clutter the project with many layers just for some effect. Same for the first ground crack effect.
    Follow up Q for the Mask shader, could we have said Comp Never and Fail Replace? Wouldn’t that also make the mask invisible? Would we still need Blend Zero One in that case?
    Another follow up Q.. for the objects that fail the stencil test and not get drawn, does Unity still write them to the depth buffer?

    • @pixtrick
      @pixtrick  4 месяца назад +1

      Only great questions here!
      About the layers, you can use materials that have stencil behaviours for the objects in the cube without having to modify their layer indeed. The drawback of this method is that you have to create a custom shader for these objects so that you can customise their stencil behaviour. You wouldn't be able to use any material for these objects, whereas you can with the layer method.
      About the mask shader: yes, Comp Never / Fail Replace is a great method for making an invisible mask. However, it won't draw at all, so it won't write into the depth buffer. It could be annoying for some edge cases, but for I tend to prefer that approach too. You don't need ZWrite Off or Blend Zero One with that technique, I find that quite elegant.
      About your last question, I partially answered it before but just to clarify: if a pixel fails the stencil test, it is not rendered. If it is not rendered, it cannot write into the depth buffer.
      Hope that helps!

    • @mmertduman
      @mmertduman 4 месяца назад

      @@pixtrick Amazing! Thank you

  • @marcmantra
    @marcmantra Год назад +1

    The magic card example makes me think. I tested and if I let the card as Default Layer and all the content to the new layer, I can set a Render Feature with the same stencil value and using Equal to have the same effect. Without 2 render features. Did I miss something? Thanks for your tutorials

    • @pixtrick
      @pixtrick  Год назад +2

      Do you mean that the effect works without a render feature for the card itself ? Interesting ! I would be curious to see that
      To me, the card model would overlap all the content if you render it without a render feature, but perhaps I'm wrong, I will test that soon ;)

    • @marcmantra
      @marcmantra Год назад +1

      It's true that using your example you created the hole and show the content, it's perfect. But we can have a hole modeled in the card and use the quad only to show the content. Not a really important thing...

    • @pixtrick
      @pixtrick  Год назад +1

      @@marcmantra oh yeah that works as well ! I just used this technique to allow you all to resize the hole in the card as you wish
      I agree this is not an important thing, but I didn't think about that to be honest x)

  • @Vinisetas
    @Vinisetas 23 дня назад

    Amazing tutorial! I'm currently having some preformance issuses in my VR project while using the solution you show us on video. Do you have any performance tips to VR projects? or any performance tips in general? thanks!!

    • @pixtrick
      @pixtrick  23 дня назад +1

      What solution are you using?

    • @Vinisetas
      @Vinisetas 23 дня назад

      @@pixtrick I'm currently creating a magic window, where the player can see a theater inside one window of a house. It works somehow like the magic card u show us. But the FPS drops below 50 when the player look trough that window. Do you know something I can do to improve the shader performace? Thank you so much!!

    • @pixtrick
      @pixtrick  22 дня назад +1

      @@Vinisetas I would say your theater rendering is screwing up something then. The stencil buffer does not really cost something

    • @Vinisetas
      @Vinisetas 22 дня назад

      @@pixtrick Turns out there was a real time light one the theater scene, now the stencil is working perfectly fine, thanks a lot!!

  • @matteovergari141
    @matteovergari141 17 дней назад

    ì'm going to shoot a comment just in case, but the magic card doesn't work for me, the quad does not cut a hole through the card and does not show anything through it. I've foilowed the tutorial exactly and i did the important thing you mentioned earlier, what might be wrong? the only way the quad cuts through the card is when i set the default layer as visible, otherwise it does not work at all, what could fix this?

    • @pixtrick
      @pixtrick  17 дней назад

      Hi! Did you set the mask and card layermasks correctly ? I'm not entirely sure what can be wrong, but you can send me a message on discord to show me what you're trying to do

  • @RT-qi7rn
    @RT-qi7rn 10 месяцев назад

    I'd really like to learn how to do it without requiring a special layer for the ground as I'm working on a game where the layers have already been carefully setup and can't really be changed

    • @pixtrick
      @pixtrick  10 месяцев назад

      I'll try to make a video on that

  • @user-ct8ws3qp7c
    @user-ct8ws3qp7c 5 месяцев назад

    Could this be used for making bullet holes on walls etc?

    • @pixtrick
      @pixtrick  5 месяцев назад

      If you want to see through the hole, yes it could be useful. However, most games use decals for that, which is basically slapping a bullet impact texture on a wall.
      Still, I would be curious to see that! That's kind of a good idea :)

  • @empluna
    @empluna 10 месяцев назад

    Hi, how did you manage to make the inverted cube invisible from the side? Like the tunnel to go through? Great tutorial

    • @pixtrick
      @pixtrick  10 месяцев назад

      Hi ! It's an inverted render culling, you can access this parameter in the material editor

  • @PhuongNguyen-uf2xs
    @PhuongNguyen-uf2xs Месяц назад

    What method should I use if I want to render mouth over beard of each character even when beard is covered mouth? I tried following your video but mouths of all characters is now rendered over every character's beard.

    • @pixtrick
      @pixtrick  Месяц назад

      I don’t understand what is wrong

  • @aureliopuertamartin3631
    @aureliopuertamartin3631 Год назад +1

    Great tutorial! The card effect is really useful for Augmented Reality experiences! I have only one problem, let's say I have an object that animates from inside the card/portal in and out. Currently the object is only renderd through the portal, so in case it goes outside, and you look the portal from the side the object will disappear. How do I need to set up the materials and settings to achieve the effect?

    • @pixtrick
      @pixtrick  Год назад

      Hey mate, glad you found an interesting application for this tutorial :D
      The portal inside is indeed rendered only through the portal. I mean, yeah, that's intended. Now, if you want to render the objects even if they are in front of the portal without using the stencil buffer (basically looking the objects from the side when they are out of the portal) and only in that case, this gets a lot more tricky, because you'll need to use the depth buffer, but transparent materials (such as the one used for the portal) do not write into the depth buffer so you're a bit boned... You'll need to use a trick to make the portal material write into the depth buffer, then create another render feature to render the objects out of the portal. Actually, the hardest part will be to find that trick ...
      Hope that helps ! Good luck !

    • @exoqqen
      @exoqqen 7 месяцев назад

      did you find a solution?

  • @Tukyo
    @Tukyo Год назад +1

    my braiiinnn

    • @pixtrick
      @pixtrick  Год назад +1

      Imagine mine to make the video 💀

  • @m1glw97
    @m1glw97 6 месяцев назад

    Is this effect somehow possible with depth priming set to auto or forced?

    • @pixtrick
      @pixtrick  6 месяцев назад

      Not sure, but all the tests I've made so far point to the fact it is not

  • @TheGameLecturer
    @TheGameLecturer 8 месяцев назад

    This works greatly in Editor for me, but in the build it doesn't function properly (neither on Android nor on PC) and I just get plain geometry.

    • @pixtrick
      @pixtrick  8 месяцев назад

      What unity version are you using ?

    • @TheGameLecturer
      @TheGameLecturer 8 месяцев назад

      2022.3.17f1@@pixtrick

    • @pixtrick
      @pixtrick  8 месяцев назад +1

      You have to make sure that the depth priming is off, and I'm not entirely sure but I think setting the rendering path to forward can help as well

    • @TheGameLecturer
      @TheGameLecturer 8 месяцев назад

      @@pixtrick yes it is disabled and the rendering path to forward, I tried different depth texture modes as well. I'll try to isolate the problem by making a new project and make some test and I'll come back to you.

    • @pixtrick
      @pixtrick  8 месяцев назад

      @@TheGameLecturer all right ! By the way you can message me on discord if you prefer

  • @zave1776
    @zave1776 8 месяцев назад

    Is there any chance to apply the same effect in the HD render pipeline? needed very very much

    • @pixtrick
      @pixtrick  8 месяцев назад

      Hey, I'm not very sure about that, you should try ! In any case, if the render features are not available, you can still use the stencil buffer through custom shaders

  • @tufanaydin6340
    @tufanaydin6340 10 месяцев назад

    SSAO and DECALS not working how can we fix it ?

    • @pixtrick
      @pixtrick  10 месяцев назад

      Decals are not compatible with the stencil buffer, or at least I haven't find a way to make them work together yet. We discussed about it on the discord server of the community but didn't find a solution ...
      Regarding SSAO, I'm not entirely sure why it doesn't work as intended ... It may be either the AfterRenderingOpaques event queue or simply because objects rendered through a render feature are not considered as "real" geometries

  • @WalrusesAreTheOne
    @WalrusesAreTheOne 11 месяцев назад

    Hi, one of the first portal tutorials I saw relied on a mask material instead of a stencil buffer, to make the outsides of the portal invisible. It seemed way easier to me than setting up a stencil buffer. Is there a reason this is better? Thanks!

    • @pixtrick
      @pixtrick  11 месяцев назад +1

      Hi ! I think that what you saw is also based on the stencil buffer, but perhaps the main difference here is the use of the URP which allows you to add stencil parameters on any rendered material.
      However, I agree it might be annoying to set up, so if you're only using hand-written shaders (shader graphs doesn't count), you can add these stencil behaviours way more easily.
      Does it answer your question? x)

    • @WalrusesAreTheOne
      @WalrusesAreTheOne 11 месяцев назад

      @@pixtrick Thanks! Yes, that answers it:)

  • @_TommyP
    @_TommyP Год назад

    Hi, this is so great. I was wondering if you could tell me what version of unity you are using? I'm finding it impossible to get transparent materials to render even after adding the renderobjects.

    • @pixtrick
      @pixtrick  Год назад +1

      Did you choose the right render queue for your render feature ? I'm using Unity 2021.3+ by the way

    • @_TommyP
      @_TommyP Год назад

      @@pixtrick hey, yep. I ended up getting it working in a new project. No idea what I messed up. Thanks for the very quick reply!

    • @pixtrick
      @pixtrick  Год назад +1

      @@_TommyP maybe it was something related to depth priming or the render type then. Anyways, I'm glad you found a solution!

  • @othmanmoat
    @othmanmoat Год назад

    Hey I'm interested in holes that do not require a special layer for the ground ;) Also, for the hole collider, is it not possible to not have it convex? (I guess it would be possible to make a non-convex shape by making multiple convex shapes work together)

    • @pixtrick
      @pixtrick  Год назад

      It is indeed possible but you'll then have to procedurally generate a concave mesh that fits the hole geometry. I'll maybe make a video on that later since it's very interesting but quite advanced too

  • @bjaksel
    @bjaksel 8 месяцев назад +1

    Your brain is massive

    • @pixtrick
      @pixtrick  8 месяцев назад +1

      You're flattering me x)

  • @ninocoillard6775
    @ninocoillard6775 11 месяцев назад

    This is awesome however when I apply the card part to my game with a door I want to mask I can still see the shadow, do you know how to fix it ?

    • @pixtrick
      @pixtrick  11 месяцев назад

      Hey there ! You just have to disable shadow casting in the mesh renderer

    • @ninocoillard6775
      @ninocoillard6775 11 месяцев назад

      Okay, and if I want to cast just when it is enabled and then when it is masked, disable it ?@@pixtrick

    • @pixtrick
      @pixtrick  11 месяцев назад

      @@ninocoillard6775 when you say enabled, do you mean when you can see through the door or do you have something that enables or disables the view through the door ?

  • @Hozgen
    @Hozgen Год назад

    can we add this stencil id to shader graph? I couldnt find any method.

    • @pixtrick
      @pixtrick  Год назад

      Unfortunately, the stencil buffer is not supported by the shader graph ... May i ask why you want to retrieve this information ?

    • @Hozgen
      @Hozgen Год назад

      @@pixtrick I want to move object/objects over other layers or on certain layers in 3d platform. This is is easy in 2D but in 3D it is not satisfactory to me. There is a solution in Unity docs but it is not working for URP.
      The second one is shadows, and i couldnt get rid off weird shadow renders for this technique. I also want to see proper shadows on other objects. :/

    • @pixtrick
      @pixtrick  Год назад

      @@Hozgen you can use the depth buffer to do that I suppose. Maybe you can contact me on discord to go more into details because I'm not sure to get your problem to be honest :/

  • @ToniehGaming
    @ToniehGaming 11 месяцев назад

    New sub!
    I have a doubt, basically in the example of the letter it's as if it were a "hologram" on a cellphone using the position of your eyes (camera). Is there a possibility to obtain that texture relative to the camera position so that on the full screen I can create this hologram effect? This is not with stencils, but I have been looking for how to do this and can't find any information :c.

    • @pixtrick
      @pixtrick  11 месяцев назад +1

      Hey, thanks a lot !
      I'm not sure to fully understand your request to be honest, is it about the floating text in the magic card? If that so, it's only a canvas in world space with appropriate dimensions

    • @ToniehGaming
      @ToniehGaming 11 месяцев назад

      @@pixtrick nonono, I have an eyetracker device, I can know the user position and I want that the monitor screen act like that portal to make that card effect, It's so tricky. If you atatch the game camara to the user real position works but not that good that the card effect

    • @ToniehGaming
      @ToniehGaming 11 месяцев назад

      It's hard to explain, also is similar to the 3d wallpaper efect, but that use the acelerometer, is not that real effect

    • @pixtrick
      @pixtrick  11 месяцев назад +1

      @@ToniehGaming ok i think i'm slowly getting it. Is it like a parallax effect ?

    • @ToniehGaming
      @ToniehGaming 11 месяцев назад

      @@pixtrick Not so much like a parallax, more like the monitor was a window and there were things through it. It looks the same as what the card effect looks like.

  • @Ch1psi-k
    @Ch1psi-k Год назад

    does this work in Unity HDRP?

    • @pixtrick
      @pixtrick  Год назад

      I think there would be a way to use the stencil buffer in hdrp, but I don't know how honestly (i mean without having to hard code it in a shader)

  • @hldfgjsjbd
    @hldfgjsjbd 9 месяцев назад

    Can these be done in Shader Graph?

    • @pixtrick
      @pixtrick  9 месяцев назад

      Unfortunately no, shader graph doesn't support the stencil buffer

  • @InstantStarWars
    @InstantStarWars 9 месяцев назад

    Merci, maintenant c'est limpide