how to sink a ship?

Blitz3D Forums/Blitz3D Programming/how to sink a ship?

Pinete(Posted 2004) [#1]
Hi!,
I need help with the next issue.
Imagine that you want to sink a ship under water when
it is destroyed, using a simple way:

if ship = destoyed
moveentity 0,-1,0
endif

but the problem is that the sea has a different "entityorder" (1000) being painted the first, under the rest of the entities, and the ships has (0), that's the reason because it's a issue... When I try
to sink the ship, this continues painting "in front" of
the water, and, If I change the order of the sinked ship,
suddenly it starts to be painted "behind" the water and
dissapears in one frame.

How to give the feeling of sinking??

There exist some way to alter the entityorder making that
two different entities could be ordered beetween them, but
without taking into account the rest of the entities?

Thanks in advance!


Mac M(Posted 2004) [#2]
Are you using entityorder to disable z-buffer for any reason? If you don't use entityorder or if you assign order 0 to both objects, they are rendered using z-buffer and they must appear correctly.

Also giving both objects same order index must render they correctly, if you want to use entityorder for any reason.

Regards


Rob Farley(Posted 2004) [#3]
My first question is why does the sea have an entity order of 1000? That sounds like your issue, fix that and the rest will fall into place.

I'm guessing you're getting z buffer issues and probably using a single plane for your sea, and that plane is probably always at the original point you placed it.

So, here's some ideas you might want to try out..

If you are using a plane, try moving it so that it's always directly under the camera, this should reduce the zbuffer problems you probably encountered as you move further away from the original point.

Reduce the amount of z-buffer you have in your scenes by reducing the camera range.


Pinete(Posted 2004) [#4]
Thanks for your replies, the problem is the next.

Now, the sea is making a sinus movement and I gave
the valour of 1000 to the sea in order to avoid possibles
issues with the paint of the particles (trails) of the
ships in the water & the reflexes of the ships on the
water (the same model, mirrored with alpha)
If I don't give another valour to the order of the water,
then, the water in the sinus movement hide the particles &
the reflexes of the ships.
I have tried to give to the ships the same order than the
water (1000) when its state is "destroyed", but it doensn't
works...
:_(


Mac M(Posted 2004) [#5]
I think you will find a lot of troubles with the mirrored-model reflections method. Why don't you try cubemap reflections? There are good examples, like Rob's cubedemo. Cubemaps allow reflections deform depending on water mesh, that cannot be done by mirroring the model, where you see always the same reflection.
About the particles, you can make a vertical linepick to calculate where exactly the water is in that axis and put the particle just in the surface (or a little higher).

Suerte con tu proyecto, compaņero.


Pinete(Posted 2004) [#6]
Muchas gracias Mac M!
Thank you very much!,
I have tried with cubemapping, and in this moment it is implemented, but in order to achieve a different eyecandy
effect beyond of the ship's reflexes. The cubemapping
technique doesn't works fine with "small" entities like ship
on an enormous ocean.. The resulting reflex is weird, however it works fine giving to the water's surface other
texture layer reflexing the sky..
About the particles, I'm doing at this way (catching with linepick the y coord), but again, some
of the particles, attending to the sinus movement of the
water, gets the y-coordinates and, depending on its life,
are painted in front of the ships a lot of times.
It would be perfect if someone could find a way to sink the
boat in this context.


Red Ocktober(Posted 2004) [#7]
The cubemapping
technique doesn't works fine with "small" entities like ship
on an enormous ocean..


it sounds as if you are doing a lot of 'brute force' implementation here to get the results you desire...

that last statement especially, makes it seem as if you have a giant ocean model, and a small ship model running around on it, just to get the 'scale' of a large body of water...

perhaps it might help if you were to step back and look at the total picture, and examine exactly what effects you want, and what Blitz allows you to do... and then decide how to best implement them.

i am also involved in making a game/sim in which a sub is on the ocean... and coming up with a large scale ocean appearance took a lil bit of planning.



might i suggest that you do not use a large ocean model, but implement a two layer ocean, where the water that is immediately at the viewpoint is large enough to be seen from the view and moves whenever the view exceeds certain limits, so that it will always appear as if you are on an endless sea...

the second half being a flat larger simple plane that shares the ocean texture and lies right under the ocean...

this one does not have to move, and does not have to be as reflectively exact as the immediate ocean layer since it will only be seen at distances that the immediate ocean layer does not cover...

--Mike