I want to create a wave effect (like a flag) but with Z-axis on a 3D sprite.
Does anybody know what is the fastest logical way ?
I've pained my brains but without luck, I don't get it ...
Maybe use clipsprite or perform a peek / plot instruction ?
Let me know please,
DeXtr0
P.S. A small example to point me in the right direction would be very handy
Last edited by DeXtr0 on Fri Jul 06, 2007 10:20 am, edited 1 time in total.
That example of Kaeru is very good and pretty cool. However then I'll stuck in 2D. I need the Z-axis aswell to get a depth view.
That's why I thought I had to use 3D but now i'm thinking I need the Z-axis also.. (when doing in 2D)
Meaning, related to the example: The flag would lay down (horizontally) and points towards the z-axis. <= It has to look like a carpet that lays down...
It's hard to explain but if you have a carpet in front of you, rotate it so the endside will be in the depth.
After that perform a wave effect on it.
I don't know a better way explain it, what I'm trying to
sure, I understand. it's like a perspective view of a waving flying carpet.
there, the waving would not be along the same axis as the carpet lies,
but normally orthogonal to it.
say, the carpet lies in X to Z, the waving is a sinus-movement along Y.
for something like that, you'll surely need some 3D.
this is a mesh, and it is one with quite a lot triagles, to make the waving look smooth.
using D3D or OGL for it with make it possible to enable hardware smoothing,
then you can spare a lot of triagles.
of course you could simulate something like that with Sprite3D,
because a Sprite3D IS a 2-triangle-mesh, and you can combine several S3D to a greater mesh,
but you'll need a whole lot of sprites for that,
because each single sprite in the row can only build one edge,
so you need a lot of edges to make the mesh look smooth.
each sprite3D for it's own will stay a parallelogram with straight edges.
so, perhaps you'll better use a 3D-engine, a complete mesh and hardware smoothing....
Pfew that's what I thought but not hoped.. Pitty this can not be done with normal 2D manipulation...
Ok then i'll look into the 3D stuff, to find more information.
I just wanted an image to fly around, as you said in a perspective mode waving like a flag..
if you really want only one image doing such movement,
and nothing else (or only little else) on the screen,
you sure can calculate each single pixel's position and draw it.
for this you'll need a fast routine to calculate the coordinates,
and a fast drawing like e.g. BitBlt or direct access to the drawing buffer.
the standard Draw-command is far too slow for such.
I didn't know what you needed it for.
if it's just a screensaver that should not show or do anything else, you surely can do it the hardcoded way.
I thought you perhaps wanted some special-effect-element within a complex game,
there you'll surely need a 3D-engine.
I have neither experience with BitBlt, nor with POKEing into the Grafix-Mem on 32bit machines,
so I can't tell wich is faster or how exactly to do it. (last time I directly accessed the Grafix-Mem was with QuickC on a 16bit PC...)
what I can tell you is, that you'll have to optimize the algorithm for the calculation aswell.
you will need a lot of sinus-calculations, so use a precalculated table, not the build-in functions.
optimize the loops the best you can.
e.g. calculate a specific offset only once, and use a more inner loop to draw all pixels with the same offset at the same time.
..ok, such things are even harder to explain... xD