Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
134 stars 2 forks source link

fresnel transparency for ReflectionMaterial #2739

Open ThomasSteve83 opened 1 month ago

ThomasSteve83 commented 1 month ago

Is your feature request related to a problem? Please describe.

i wish i could create fresnel-accurate reflections for semi-reflective surfaces using mirrors, but there's no good way to to so, and reflection probes and screenspace reflections are just too limited for a lot of cases

Describe the solution you'd like

i have two solutions to propose for this, one simpler (and easier to add quickly), and one better (way better for the long term)

the simple one is a float property (suggested name: fresnelMagnitude) on the existing reflectionmaterial that makes it some amount transparent or black when looked at head on, but almost normal when looked at from a sharp angle (perfectly normal at 90deg, but that's normally impossible to see), using existing fresnel calculations

this could be used with a mirror set to additive blending on top of a pbs_metallic surface (with smoothness set to 0 to avoid extra reflections) to achieve a surface with high quality fresnel-accurate reflections and support for all other pbs_metallic functionality this would still work with transparent surfaces, allowing for extremely realistic p(l)anes of glass

the better one is a new material that mostly renders as pbs_metallic, but uses the behaviour of a reflectionmaterial for all specular reflections it would have the properties of both materials as necessary this one importantly should be able to fall back to normal pbs_metallic reflections (reflection probes, ssr) for performance and compatibility reasons, so a bool on the material and a global override in graphics settings maybe?

Describe alternatives you've considered

screenspace reflections are really cool, but very low in resolution and can't be used as mirrors (they can only reflect screenspace) box projected reflection probes can only be projected to a cuboid, and can't dynamically adapt to objects in the environment

Additional Context

No response

Requesters

@thomasSteve83 - U-ThomasSteve83

lxw404 commented 1 month ago

One of the things that would make this easier is having planar reflection probes, which would allow all reflective surfaces to emulate this behavior and not just a new material designed around this specifically (if your main goal is to emulate glass panes).

For uneven surfaces and even water however, planar reflection is not quite fully accurate and this would be useful.

I also mentioned here, that with https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/654, you might very well be able to create this manually by using the output of a Fresnel material as the blend mask for other materials of a material layer, effectively reproducing this effect.

ThomasSteve83 commented 1 month ago

yeah, just looked into planar reflection probes, they seem like a much better idea if possible neither of my suggestions would work for uneven surfaces anyways, since it's the same behavior as a reflectionmaterial

654 also looks interesting, but planar reflection probes look like the way to go

ThomasSteve83 commented 1 month ago

you know what? i don't think either of the ideas i proposed or the name of this issue are relevant anymore i think planar reflection probes are definitely the way to go should i keep this issue or close it and make a new one?