How can I make certain meshes be rendered through walls in HDRP?

I have an object in my scene that I would like to be rendered with an outline/an effect when behind walls, similar to this:

. How can I create this in the HD Render Pipeline?

Hi,
this is not available currently in HDRP. A change will come in 2019.3 version of HDRP to allow to do such effects.

Hello,

Another way you can achieve this effect is by re-creating the ZTest operation in a shadergraph to know if you’re behind an object or not then you can do whatever you want. The problem is that it requires the material to be set in ZTest Always mode so the object is always rendered and this is not currently available in HDRP (it’s in progress here: https://github.com/Unity-Technologies/ScriptableRenderPipeline/pull/3692).

Example Graph:

4584118--426988--BehindTheWalls.gif

2 Likes

What will that change be?

Finally! I’m waiting this function for so long since I saw LWRP can do such things

Hello, quick update about the custom passes :slight_smile:

Custom passes in HDRP have been shipped with the 7.1.1 version, there are currently in an experimental state and a lot of bug fixes and improvements will be available during for the next releases.
There are already some examples of custom passes in HDRP that can be found here: GitHub - alelievr/HDRP-Custom-Passes: A bunch of custom passes made for HDRP, Note that this repository is currently using a branch on the SRP repository that will be part of the next release of HDRP. I’m currently writing the documentation for the custom passes so right now there is pretty much nothing about it except the examples in the HDRP-Custom-Passes repository above.

6 Likes

Hi, does it work with URP?

It would appear not. I just recreated it, I guess. There is no “Base” colour that I could find. Doesn’t seem to do as the GIF suggests. Always seems to show the blue shader. No glowing through objects either

5657290--588676--Graph.png

What change? Is it possible to recreate that effect with HDRP now that 2019.3 is out?

It is name “custom pass and custom postprocess”, see example here: GitHub - alelievr/HDRP-Custom-Passes: A bunch of custom passes made for HDRP

So, custom passes look like a good thing for sure. But what about the OP question? How can I achieve the same effect from the LWRP video the OP linked while using HDRP? I am a skilled coder of many years, but shader code for some reason still eludes me… can this be achieved without code in hdrp lie it did in lwrp in the linked video?

or at the very least… How can I achieve the same effect from the LWRP video the OP linked while using HDRP?

Any assistance here to get me over my mental block would be great.

I’m having this same issue SmorgasOfBorg. Did you figure out a way, ultimately?

You can follow the example here in the custom pass sample repository to achieve the same effect: https://github.com/alelievr/HDRP-Custom-Passes/blob/master/README.md#see-through-effect6369774--708996--87780070-37e49700-c82e-11ea-9d03-d5ce2a4410c6.gif
Note that this example also shows you how to use the stencil with custom passes :slight_smile:

4 Likes

Interesting! I didn’t see that one there several days ago, did you create it for demonstration purposes? I know many were looking for this effect! I like that it’s pretty much drop-in ready. It may not be as simple as achieving this effect in URP (like in the Brackeys video), but at least it’s now achievable in HDRP for intermediate devs.

How difficult would it be to add a distance check so the effect stops occurring after a certain distance?

Yeah, I got so many requests for this effect that I finally added it. Note that there will be a new custom pass API version coming with 20.1 and 20.2 that will allow you to code these effects more easily and with less code.
It’s also planned to add the stencil configuration in the custom passes UI and when we’ll have that, it’d be possible to re-create this effect without any code, just using the builtin custom passes, and a ShaderGraph material.

You have several ways to do it:

  • Discard the pixel based on his distance to the camera in the ShaderGraph (you can also make it fade before disappearing)
  • Discard the pixel based on the object position in ShaderGraph, it uses the mesh pivot instead of the pixel position so it doesn’t work with static batching (because meshes are merged together).
    Note that these techniques don’t save any draw-call, it just discards the visual result. If you want to save the draw calls of the objects I think you’ll need to do a custom culling query in the custom pass. But, of course, it’s trading CPU performances for GPU so I can’t say you’ll win any performances as it depends on the content of your scene.

Hi
If your still looking for a solution check our Asset as this is a custom made shader for this use case.
It can handle multi user multi buildings , walls ( obstructions ) and is available for Standard RP , URP and HDRP .

https://forum.unity.com/threads/rel…isible-within-buildings-std-urp-hdrp.1182130/
https://assetstore.unity.com/packag…1.1782839353.1631897836-1270869709.1615288349

Greetings
Toorican