water effect(for the gurus) 
Author Message
 water effect(for the gurus)

I looking for a water effect done in VB. Can someone point
me to a tutorial for VB users. More exactly the wave
effect the water produces in what i am interested
in.Hopefully it is also interactive.

cheers



Sun, 17 Oct 2004 23:53:39 GMT  
 water effect(for the gurus)
Hi,

A generic water effect can be done by moving the texture coordinates from scene to scene, which
leave to an impression of movement, somehow, like the water through a fall.

If you mean like oceans in Empire Earth, I suspect they play with the Y coordinates (XoZ being
horizontal) of the mesh from scene to scene. The sea make optical lens, so at high point of the
wave, we see the sea floor object enlarged; while at low point of the wave, the convex lens make
the sea floor object appear shrieked. I suspect they get that result in moving the sea floor faster
(with a larger amplitude) than the top of the water. If the observer is close, the effect will be
more noticeable.

                 ......................
                /     ----------      \
Wave ...../     /             \      \..........
                   /                \
Floor ........./                  \..............

As you can see, the highest point of the floor that moves in synch with the wave, is higher than
the lowest point of the wave, so, for the observer, the objects look closer, as if magnified by the
sea lens. Sure, the water is blended (transparency). I didn't test if that simple mechanic would
(may) indeed produces the very cool effect we can see in Empire Earth, I just though about it right
now... and it does not involve moving the coordinates of the texture, just moving the Y coordinates
of two meshes (the wave and the floor).

Vanderghast, Access MVP

Quote:

> I looking for a water effect done in VB. Can someone point
> me to a tutorial for VB users. More exactly the wave
> effect the water produces in what i am interested
> in.Hopefully it is also interactive.

> cheers



Mon, 18 Oct 2004 04:05:32 GMT  
 water effect(for the gurus)
If someone can translate this to VB
http://www.gamedev.net/reference/articles/article915.asp


Quote:
> Hi,

> A generic water effect can be done by moving the texture coordinates from

scene to scene, which
Quote:
> leave to an impression of movement, somehow, like the water through a
fall.

> If you mean like oceans in Empire Earth, I suspect they play with the Y

coordinates (XoZ being
Quote:
> horizontal) of the mesh from scene to scene. The sea make optical lens, so

at high point of the
Quote:
> wave, we see the sea floor object enlarged; while at low point of the

wave, the convex lens make
Quote:
> the sea floor object appear shrieked. I suspect they get that result in

moving the sea floor faster
Quote:
> (with a larger amplitude) than the top of the water. If the observer is

close, the effect will be
Quote:
> more noticeable.

>                  ......................
>                 /     ----------      \
> Wave ...../     /             \      \..........
>                    /                \
> Floor ........./                  \..............

> As you can see, the highest point of the floor that moves in synch with

the wave, is higher than
Quote:
> the lowest point of the wave, so, for the observer, the objects look

closer, as if magnified by the
Quote:
> sea lens. Sure, the water is blended (transparency). I didn't test if that

simple mechanic would
Quote:
> (may) indeed produces the very cool effect we can see in Empire Earth, I

just though about it right
Quote:
> now... and it does not involve moving the coordinates of the texture, just

moving the Y coordinates
Quote:
> of two meshes (the wave and the floor).

> Vanderghast, Access MVP




Quote:
> > I looking for a water effect done in VB. Can someone point
> > me to a tutorial for VB users. More exactly the wave
> > effect the water produces in what i am interested
> > in.Hopefully it is also interactive.

> > cheers



Tue, 19 Oct 2004 11:49:28 GMT  
 water effect(for the gurus)

Quote:
> I looking for a water effect done in VB. Can someone point
> me to a tutorial for VB users. More exactly the wave
> effect the water produces in what i am interested
> in.Hopefully it is also interactive.

I don't claim to be anywhere near a Guru *g* but have you tried implementing
vertex shaders?  They'll do exactly this and it's all done in hardware for
you so if very fast.  The source page you quoted is a common effect in 2D
graphics programming but is quite slow and will only work when viewed flat
on, Vertex shaders on the other hand will work in 2D or 3D and look (If you
write it properly) just as good if not better.  The bulk of the code at the
bottom if for refraction which you can ignore in the first instance, just
use the values from the buffer as greyscale colour until you're more
familiar with the concept, the main section would look something like this:

'***
Private Const MAXX = 320 'Width and height of WaveMap
Private Const MAXY = 240
Private Const DAMP = 16 'Damping factor

'Define WaveMap[frame, x, y] and frame-indices
Dim WaveMap() As Integer
Dim CT As Integer, NW As Integer

Private Sub Form_Load()
    'Scale buffer (Note, article declares as MAXX/Y-1,
    '    but that would overflow in smoothing loop)
    ReDim WaveMap(1, MAXX, MAXY) As Integer
End Sub

Private Sub UpdateWaveMap()
    Dim x As Itneger, y As Integer, n As Integer

    'Skip the edges to allow area sampling
    For y = 1 To MAXY - 1
        For x = 1 to MAXX - 1
            n = ((WaveMap(CT, x - 1, y) + _
                WaveMap(CT, x + 1, y) + _
                WaveMap(CT, x, y - 1) + _
                WaveMap(CT, x, y + 1)) \ 2) -
                WaveMap(NW, x, y)

            n = n - (n \ DAMP)

            WaveMap(NW, x, y) = n
        Next X
    Next Y

    'Swap buffers
    CT = NW
    NW = Iif(NW = 0, 1, 0)
End Sub
'***

Something like that.
Hope this helps,

    Mike

 -- EDais --

 - Microsoft Visual Basic MVP -
WWW: Http://EDais.earlsoft.co.uk/




Wed, 03 Nov 2004 09:09:42 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Color cycle: water effect & game dialogs

2. Realtime Bump mapped water effect in Qbasic

3. need help creating a water effect

4. create a fade effect or any other effect like morph between two open forms

5. Question for a guru (WOSA guru, that is)

6. GURU/SEMI-GURU please help with ActiveX DLL threading question

7. a tall drink of water

8. Computer System 'HOLY WATER'

9. By Water Basic for UNIX: wich version ?

10. Absorb Some Knowledge of Water

11. Source Print (Blows Code Print Pro and Pretty Print out of the water)

12. Foxpro problem (dead in water) error 3000

 

 
Powered by phpBB® Forum Software