Object transparency between player and camera


Fade game object/Dithered Transparency on The Unity Asset Store:


Fade game object/Easy Transparency on The Unity Asset Store:

This are two ways of making your objects between camera and player transparent. One uses dithered effect you can easily add to your custom hlsl shader or shader graph. Other uses unity default URP shader transparency.

Technical info:
The script is based on detecting colliders between camera and the player, so that the script works properly each object has to have collider on it.

Package includes:

  • Multiple objects fade at the same time
  • Detecting object when inside collider
  • Works with standard and skinned mesh renderers
  • Lets you choose between multiple ways of detecting mesh renderes in object hierarchy
  • Easy to add a graph with a dither effect that affects the shadows according to your will

Fade game object/Dithered Transparency
To make the dithering effect work, you must add it using Shader Graph or hlsl code.
You can find easy examples of implementing dithering in DitherShaderGraph and in DitherTest.shader file, and dither function to use in code is included in file called Dithering.hlsl

Fade game object/Easy Transparency
To use this package you do not need to modify any shaders, you can use default urp shaders.

Pros:

  • no need to make custom shaders

Cons:

  • shadows disappear when object is faded
  • faded object may look weird becouse of the transparency sorting

Hello there,
thank you for this amazing asset and made the “base” version for free :slight_smile:

I’ve an issue with the Synty’s Polygon Nature shader

Material 'PolygonNature_Tree (Instance)' with Shader 'SyntyStudios/PolygonTrees' doesn't have a float or range property '_AlphaClip'

I try to add an _AlphaClip exposed variables (in ShaderGraph) but I still getting the error, can you help me to solve this issue? :eyes:

The exposed variable reference need to be ‘_AlphaClip’, not the name.

Hi
I’ve installed the free version and I can’t get it to work, or even show an error. Nothing happens. I’ve attached the Easy Object Fade script to the main camera. Here are my settings:

8417244--1113207--upload_2022-9-5_19-31-39.png

However when the player moves behind any object, nothing happens. The player is blocked and the blocking object doesn’t become transparent.

I’m using a Synty pack.

Any ideas?

You must change the materials of the models to custom materials provided by the asset. Please read readme file.

With Synty’s material is a real mess, especially if you use URP, reason why I just disable the tenderer from the gameObject. ¯_(ツ)_/¯

I just downloaded your free package to try it out and everything is that ‘error’ pink. I’m very new to shaders. Any ideas?

Nevermind. These steps fixed my problem: Textures and Materials turn pink after installing and activating lightweight render pipeline - Questions & Answers - Unity Discussions

Awesome asset btw

Since this is free, here’s my contribution:

Bug fix - parent MeshRenderes were being discarded, never being added to the list meshRenderers. Change this case statement to to:

case MeshDetectionType.UseOneMeshRenderer:
    MeshRenderer mr = hitCollider.GetComponent<MeshRenderer>();

    if (mr == null)
    {
        mr = hitCollider.GetComponentInParent<MeshRenderer>();
    }
    else if (mr == null)
    {
        mr = hitCollider.GetComponentInChildren<MeshRenderer>();
    }

    if (mr != null)
    {
        meshRenderers.Add(mr);
    }

    break;

I came across this today, and was disappointed the transparent one has been depreciated… NOooooooooo