Obstructing Objects Fader - Object Fader Component

AnubisWolfman

New member
Hi.

When obstructive objects are faded (in context of the Camera component - "Object Fader"), is there a way to choose a percentage of the alpha color (invisibility) without changing the source code ? Sometimes I think it looks better if some of the obstructing Objects can be slightly seen, instead of completely disappearing, and it also shows the player that is supposed to be some object in that location.

I made a small modification in the source code, but is not the correct way to do it, at the least because of the UCC updates and such.
Anyway, would it be a feature that you consider adding in another version ?

1546660155408.png

If anyone interested here are the lines I added to the ObjectFader class (ObjectFader.cs) to be able to choose a "level of invisibility" for the objects.

Note: VALUE_OF_INVISIBILITY is a inspector float variable i created which I gave the value of 0.30f (I find it balanced and the character can be perfectly seen)

I changed the line in the method "FadeObstructingObjects(bool immediateFade)" from:

RemoveObstructingMaterial(i);

to:

if (m_ObstructingMaterials.color.a >VALUE_OF_INVISIBILITY )
{

RemoveObstructingMaterial(i);
}


and in the method "FadeMaterial" I changed:

var targetAlpha = color.a + (fade ? -1 : 1);

color.a = Mathf.Clamp01(immediateFade ? targetAlpha : Mathf.Lerp(color.a, targetAlpha, m_FadeSpeed));


to:

var targetAlpha = color.a + (fade ? -1 : 1);

if (fade == true && material.color.a <= VALUE_OF_INVISIBILITY )
{
return false;

}

color.a = Mathf.Clamp01(immediateFade ? targetAlpha : Mathf.Lerp(color.a, targetAlpha, m_FadeSpeed));
 
Top