Rain reflections

Feedback on past, current, and future development.
Post Reply
User avatar
Ravenwing
Posts: 172
Joined: 02 Jan 2016, 02:51

Rain reflections

Post by Ravenwing » 09 Jan 2018, 22:00

Hey all, it's a rainy day where I am and on my way to work I was thinking how cool would it be if there were reflections on the ground when it rained. How hard would it be to implement something like that? I imagine it would be some kind of spectral map toggle. The only problem I can foresee is if there is already a spectral map for a texture. Maybe there would be another suffix indicator like we use for normal maps? I think it would have to be custom made for each texture because only hard surfaces like cobblestones would reflect. Not sure exactly how all this stuff works but figured I'd throw out the idea and if people were interested I could make a feature request in the tracker for post-1.0!

User avatar
AnyOldName3
Posts: 943
Joined: 26 Nov 2015, 03:25

Re: Rain reflections

Post by AnyOldName3 » 10 Jan 2018, 00:24

For a start, spectral mapping might help when rendering ghosts and spirits, but not with puddles. I think the word you're after is specular.

We might eventually be able to support such a feature, either by using environment mapping (which will look okay, but not perfect, and isn't the hardest thing to do in the world) or by using a texture to control overlaying our water shader as a post process at some point in the distant future (as this will give real reflections, not pretend ones from a cubemap). The problem with that approach is that I'm not actually sure if the current water shader setup would break if all the water wasn't in the same plane - right now, rendering reflections isn't ridiculously complicated, but it's possible that we may need a whole extra rendering pass of everything if we support reflections in an arbitrary plane.
AnyOldName3, Master of Shadows

Chris
Posts: 1424
Joined: 04 Sep 2011, 08:33

Re: Rain reflections

Post by Chris » 10 Jan 2018, 01:47

This seems to be something PBR excels at, by utilizing Snell's law and embedding Fresnel equations with appropriate variables. That allows modifying the reflectance of any surface at run-time, for example as a result of becoming wet, while maintaining realistic light behavior.

User avatar
AnyOldName3
Posts: 943
Joined: 26 Nov 2015, 03:25

Re: Rain reflections

Post by AnyOldName3 » 10 Jan 2018, 02:41

This seems to be something PBR excels at, by utilizing Snell's law and embedding Fresnel equations with appropriate variables. That allows modifying the reflectance of any surface at run-time, for example as a result of becoming wet, while maintaining realistic light behavior.
Technically PBR is just an umbrella term for rendering based on actual physics (no matter how simplified) instead of just randomly deciding to pick a function that is fast to compute on a computer which existed in 1973 and declaring that it looked vaguely right and that we should therefore stick to it for 45 years. You can use Fresnel's and Snell's discoveries while still using Phong's reflection model for shading. You can also get reflections that change at runtime without PBR.

A really nice Cook-Torrance + Oren-Nayar reflectance system can work by reading from a specular/glossiness/roughness map (although not containing the same data as one intended for Phong reflectance shading, but instead the coefficients to be used for Fresnel equations) and using that directly, or, if a metalness workflow is used, it can read from a metalness/'dielectricness' map and compute the Fresnel coefficients itself. This is more of a physically-based material thing, and it could also be instead fed to a Phong + Lambert reflectance system. In fact, even before there were games with PBR rendering were a thing, sometimes their assets would be created with a physically-based-material workflow simply because it can be easier and then converted to a Phong-friendly format by an automated process before being included in a game.

When people say a game has PBR, they usually mean it has materials made with a PB workflow which are rendered using a physically-based reflectance model (basically meaning anything except Phong) and usually, but not always, using an image-based lighting system so that there's not a random 'ambient' lighting term in the maths. This should all mean that an engine with PBR support can do some fancy realistic lighting without it being tacked on as an afterthought, but it doesn't mean that it's the only way to get the effects you mentioned.

An example of this is that we already use Fresnel equations and Snell's law in our water shader, but instead of computing the intensity of specular/glossy highlights via a multiline microfacet-model-based complicated thing, we do it by raising a dot product to a power like Bui Tuong Phong suggested looked okayish all those years ago. All we need to do is make the shader read a couple of parameters from a texture instead of assuming all water in Morrowind is identical and therefore that using constants is fine and we get the behaviour you describe right now.
AnyOldName3, Master of Shadows

User avatar
Ravenwing
Posts: 172
Joined: 02 Jan 2016, 02:51

Re: Rain reflections

Post by Ravenwing » 10 Jan 2018, 07:41

AnyOldName3 wrote:
10 Jan 2018, 00:24
For a start, spectral mapping might help when rendering ghosts and spirits, but not with puddles. I think the word you're after is specular.
Haha it is indeed. Those would certainly have helped out in those ancestral tombs.

As for the water reflections, I don't think we need actual puddles reflecting, just something that reflects lights from spells or lanterns or whatnot similar to how car lights reflect off of wet pavement (hence why I thought of it in traffic lol). I'm sure whatever method you guys would decide to use would look awesome!

Citadel535
Posts: 2
Joined: 22 Jan 2018, 19:32

Re: Rain reflections

Post by Citadel535 » 22 Jan 2018, 21:23

I for one would love to see this especially after seeing how Fallout 4 handled it. I think the amount of graphics work to implement however would be substantial versus time implementing/fixing other issues.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests