Real-time Reflections

As a side effect of my current endeavour, real-time reflections …

[video]http://www.youtube.com/watch?v=66pKCf5m4Ng[/video]

(720p or die)

7 Likes

So cool :slight_smile:

nice

awesome, I assume this uses standard dynamic cube mapping? If so then you should be able to get real-time refraction as well (literally 1 line change in frag shader) :slight_smile:

Replace your reflect line with something like:

[java]refract (incident, n, 1.5);[/java]

1.5 is around the refraction index of glass, but this can be changed to suit needs

Hey! This is super cool! Will you contribute it to ShaderBlow lib?

@wezrule cool idea! yup normal dynamic cube map.

@mifth it’s not a suitable candidate for contribution, it uses a bunch of extra cameras and junk.

@thetoucher said: @wezrule cool idea! yup normal dynamic cube map.

@mifth it’s not a suitable candidate for contribution, it uses a bunch of extra cameras and junk.

As far as i know RealTimeReflection cumputation uses 6 cameras. If you use this account, so it’s ok for contribution :slight_smile:

yes it uses 6, and is quite an expensive technique so shouldn’t be used with too many “reflection” objects (i.e monkey heads) at once. You might be able to limit the fov of the reflection to the front of the object for instance and use dummy textures for the rest of the cube map, which would be less expensive. I look forward to this contribution :slight_smile:

There’s also static cube maps which are a lot cheaper (although not real-time)

@wezrule said: yes it uses 6, and is quite an expensive technique so shouldn't be used with too many "reflection" objects (i.e monkey heads) at once. You might be able to limit the fov of the reflection to the front of the object for instance and use dummy textures for the rest of the cube map, which would be less expensive. I look forward to this contribution :)

There’s also static cube maps which are a lot cheaper (although not real-time)

Half-Life 2 has realtime reflections. I guess it would be good contribution anyway…

I didn’t disagree :slight_smile: I just said its expensive, and if u don’t need full 360 views it gets cheaper.

You can also implement realtime local reflections as a post process in screen space if you have a normal and depth buffer available. Should work for subtle reflections on water and glossy floors etc, although it is quite expensive…

<cite>@kwando said:</cite> You can also implement realtime local reflections as a post process in screen space if you have a normal and depth buffer available. Should work for subtle reflections on water and glossy floors etc, although it is quite expensive..

Theres another downside, only objects on screen can get reflected in a post process. Might look strange depending on the surface, but would work nicely to simulate slight reflections on wet streets. But i don’t know how expensive post process raytracing is

<cite>@mifth said:</cite> so it's ok for contribution :)

LoL damn you @mifth! I thought I got out of this one. I will branch my code here and come back later, strip out the other stuff I’m working on and either contribute directly, or share the realtime cubemap code and let you do the hard work :wink:

2 Likes
<cite>@zzuegg said:</cite> Theres another downside, only objects on screen can get reflected in a post process. Might look strange depending on the surface, but would work nicely to simulate slight reflections on wet streets. But i don't know how expensive post process raytracing is

Yes, that is true.

@thetoucher said: LoL damn you @mifth! I thought I got out of this one. I will branch my code here and come back later, strip out the other stuff I'm working on and either contribute directly, or share the realtime cubemap code and let you do the hard work ;)

Hey! That would be super cool!
The ShaderBlow project is hosted now in Official JME Contributions:
https://code.google.com/p/jmonkeyplatform-contributions/source/browse/#svn%2Ftrunk%2Fshaderblowlib%2FShaderBlow

If you have no commit access just ask @normen to add you there. I really appreciate your contributions!

cool :slight_smile: and if u manage to get refraction working, then u might be able to combine them into 1 filter and have a uniform bool to swap between them. The RefralectFilter ^^

for the water filter I use only one additional camera that renders the reflection. but this only work with plane reflective areas.
There is no way around the 6 cams setting if you want that kind of effect on a complex area.

It can be expensive because the scene is rendered multiple times, but, the rendered images don’t have to be full resolution (even 512x512 textures can give very good results IMO).
I guess it’s used a lot for car games, where cars have dynamic reflection.