How to avoid rendering rear-facing particles while applying semi-transparent VFX

Hi Depthkit Team,

I apply particles VFX which makes a Studio character semi-transparent. Because we see the back side of the character, it reveals that the figure is empty inside. This might be awkward for the project I’m currently working on. See attached picture for instance. We want to get the impression that the figure is full-bodied while having semi-transparent point-cloud VFX.

Is there a way to either occlude rear-facing particles or fill out the figure with point cloud mass to make it a monolith semi-transparent sculpture?

Thank you for your advice.

this would rise your point load in unity and the need of more performance … normally the aim is to reduce points to get it more fluent playing in higher FPS … so fill the body with ponits i would normally avoid … maybe the “lite” player which actually only renders the from the camera(playercontroller) visible side of the asset … but i new experimented with the lite in combination with VFX point cloud look … maybe @CoryAllen can say here more to this issue …

Hi @MartnD,
These are good points.

Since it’s not real point cloud, but VFX particles imitation, maybe it’s not decreasing performance too heavily.

Lite player currently only works with built-in RP, as far as I know, thus no VFX graph is possible.

@NikitaShokhov I checked with and @James and @Tim and it sounds like you can mask the rear-facing particles by adding a mesh/solid look to your asset (can be low-density for performance), but only write to the depth buffer so that it remains invisible in the render, but mask any particles behind it. Apparently this was done using the legacy Depthkit Unity plugin and legacy Depthkit Visualize app, but has not been rebuilt using the modern packages.

Hi @CoryAllen,
Sounds promising. But how exactly to do this? I have never done it, and after some search, it’s unclear, whether it’s just Shader Graph modification or a complex programming.

Hi @CoryAllen ,
I solved the shader, the depth buffer only approach works exactly as I wanted. Thanks a lot to you, @James, and @Tim.

Glad to hear! If you are able to share how you accomplished this, I can try it myself and integrate that into our documentation.

@CoryAllen, Sure. It might be nice to include instructions about this issue.

For me, it was balancing between transparency of VFX and the shader. So we have a range of possibilities between only VFX particles visible and no mesh at all, and only mesh visible and no particles.

Now, how I accomplished the shader to be able to control its transparency and avoid seeing the character’s rear-facing mesh. If it’s Unlit shader, check these two boxes Transparent Depth Prepass in Material > Surface Options; and in Shader Graph > Graph Inspector. I also exposed Alpha property for quicker adjusting transparency.
Highlighted in orange:

If I uncheck one of the boxes, we see through the front surface. Highlighted in red:

If I want to make the mesh completely invisible with Alpha, the character with VFX particles looks nicely full-bodied (doesn’t look as it’s empty inside):

Let me know if you’re able to repeat it and if you have questions.

1 Like

@NikitaShokhov Thanks for sharing!

1 Like

Hello @NikitaShokhov and @CoryAllen
Thanks a lot for sharing this workflow Nikita, it looks really good!

@CoryAllen is it possible to reproduce this with a URP project? It seems that only an HDRP project would work. Thanks!

It is definitely possible. I just made the same in URP.

In shader graph:
Depth Write - Force Enabled

1 Like

Wow, thanks for your super fast response @NikitaShokhov
I have a lot to learn about ShaderGraph, so excuse me if this is obvious but I don’t have that option in my Graph Inspector. I am in Unity 2020.3.33 with Depthkit Studio Shader Graph 0.4.2

Try to use URP 12+… and Shader Graph 12+… in Unity 2021.2+…
You probably have them in the 10th version in your Unity version.

Great, thanks for that @NikitaShokhov, I’ll check it out!

@CoryAllen could you confirm which version of Unity you recommend with Depthkit Studio captures apart from 2020.3.33

@VeroniqueLevert Any of the Unity v2020.3 versions with LTS are supported.

Thanks @CoryAllen, so so far there is no version of 2021 that is supported?
@NikitaShokhov would you mind sharing the exact version of 2021.2 you used to achieve the results you shared here? Thanks in advance!

@VeroniqueLevert Unity v2020 is what those packages were tested against at the time of release, but it is possible that they work in 2021. If you are testing the Depthkit packages in 2021 and they are working, then there’s no reason not to use them - We just caution you against relying on this Unity version as it hasn’t been fully tested on our end. We’re aiming to test with a newer version of Unity when the next version of our Unity packages are developed, but currently do not have a timeline slated - We’ll keep you posted.

If I were you and wanted to use newer URP and shader graph, I’d start by trying the newest 2021.3.18f1 LTS and would switch to previous versions if Depthkit is not working correctly. But certainly, stick with LTS.

I use 2021.3.16f1. While it’s not supported, in my experience, Depthkit works perfectly there. It may not be your case, though.

1 Like

Thanks @CoryAllen that’s all great to know!

Thanks @NikitaShokhov, much appreciated!