can this be done with bmax?

BlitzMax Forums/BlitzMax Programming/can this be done with bmax?

maverick69(Posted 2006) [#1]
Does anybody have an idea how this effect (its a java applet) could be realized (in BlitzMax) ?:

http://www.colliewelt.de/cavalcanti/UntitledFrame-30.htm


ImaginaryHuman(Posted 2006) [#2]
Using a stencil buffer you could do something pretty similar, since there isn't really `realistic` refraction of light, you could just have it so that the puddles are a mask of an animation and then you put that into the stencil buffer and then where there are stencil bits you then draw the whole background at an offset, so wherever there are puddles you'll see an offset that simulates some kind of refraction. You could do it in three passes, each overlapping, like a fake emboss effect, with a different offset for each part of the emboss - the hilite edge, the main, and the shadow edge, to create more of a curvature look. At such small scale you probably wont notice it's not real bumpmapped raytracing.

Or do it all manually in a pixmap and use DrawPixmap.


tonyg(Posted 2006) [#3]
The codelink here had that effect, I think so you might want to check if Drew is about.


Warpy(Posted 2006) [#4]
Drew used Hugo Elias' routines. They're very easy to follow, and produce an effect just like the one in that applet.


Jesse(Posted 2006) [#5]
see if you like this, it is not mine, but I converted it to BMAX. Use your own, must be 640x480, png. make shure you are not in debug mode or it will run really slow.


the original can be downloaded from here it is in BBASIC:
http://dbfinteractive.com/index.php?topic=578.0


maverick69(Posted 2006) [#6]
@Jesse: Wow - Your example is great but for inside a game it's unusable because it's very slow :-(

@AngelDaniel: How can I access the stencial buffer in BlitzMax. Do you have links to any examples?


ImaginaryHuman(Posted 2006) [#7]
I only know you can do stencil buffer in OpenGL, not sure about DX. you'll have to read the online opengl documentation. red book/blue book.


ImaginaryHuman(Posted 2006) [#8]
Otherwise, have a set of pre rendered animations that you overlay.


Jesse(Posted 2006) [#9]
I don't know. But if you figure it out let me know.


Dreamora(Posted 2006) [#10]
You can do stencil buffer with both apis, you just have to set the flag correctly when creating the graphics context. (default is only backbuffer + depth, but there are other buffers as well. Fredborg create quite some time ago an interesting "light" example using accum buffer for example)


xlsior(Posted 2006) [#11]
Very nice effect... Too bad that it is so demanding to the computer.


Jesse(Posted 2006) [#12]
@maverick69 - You know you can change the leve of detail by pressing 1 to 4. Level 1 is the fastest while level 4 is the slowest but you sacrifice details. use arrow keys to set the level of pressure. Sorry for not mentioning that before.

@Dreamora - thanks! I'll look it up. It would be easier if you provide me with a link. lazy me!


Jesse(Posted 2006) [#13]
never mind Dreamora I found it.