How to get non-planar ground reflections with a realtime cubemap?

Started by
2 comments, last by WhateverMan 8 years, 6 months ago

Hello, I recently played NFS U2 and noticed that the road reflections are quite accurate, compared to SSRR methods. It's mighty fast aswell, since I can play the game maxed out on a laptop, while SSRR is quite impossible on a laptop. I'm writing code(C#) and shaders in Unity 5 if thats important to point out.

So here is a video I found on youtube wich describes the reflections quite well:



My personal guess is that there is a small mix of screenspace rendering and a cubemap going on? Because I tryed a mirrored cubemap rendering method and the results were not as good. Infact they were terrible. I had 2 different results, one of where the reflected ground was hanging way beyond the reflection plane and the other had some normal issues, but was more accurate. Both required a cliping point input wich I calculated with a raycast under the camera. Not the best way to do it, but it worked for testing.

Here is a Unity3d link for the mirrored cubemap renderer method (not mine but the basics are the same):
http://twiik.net/projects/realtime-reflection-example-scene

Here are some screenshots I took from the video, on the left is the original and on the right is the mirrored view, for comparsion.
nfsu_mirror_1.jpg

nfsu_mirror_3.jpg

Another guess would be that there is some sort of a rendering matrix, and the rendered image is wisely placed along the surface?!

And exucuse me for my bad descriptions, english is not my natural language and my grammar might be of.

Advertisement

It's look planar reflection. You just need to aproximate road under the car and 25-50 meter front of it as a single plane. Could this work for you?

This is what I did and I got some awkward results, I'm thinking it's because of some normal's are not properly calculated in the shader. This is my result:
Unity_Ground_Reflection.JPG

As you can see the reflections are quite messed up by the normals

And here's a quick example of the "working" method.

As you can see it's far from perfect, the reflections jump from time to time, because of the ray checking for the road beneath. And the main problem with the normals, sometimes the reflections get "cut" from their original reflection direction.

This topic is closed to new replies.

Advertisement