Mirror Idea
Blitz3D Forums/Blitz3D Programming/Mirror Idea
| ||
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? |
| ||
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. |
| ||
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. |
| ||
Looks nice, but why don't you use the animated water mesh we've seen lately, won't this work too? |
| ||
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 |
| ||
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 |
| ||
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 :) |
| ||
I meant - could you combine both? they way you clip things and the reflective waves of the other demo? |
| ||
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. |