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:
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):
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):
- //material with transparent surface type and .5 a, set in inspector
- public Material Transparent;
- private bool isInvis;
- //well trigger our "stealth" through a property on the player script
- public bool IsInvisible
- {
- get { return isInvis; }
- set
- {//we are invisible
- if (value)
- { //changableMaterials is set in start from the players render mesh materials and copied to DefaultMaterials (specifically for equipping gear)
- for(int mat = 0; mat < ChangableMaterials.Count; mat++)
- {
- //be sure to change the texture before copying
- Transparent.mainTexture = ChangableMaterials[mat].mainTexture;
- ChangableMaterials[mat].CopyPropertiesFromMaterial(Transparent);
- }
- }
- else
- {
- for (int mat = 0; mat < ChangableMaterials.Count; mat++)
- {
- var temptexture = ChangableMaterials[mat].mainTexture;
- ChangableMaterials[mat].CopyPropertiesFromMaterial(DefaultMaterials[mat]);
- ChangableMaterials[mat].mainTexture = temptexture;
- }
- }