HDRP Material Transparency Integration with Object Fader - Character is Always Transparent - Change from Opaque to Transparent on Runtime or what?

Jedi

New member
Greetings,
I have run into a block near the beginning of setting up my scene and learning opsive. Im trying to use the HDRP because im also using Gaia and everything looks better with HDRP. I am told that When you switch to HDRP; for the object fader to work, the material has to be set to Transparent. If it is Opaque and we try to zoom in with right click on a 3rd person perspective; the character disappears completely. When it is set to transparent, it dosent fade at all; it remains as it was before right clicking. if it is already partially transparent; it remains at the same transparency on zoom.

When it is set to Transparent; the character is always kind of transparent; even with the Alpha Channel at 100% or 255. You can not see the background through the character; but you see the other side of the figures body.

I have asked Justin in PM's to help with this; and found no solution yet. The last question I asked was:
> can the script be adjusted to work with Opaque settings?

Justin Replied: No, in order for the Object Fader to work you must have a material which can fade, which are transparent materials. This is a requirement of the material and not the Object Fader. I haven't played with HDRP enough to know if there is a built in shader which does z sorting with a transparent material.

> ok so what i think your talking about is the Z - Index or layering of separate objects. This is handled by the "Sorting Priority" field in the Transparent HDRP.

This is useful for making the eyeballs disappear behind the head; and the clothes to not appear behind the character; (i set the eye moisture spheres to -5 and the head to +1 and the eye spheres disappeared) but it does not solve the issue of the other side of the same object being visible.

As I continue to spend many hours trying to solve this issue: I have read the above linked unity documentation about the HDRP Transparent Settings; and gone through each of them testing to see if it has any effect.

By doing so I found the "Depth Write" setting makes the transparent Material become completely solid, so you cannot see the other side of the figure when it is checked. The "Double Sided" field also has a effect on the solidity.

Now the issue that remains is that when I zoom in with right click in a 3rd person perspective; the figure remains solid. It dosent become partially transparent like it is supposed to. With the Transparent Surface Type on a HDRP/Lit Material Shader: And When Depth Write is checked: When you adjust the Alpha Channel in the Base Map Color Chooser, it becomes more transparent. So the Transparent Surface Type has the ability to fade. With the Opaque Surface Type; the Alpha Channel slider has no effect, the opaque is completely solid and cannot fade as Justin was explaining in his responce to my last question. Opaque means light cannot pass through it; it is not transparent; it is solid.

So my question is: Can we adjust the code somewhere so that it recognizes the Alpha Channel of the Shader HDRP/Lit with Transparent Surface Type? Perhaps in the Cameras: Object Fader (Script)? Is that script currently set to only recognize non HDRP Shaders? Or what is your ideas for a solution?

I also found this thread: where they conclude that a way to solve this issue is to switch between opaque and transparent Surface Types in Runtime to make the semi transparent ghost/stealth effect happen. But I think since i found the Depth Write setting; that we can just adjust the Transparency Alpha Channel to give the same effect.

However in the thread below it also says that when they try to dynamically change the Alpha Channel transparency of a object with code at runtime; it dosent work. That is the original question in the thread. At the end this guy gives the solution as changing from opaque to transparent in Runtime and gives the code solution:

HDRP - Make surface transparent in runtime​


Came across this with a similar issue after switching to HDRP. I have a character with several armor slots that sometimes get textured by the equipment and wanted to add a stealth effect that made you transparent. anyways after reading this i worked out the following if it helps anyone else:

Code (CSharp):

  1. //material with transparent surface type and .5 a, set in inspector
  2. public Material Transparent;

  3. private bool isInvis;
  4. //well trigger our "stealth" through a property on the player script
  5. public bool IsInvisible
  6. {
  7. get { return isInvis; }
  8. set
  9. {//we are invisible
  10. if (value)
  11. { //changableMaterials is set in start from the players render mesh materials and copied to DefaultMaterials (specifically for equipping gear)
  12. for(int mat = 0; mat < ChangableMaterials.Count; mat++)
  13. {
  14. //be sure to change the texture before copying
  15. Transparent.mainTexture = ChangableMaterials[mat].mainTexture;
  16. ChangableMaterials[mat].CopyPropertiesFromMaterial(Transparent);
  17. }
  18. }
  19. else
  20. {
  21. for (int mat = 0; mat < ChangableMaterials.Count; mat++)
  22. {
  23. var temptexture = ChangableMaterials[mat].mainTexture;
  24. ChangableMaterials[mat].CopyPropertiesFromMaterial(DefaultMaterials[mat]);
  25. ChangableMaterials[mat].mainTexture = temptexture;
  26. }
  27. }
 
HDRP is still being actively developed by Unity so the feature that you are looking for may simply not be available yet. With that said, the ObjectFader.FadeMaterial method does the actual fading so you could try adjusting that method to get it working.

The code from the thread that you linked to just copies the properties from a material and doesn't dynamically adjust the fading.
 
Ok I will try that with the HDRP Scene I had set up. Where exactly would I find the "ObjectFader.FadeMaterial method"?

Have you tested this fade working in a scene you set up with Opsive in HDRP ?

What about the Universal Render Pipeline? Can I use that with Opsive?

Thanks have a good day.
 
Top