Investigations on Realtime Reflections in Unity

Show off your mod creations or just a work in progress.
User avatar
Nystul
Posts: 863
Joined: Mon Mar 23, 2015 8:31 am

Investigations on Realtime Reflections in Unity

Postby Nystul » Sun Sep 13, 2015 9:01 pm

----------------------------------------------------------------------------------------------------------------------------------------------------------

Realtime Reflections mod is now available as standalone mod using the new mod system:

get it from this thread:
viewtopic.php?f=22&t=456&p=4541#p4541
----------------------------------------------------------------------------------------------------------------------------------------------------------

I was investigating (realtime) reflections in unity the last couple of weeks since I plan to do a reflection mod.

things that would be nice to have ingame:
  • water reflections for water terrain tiles near the player (should be possible)
  • floor reflections (should as well be possible)
  • outdoor window reflections (may be possible with some restrictions)
  • reflections on every wall (pretty impossible to make it work correctly I fear)
I took a look at:

These are my findings on the different techniques in interplay with DFTFU:
All techniques are not cheap in terms of performance, but some are more performant than others, see below:

Planar Reflections:
pros:
  • correct reflections on a plane
  • good quality
  • runtime performance is acceptable
cons:
  • custom shader required (not working with standard shader out of the box)
  • every seperate reflection plane needs an additional render to texture pass (although it is possible to share the rendertextures in reflective surfaces on the same extended virtual plane to a certain degree and even on parallel planes with the same surface normal )
see a screenshot with dummy reflection quads:
Image

Realtime Reflection Probes:
pros:
  • out of the box support of standard shader and unity pipeline (no custom shader necessary)
cons:
  • poor runtime performance (one realtime probe is basically the max already)
  • poor quality
  • per probe only one reflection plane for which reflections are correct (so can effectively only be used for correct floor reflections)
see this screenshot:
Image

Custom Reflection Probes:
pros:
  • out of the box support of standard shader and unity pipeline (no custom shader necessary)
  • acceptable quality
cons:
  • runtime performance better than realtime reflection probes but still not good
  • per probe only one reflection plane for which reflections are correct (so can effectively only be used for correct floor reflections)
see this screenshot:
Image

Screen Space Reflections (ssr):
pros:
  • out of the box support for unity pipeline
  • pretty good runtime performance (everything is done in the fragment shader)
  • reflections in all directions
cons:
  • requires deferred shading
  • ssr method inherent limitations (missing information is the biggest issue)
  • only works indoors well enough (outdoor reflections are mostly wrong due to missing information)
  • heavy artifacts with daggerfall's billboards (see torch and npc reflection in the screenshot)
see this screenshot (please ignore the incorrect shadows on the floor - these are independent of the ssr - i forgot to switch off the sunlight):
Image

There is no best technique as you can see. While it is possible to mix ssr and reflection probes it is not possible to do the same for planar reflections and reflection probes as it seems.
I may go for planar reflections outdoors (since they are the only technique that might allow for the window reflections) and custom reflection probes indoors.
ssr will be a viable option indoors once all billboards have a model replacement...

The nice thing about the reflection probes is that they are fully integrated in the workflow - you can tweak the parameters inside the editor, e.g. smoothness adjustment:
smoothness 1.0:
Image
smoothness 0.8:
Image

So hope it was an interesting read!
I will keep you informed when there is more progress!
User avatar
LypyL
Posts: 474
Joined: Sun Mar 22, 2015 3:48 am

Re: Investigations on Realtime Reflections in Unity

Postby LypyL » Sun Sep 13, 2015 10:48 pm

Just....WOW! Holy @#$%! :D That reflective floor in the mages guild looks incredible.
User avatar
Interkarma
Posts: 1942
Joined: Sun Mar 22, 2015 1:51 am

Re: Investigations on Realtime Reflections in Unity

Postby Interkarma » Sun Sep 13, 2015 11:06 pm

Well that's fairly stunning. I love the mage guild floors also. Great work!
User avatar
Arl
Posts: 169
Joined: Sun Mar 22, 2015 10:57 am

Re: Investigations on Realtime Reflections in Unity

Postby Arl » Tue Sep 15, 2015 3:04 pm

This is getting fancy, I like it!
My Deviantart page, I have some Daggerfall stuff in there.
User avatar
Nystul
Posts: 863
Joined: Mon Mar 23, 2015 8:31 am

Re: Investigations on Realtime Reflections in Unity

Postby Nystul » Tue Sep 15, 2015 4:11 pm

hmm buildings with a 2nd floor are a big problem for reflection probes... maybe I should give planar reflections a try indoors as well...
User avatar
Arctus
Posts: 40
Joined: Mon Mar 23, 2015 12:28 am

Re: Investigations on Realtime Reflections in Unity

Postby Arctus » Tue Sep 15, 2015 4:48 pm

Getting fancy. I'm assuming nothing is reflected for the player though, correct?
User avatar
Nystul
Posts: 863
Joined: Mon Mar 23, 2015 8:31 am

Re: Investigations on Realtime Reflections in Unity

Postby Nystul » Tue Sep 15, 2015 6:13 pm

Arctus wrote:Getting fancy. I'm assuming nothing is reflected for the player though, correct?

you are assuming right. I will be happy if I can get it to work even without the player ;) there are lots of unsolved problems and every approach has its issues :(
User avatar
Nystul
Posts: 863
Joined: Mon Mar 23, 2015 8:31 am

Re: Investigations on Realtime Reflections in Unity

Postby Nystul » Thu Sep 17, 2015 9:11 pm

made some progress today...
reflected billdboards are a bit too dark in contrast to reflected models - no idea where that comes from.
(the texture seams are caused by my dated graphics card)

Image

Image

Image

Image
User avatar
Interkarma
Posts: 1942
Joined: Sun Mar 22, 2015 1:51 am

Re: Investigations on Realtime Reflections in Unity

Postby Interkarma » Thu Sep 17, 2015 9:50 pm

Wowsers! That is looking HOT!
User avatar
Arl
Posts: 169
Joined: Sun Mar 22, 2015 10:57 am

Re: Investigations on Realtime Reflections in Unity

Postby Arl » Thu Sep 17, 2015 9:56 pm

Did my eyes just met an ilusion?
Can this be for real?

If I'm in a dream, don't wake me up!
If I'm awake, don't put me to sleep!

(I'm trying to say that this is beyond awesome).
My Deviantart page, I have some Daggerfall stuff in there.

Return to “Creator's Corner”

Who is online

Users browsing this forum: No registered users and 1 guest