Sign in to follow this  
Gyiove Sparkle

Best reflection method

Recommended Posts

Hello everyone.

Im developing game engine from scratch and im looking for best reflection method. 
I know 2 for now.

One is called dynamic cube mapping, basically you took 6 images from the center of object ... ( and yeah, you're doing it for each object in game... )
Thats pretty bad one. Terrible in my eyes.

First reason will be that it takes too much cpu power and well.
For example object can't get reflection from itsself.

Im not meaning that one:

 

object 1 < --- > object 2
( if you look at the object 2 you can see object 1 but not object 2 from object 1 )
It is possible to do it by i guess, taking those 6 images 2 or more times for each object and thats ... not going to comment that.
 

If i would go with that solution then if i have to take those cube map images then i have to hide the object itself what would mean that if

the object is complicated shape like for example infinity symbol then there will be some faces parallel to each other and it would be realistic if those 2 faces reflect the light to/from each other but in that way it will never going to happen.

The ohter one is the ray tracing way. It is new for me and i haven't yet tried that but i think ray tracing graphic for now is only for prerendering not for real time am i right?

So i think i may need something else here. Any ideas?

 

Share this post


Link to post
Share on other sites
Yeah I think one of the most common solutions on this generation of games will be to use a lot of cube-map "probes" around the level, but combine those results with screen-space reflections (ray-tracing through the depth buffer) to add in self-reflection and other local details.

In the future, we'll probably see ray-tracing through voxel representations of the scene become popular (partially resident sparse voxel octrees, etc).

If your reflective object happens to be a flat plane, then old-school planar reflections are tried and tested there :)

Share this post


Link to post
Share on other sites

Technically we don't necessarily need voxel representation of the scene, you can use standard triangular representation of the scene, good quality BVH and perform ray tracing (assuming you do deferred rendering, you really just need to perform ray tracing of secondary rays). This way you achieve good quality hard reflections (of course you can change them into smooth reflections - either by using some "smart" blurring (you need to take edges into account ofc) or "use more rays").

Share this post


Link to post
Share on other sites

if the reflected scene does not move, you can prerender the cube, and after cube is rendered over the surface of reflecting object render additional dynamic possible aproachers, that will be depth tested only with each other if there are more than one (cube should be always occluded- it can bring an artefact - that will very rarely- impossibly perform though).

 

Though this may sound as a radical optimization, it is still an untrivial operation. Though you can make cube texture of very friendly dimensions (256x256) .

 

But as you appointed, cubes can fit only some unimpressive scenarios (metalic pen?).

 

If you wanted to have a big reflective wall, and player looking at a small portion of the wall that covers his entire screen, cube maps are useless.

Robust reflection can be achieved only by rendering mirrored (repositioned) object of scene onto observing render target once again.

If you are facing a reflector that is not of planar surface, you might try mirroring every object of scene on each triangle plane, but before issuing rendering, check the AABB of mirrored object covering the triangle area (done on CPU trivialy)- this could bring a pretty acceptable aproach as you would filter quite a bunch of renderables in my eyes, making a quite equal fillrate over reflecting surface.

Share this post


Link to post
Share on other sites

 

this could bring a pretty acceptable aproach as you would filter quite a bunch of renderables in my eyes, making a quite equal fillrate over reflecting surface.

though! I am not realy encouraging you to perform resolved reflection on a unplanar surface (you should not do it- you still can do planar reflection of observation in world, and refract unaccurately (but exactly) on a shaped reflector).

 

I stress that reflecting to observed scene is far from trivial- from computaion resources especialy - it is actualy dislaying scene you do not look at- in scene you look at

Edited by JohnnyCode

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this