Results 1 to 4 of 4

Thread: Modelling things out of water

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2011
    Posts
    10

    Modelling things out of water

    So I'm taking a graphics course and what I would like to do for my final project is a chess game but I'd like to model the pieces out of water. Basically if any of you have played God of War 3, that's kind of how I want it (here is a link to what I'm thinking of: http://www.youtube.com/watch?v=6sS6U7pTrvs).

    When the piece gets taken I'd like the piece to explode into a shower of water possibly leaving puddles on the board (I have an idea how to do this). But I'm not exactly sure how I'd get the pieces to be modelled out of water (and if I time, fire as well).

    I was thinking of simply modelling the pieces in Maya and applying a 'water' texture map, and to make it look like the water is flowing, I'd have like 10 texture maps I cycle through, all of which are water but in different states. I could do it more dynamically but I have no idea how. Any help is appreciated.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,135

    Re: Modelling things out of water

    Quote Originally Posted by arian487
    [..] I'd like to model the pieces out of water.
    That made me smile.

    Quote Originally Posted by arian487
    I'd have like 10 texture maps I cycle through, all of which are water but in different states.
    That's actually a valid concept. The simplest way is to bind a different image every frame.

    Code :
     
    // frame i
    glBindTexture(GL_TEXTURE_2D, tex_one);
    // draw piece(s)
     
    // frame i + 1
    glBindTexture(GL_TEXTURE_2D, tex_two);
    //draw pieces 
     
    // a.s.o.

    The obvious drawback is that your textures will "fly" or "crawl" through depending on your frame rate (or better put frame time).

    The better approach is to run a timer and change the texture in a defined interval. Coarsly this will look like this in pseudo-code:

    Code :
     
    // start timer somewhere, keep old time
    if(current_time >= old_time + interval)
    {
       if(current_texture < textures_size)
         ++current_texture;
       else
         current_texture = 0;
     
       glBindTexture(GL_TEXTURE_2D, texture_object[current_texture]);
    }
     
    //draw pieces 
    // a.s.o.

    What you see in most games is a simple "scrolling" texture approach done by offsetting the texture coordinates. This can be done using one or more textures, which can be transformed at different speeds.

    The fixed-function approach using the texture matrix is described here:
    http://glprogramming.com/red/chapter09.html#name8

    Inside a shader it's merely manual offsetting like this:

    Code :
    // for a waterfall you'd want to offset in t direction only
    vec4 WaterColor = texture{2D}(WaterSampler, vec2(TexCoord.s, TexCoord.t - speed * time));

  3. #3
    Junior Member Newbie
    Join Date
    Oct 2011
    Posts
    10

    Re: Modelling things out of water

    Thanks a lot! Had no idea iterating through was actually valid. Would I hardcode the x textures or dynamically do it using just one texture? I actually have no idea how I'd draw x water textures to make it look like the water is flowing, I'm a pretty terrible artist.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,135

    Re: Modelling things out of water

    Quote Originally Posted by arian487
    Thanks a lot! Had no idea iterating through was actually valid.
    Why not? Playing back a movie is essentially nothing else. Iterating over a number of still images to create the illusion of movement.

    Regarding the creation of the textures I can't help you.

Similar Threads

  1. modelling water
    By marshall80 in forum OpenGL: Advanced Coding
    Replies: 10
    Last Post: 04-07-2003, 09:35 AM
  2. Modelling tool
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-09-2002, 08:11 AM
  3. 3D modelling
    By tony_ee81 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-24-2002, 12:13 AM
  4. 3D Modelling
    By in forum OpenGL: Basic Coding
    Replies: 9
    Last Post: 11-17-2000, 06:09 AM
  5. Modelling
    By in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 08-19-2000, 09:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean