Archived

This topic is now archived and is closed to further replies.

DJSnow

best way to do reflection on complete scenes !?

Recommended Posts

DJSnow    100
hi. i''m wondering about what the best way is, to do reflection on bigger/more complex scenes. i need to program a small demo, which''s scene includes several reflective objects of different kinds (metal, polished wood, stone/marmour); the complete scene consits of something about 90 meshes, and 30/35 of them are reflective. now i''d like to ask if anyone has already experience with such scenarios ? DJSnow --- this post is manually created and therefore legally valid without a signature

Share this post


Link to post
Share on other sites
ironfroggy    122
You have several options. You could:

1) Render (perhaps low-poly) the whole scene for each reflecting surface.
2) Render the reflections for a low-poly LOD deformation of the reflecting models, mapping the reflected scene to the addition polygons of the original model.

But, I don't have a lot of expirience with this, so hopefully better advice will also be given.

[edited by - ironfroggy on January 23, 2004 2:45:55 PM]

Share this post


Link to post
Share on other sites
Pseudo    100
First of all, how many of the 30/35 reflective mesh''s will be on screen at any point in time? Raster graphics are not good at doing dynamic reflections, so you dont want too many on the screen at once. Now on to how I would do it.

1) Buy a high end video card.
2) For each reflective object in the scene THAT IS GOING TO BE VISIBLE:
3) Render a cube map centered on the object. Yes that means drawing the scene again 6 times into the faces of a cube texture. dont draw the object and dont include reflections in the cubemaps (otherwise it will be recursive)
4) Render the scene from the cameras perspective using cube-map reflection on the objects that reflect.

Things to note about this method:
* It''s going to kill you fps because of bandwidth issues if you have more than like 1 reflective thing on the screen at any given frame.
* you could setup a priority queue so you only re-render cube-maps every so often. maybe one per frame. This will make the reflections look laggy if stuff is moving around, but its better than low fps
* if you dont need dynamic reflections, then just render a cubemap/spheremap once per object, and dont update each frame. this would be fast, and would work with lots of reflective objects, but wouldn''t look as good in a dynamic scene.
* if this demo doesn''t have to be realtime (ie, if you''re making a movie out of it) then render it using a ray tracer because they are much better at reflections/refraction.

-Hope that helps.
Brandon

Share this post


Link to post
Share on other sites
DJSnow    100
@anonymou poster:
it seems that you have pressed the enter key a little bit two fast, two times ?! *g*

@pseudo:
>>First of all, how many of the 30/35 reflective mesh''s will be
>>on screen at any point in time?
this would i rate between 10 - 15 objects, but in worst case all (e.g., if you leave the "demo room") - here, a more detailed description on the scene:
it''s a small chapel, with reflective things on the walls; a marmour ground, an organ with polished wood in the front, an altair (stone) and such stuff.
normally it''s intended to be "stepped only from inside" - but, there is no coll.-detection in the demo, so it''s possible that the camera is stepping outside this chapel; in this case all objects are visible, as you can guess.

but, you brought in a very interesting issue: "dynamic" - in my first post, i haven''t thought about this; but, i think a nice faked method, without dynamic calculation, would useable if it looks not bad - the biggest problem with the dynamic cubemaps is:
there are four torches on the walls (particle systems) which are dynamic (as you can guess); and recalculating the cubemap in realtime (!) is heavy expensive, i assume ?
but: the nice torches and their reflecting fire would have been lost, if i use a fake method - but perhaps it may look not bad ?(do not know, to be honest)

>>1) Buy a high end video card.
uuhhmmm....i was targeting at something like GF3 ?!?! (It''s a presentation for my current job application''s, and i think it''s a bit high to require a potential employer to provide a PC with a Radeon9800 for my interview ??


>>* if this demo doesn''t have to be realtime
no no, it is realtime.

>>if you dont need dynamic reflections, then just render a
>>cubemap/spheremap once per object, and dont update each frame.
>>this would be fast, and would work with lots of reflective
>>objects, but wouldn''t look as good in a dynamic scene.
ah yes, as i assumed above in this small reply. I think i have to try it out, because - as said - the fire of the torches would look really very ultra hardcore cool, if it would be reflected

i think that cubemap thing *could* work; if it''s not dynamic.

ok, one question, at last:
reflections are very hard to calculate, but looks very realistic; but: is it possible to use another "nearly reflective" method, perhaps - i have seen some of those "environment mapping" demos, running smooth even on PIII500/TNT; may it be possible to use such a method ?







DJSnow
---
this post is manually created and therefore legally valid without a signature

Share this post


Link to post
Share on other sites
treething    122
Here is a method you can use to cut down the number of renders you need to do:

http://cgi3.tky.3web.ne.jp/~tkano/paraboloid.shtml

So for each object (IIRC) you only need 2 renders, instead of 6 for a cube map.

If you have a lot of texture memory to spare then for each object you could render all the static geometry into a map that you just reuse each frame. Kinda like an impostor. So for each object each frame you just render a quad into each of the reflection maps with the static geometry texture. Then render any dynamic stuff (eg torches) over that.





Share this post


Link to post
Share on other sites
Pseudo    100
What I described before IS environment mapping. It''s actually cubic environment mapping. You can also do spherical and dual porabaloid environment mapping as well. Cubic looks best because of less distortion, so if your hardware supports cubic textures I would definately use this. As for the fire, I think having them non-dynamic would still look good. If you want to run on a GF3, you will not have enough power to render them dynamically anyways. One idea that you could try is to render maybe 2 or 3 static cubemaps for each object at load time. In each one have the fire particles animated differently, then when doing the environment mapping, simply pick a random cubemap to use each frame (per object). This would sorta make them look dynamic without having to render cubemaps each frame.

Share this post


Link to post
Share on other sites
GamerSg    378
Although i have never done any reflections before, i have read up about tricks on how to deal with them.

As Pseudo said, you could try having 2-3 cubemaps with different fire particles. Then you could just cycle through them, something like a GIF animation.

Another less memory consuming and better approach could be this.

For every reflective Object:
Have a base cubemap, which is generated at load time and contains all static geometry(non-moving).
Every frame, copy the base texture into another cubemap and just render dynamic objects onto it.

This way you are only rendering the dynamic objects for each object every frame.

However if im not mistaken, cube maps are just textures and don''t store depth information, so it is possible that the dynamic particles will show even if they are being obstructed.
This could be solved by saving the base depth buffer into another texture and loading it into the depth buffer before rendering your dynamic objects.

Share this post


Link to post
Share on other sites
felix-the-maw    122
just a question, are reflective object supposed to reflect each other reflection (think of 2 mirror face to face)? in this case, leave rasterizers a run to raytracing

_Maw-ware_, en francais dans le code.

Share this post


Link to post
Share on other sites