Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Planar Reflections issue with non-standard shaders using transparency #1147

Closed
2 tasks done
Revmatek opened this issue Apr 5, 2024 · 13 comments
Closed
2 tasks done
Milestone

Comments

@Revmatek
Copy link

Revmatek commented Apr 5, 2024

Is there an existing issue for this?

  • I have searched the existing issues.

Have you checked the documentation to resolve your problem?

  • I have read the linked documentation and could not resolve my issue.

Current Behavior

Planar reflections texture does not show custom shaders / transparency. It may be custom shaders in general if I recall. I think it works for most standard shaders.

Note: that the palm leaves are not visible in the reflection.
image

My primary concern for this is the tree leaves not showing up. This example has hidden shaders on the tree which I cannot redo easily. The example light blue cube is something I can modify to add support if that is possible.

Expected Behavior

There should be some sort of way to add support for transparency in custom shaders (seems to work fine for Standard Shaders with transparency, which may exclude all forms of tree shader)

Steps To Reproduce

  1. Create a scene with Planar reflections
  2. Add some objects using custom shaders and transparency or Speed Tree (or similar Tree Creator shader)
  3. Observe missing reflections
    image

Unity Version

2021.3.26

Crest Version

4.19

Render Pipeline

Built-In

Editor or Standalone

Editor (Edit Mode), Editor (Play Mode), Standalone

Environment

No response

Anything else?

Filling this out here while investigating other issues, this was in my backlog, not terribly important but probably a bug somewhere. I investigated it a one point and ended up in a shader somewhere that was applying transparency to the planar reflection texture or something... I don't recall the specifics. I am not sure if there is some workaround to this I am unaware of, something I need to add in the shaders perhaps.

@daleeidd
Copy link
Collaborator

daleeidd commented Apr 6, 2024

Does changing the Clear Flags to Skybox solve it?

@Revmatek
Copy link
Author

Revmatek commented Apr 6, 2024

Does changing the Clear Flags to Skybox solve it?

Changing the Clear Flags does not seem to have an effect. The clear flags for the image above is with Skybox.

@daleeidd
Copy link
Collaborator

daleeidd commented Apr 7, 2024

Is that on the OceanPlanarReflections script? Otherwise can you remove the * saturate(refl.a) and see if it improves from the following line:

io_colour = lerp(io_colour, refl.rgb, _PlanarReflectionIntensity * saturate(refl.a));

@Revmatek
Copy link
Author

Revmatek commented Apr 7, 2024

OceanPlanarReflections

This is OceanPlanarReflections script, yes. Disabling saturate does have an effect and makes the tree leaves appear, but causes other more obvious problems with reflections / darkness on the surface
image
image

@daleeidd
Copy link
Collaborator

daleeidd commented Apr 7, 2024

That image looks like OceanPlanarReflections > Clear Flags is not set to Skybox. Unless your skybox does not write alpha which would be strange. Try testing with Unity's procedural skybox.

@Revmatek
Copy link
Author

Revmatek commented Apr 7, 2024

That image looks like OceanPlanarReflections > Clear Flags is not set to Skybox. Unless your skybox does not write alpha which would be strange. Try testing with Unity's procedural skybox.

It seems unrelated to the skybox. I tried it with default and a few others. Doesn't change. It also does not seem related to OceanPlanarReflections being on
image

@daleeidd
Copy link
Collaborator

daleeidd commented Apr 7, 2024

Can you provide a screenshot of the OceanPlanarReflections component?

@Revmatek
Copy link
Author

Revmatek commented Apr 7, 2024

Can you provide a screenshot of the OceanPlanarReflections component?

image

@Revmatek
Copy link
Author

Revmatek commented Apr 7, 2024

Can you provide a screenshot of the OceanPlanarReflections component?

Well I guess that solves that mystery. I was not aware you were referring to Clear flags on this script vs the camera.
image
image

image

Thanks for the help!

@daleeidd
Copy link
Collaborator

daleeidd commented Apr 7, 2024

No worries. Does it work correctly if you remove the reflection alpha modification?

@Revmatek
Copy link
Author

Revmatek commented Apr 7, 2024

No worries. Does it work correctly if you remove the reflection alpha modification?

Yes, it does appear to be working correctly now.

image
It does seem to wash out a bit after I stop moving the camera but it is mostly fine. Definitely an improvement.
image

Seems to depend on the angles and only with trees
image
image

I'm not sure why there is a distinction between the transparency in the standard shaders and the custom / tree shaders, obviously depends on what each shader is doing I guess.

@daleeidd
Copy link
Collaborator

daleeidd commented Apr 7, 2024

Perfect. That could be a combination of fresnel and colours blending.

I'll make Skybox the default as prefer to have things work over an optimisation. I'll document this in the tooltip and somewhere in the documentation too.

@daleeidd daleeidd added this to the 4.20 milestone Apr 18, 2024
@daleeidd
Copy link
Collaborator

Fixed in 4.20.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants