Mirror Idea

Blitz3D Forums/Blitz3D Programming/Mirror Idea

Damien Sturdy(Posted 2005) [#1]
Hey peeps. While helping someone around here ;) write a game, I've come across an idea and put it into use.

[Heres a Screenie:]



Mirror:

1) make complete level mesh.
2) Use Big10p's mesh clipping code to crop the mesh at water height.
(http://www.blitzbasic.com/codearcs/codearcs.php?code=1143)
3) Copy this mesh and flip it, then move it up by 2xwaterheight.
4)Create water plane.

rendering:

1) Hide original mesh. Show reflection mesh. Hide water. Render
2) go down the screen using copyrect to mvoe each bit left/right a bit and up by 1, using rnd and SIN to create an alogrhythm that you like.. (up by one to fix cracks...)

3) Show original mesh. Hide reflection mesh. Show water
4)Cameraclsmode camera,0,1
Render.

Flip :D

I have something mroe advanced in the workings too involving water with full reflections but still see the bottom of the cropped mesh through water.

i will post about this later.

I know i dont have any pics or code right here, but what are your thoughs on this technique?


jfk EO-11110(Posted 2005) [#2]
Good idea. Problem is Levels usually are made of more than one Mesh. There may be interactive and animated meshes that need to be clipped in realtime - and I'm afraid that's too slow.

But it's surely worth some tests.


Damien Sturdy(Posted 2005) [#3]
Heh, its useful in some cases,

Check it out, Ive been toying with it all day :D

[edit]
screenie moved to top post

Me and Paulo did this. Ive coded the reflections since a day or so back.


jfk EO-11110(Posted 2005) [#4]
Looks nice, but why don't you use the animated water mesh we've seen lately, won't this work too?


Damien Sturdy(Posted 2005) [#5]
Ive not seen that...

Animated water? Does it reflect as above and still show the under water stuff?

Link me, I'm interested in seeing it (maybe i'm blind, but i just tried to use the search function again. *choke*)

Cheers :D


jfk EO-11110(Posted 2005) [#6]
well, it used cubic enviroment mapping with an animated water surface. It was looking just totaly cool, but it wasn't possible to put something below the water level because it was then mirrored on the top side, as seen with the standard mirror command too.

We where searching for a solution (the submarine problem) - don't remember?

Wait a minute, I'll try to find a link...

OK, from Graphics Showcase:
http://www.blitzbasic.com/Community/posts.php?topic=43897&hl=water


Damien Sturdy(Posted 2005) [#7]
Ahh yes, i saw that

My code suffers the same problem, but
it doesnt need cubic maps and runs fast on older systems ;) thats the advantage :)

Cheers :)


jfk EO-11110(Posted 2005) [#8]
I meant - could you combine both? they way you clip things and the reflective waves of the other demo?


Damien Sturdy(Posted 2005) [#9]
Well it would look nice, I could forge a nice routine to do it but as you said in the first post, Itd be deadly slow :(
To use it in realtime, I cant have stuff go below the water either.

I have a few ideas though, Im going to play around with that idea.

I think you could figure out how far the object is into the water and adjust the rendering camerarange for that single render? I'll get back to you on it :) I have had problems with cubemaps before though.

Thanks for finding it again.

[edit] no luck. man this is a touch one.