Page 1 of 2 12 LastLast
Results 1 to 20 of 24
  1. #1

    How to make a goodlooking wave

    Hello,

    I just wanted to get some hints and tips on how to make a good looking wave. at the moment I just have this kind of ugly wave in my kite-game.


    Basically, it is just an object which is increasing the size and moving forwards with animations. However, this would be a wave that does not break. Any ideas how to make a breaking wave like in this game?

    http://www.youtube.com/watch?v=ZROhW...eature=related

    Is it possible to animate the mesh itself? the vertices?

    In that surfgame the wave seems to be the same object as the water itself. You can't see any border between the wave and the rest of the water. It is one fluent transition...

    Thanks for all help!

    Greetings!
    Last edited by a-k-m; 26-Sep-11 at 10:02.



  2. #2
    Member C.A.ligári's Avatar
    Join Date
    Jul 2011
    Location
    Posts
    1,506
    I initially thought of a Script/Module that SolarLune once made, though my second Thought is this one, and I would probably prefer it...

    Code:
    # Blender Game Engine 2.55 Resource Kit: Energy Wave
    # Shader by Martins Uptitis and Mike Pan
    #
    # The GLSL vertex shader is responsible for
    # animated displacement of the wave
    # The GLSL fragment shader is responsible for
    # the coloring
    # Run the game,
    # then click anywhere on the screen :)
    
    from bge import logic
    cont = logic.getCurrentController()
    own = cont.owner
    VertexShader = """
    uniform sampler2D noiseMap;
    uniform float timer;
    varying vec3 normal, lightDir, eyeVec;
    #define amplitude 0.01
    #define speed 1.0
    void main()
    {
    //get the first UV layout
    gl_TexCoord[0] = gl_MultiTexCoord0;
    // pass lighting information to fragment shader
    normal = gl_NormalMatrix * gl_Normal;
    vec3 vVertex = vec3(gl_ModelViewMatrix * gl_Vertex);
    eyeVec = -vVertex;
    // deform
    vec4 v = gl_Vertex;
    v.z = sin(timer*speed+v.x*0.5+v.y*1.0)*0.3+v.z*amplitude;
    v.z += texture2D(noiseMap, gl_TexCoord[0].st+timer*(0.01*speed)).r*0.3;
    gl_Position = gl_ModelViewProjectionMatrix * v;
    }
    """
    FragmentShader = """
    uniform sampler2D noiseMap;
    uniform float timer;
    varying vec3 normal, eyeVec;
    void main(void)
    {
    vec3 N = normalize(normal);
    vec3 E = normalize(eyeVec);
    float fresnelTerm = pow( max(1.0-dot(N,E), 0.0), 2.0);
    vec3 color1 = gl_FrontMaterial.diffuse.rgb;
    vec3 color2 = gl_FrontMaterial.specular.rgb;
    gl_FragColor.rgb = mix(color1 ,color2 ,fresnelTerm);
    gl_FragColor.a = fresnelTerm*2.0;
    }
    """
    
    mesh = own.meshes[0]
    for mat in mesh.materials:
     shader = mat.getShader()
     if shader != None:
      if not shader.isValid():
       shader.setSource(VertexShader, FragmentShader, 1)
      shader.setSampler('noiseMap',0)
      shader.setUniform1f('timer',own["timer"])
    Apply this to an Object like you would apply a Python Script. It will deform your Mesh into a moving Wave Function.
    Look at the bold-italic Line: It is the Function itself. Play around with that Function, maybe you get an adequate Breakin' Wave?



  3. #3
    How?? I tried to use that script but it doesn't work! I'm a noob, so step by step would help if possible



  4. #4
    Member
    Join Date
    Jul 2009
    Location
    Melbourne
    Posts
    463
    Post #3 is not "Surfing Game!"'s first post to this forum. This is ridiculous.

    There has been a time waster on this forum for months posting under different names, a new one every few weeks or even days, sometimes even hours.

    It might not be technically against the rules of the forum but the person doing this, for whatever reason, is deceiving.



  5. #5
    What? I only made this user because i'm been looking for ways to make waves. I'm an avid surfer. That too was the only reason why I got blender. To make a surfing game. Thanks alot Equip that really nice. A time waster.



  6. #6
    Member C.A.ligári's Avatar
    Join Date
    Jul 2011
    Location
    Posts
    1,506
    In what Kind of Way doesn't it work? Simply doin' nothin'?
    Have you tried it with a pulsed Sensor as well?
    Always (pulsed), connected with a Script Controller.

    Ô, a very important Thing: Add a Timer Property named "timer" to the Logic Bricks! Otherwise it cannot work -- that is most probably the Problem here. I am sorry for not havin' pointed that out in my earlier Post!



  7. #7
    Thanks! youda man! I'll try it now. Your not like that other guy... Equip!



  8. #8
    It worked!!!!! Now... getting it to break....
    Last edited by Surfing Game!; 12-Dec-11 at 00:14.



  9. #9
    @Surfing Game! you are getting the wave to break?! Please tell me how?



  10. #10
    no, no. Not breaking unfortunatly. but moving! But I can't work out how to make it surfable. Is it possible? I tried mutiple mesh's but... It didn't work. Any ideas... anyone?



  11. #11
    Member
    Join Date
    Jul 2009
    Location
    Melbourne
    Posts
    463
    Yo Surfing Game! You tried the script, didn't work, you're an avid surfer, added a timer property, tried multiple meshes, still doesn't work but still an avid surfer, etc.

    Post the blend.



  12. #12
    Nah. It worked. just not surfable.



  13. #13
    Member
    Join Date
    Jul 2009
    Location
    Melbourne
    Posts
    463
    You say you got the script to work to some point. Post the blend and we might then see how we might apply it to an object that appears to shape itself to a breaking wave.

    Or are you a sock puppet troll?



  14. #14
    Member C.A.ligári's Avatar
    Join Date
    Jul 2011
    Location
    Posts
    1,506
    Equip, maybe he is new to the Forum and hasn't even got told about how to share a .blend File.

    (((Go Advanced > File Manager)))



  15. #15
    Member
    Join Date
    Jul 2009
    Location
    Melbourne
    Posts
    463
    Hi Caligari. Yeah, I challenged him in #4. He says that he is a noob, posting for the first time on this board and then says that he was able to paste a shader script into a working blend. Yeah right!

    I didn't believe his first post, much less do I believe him now.

    Didn't akm start this thread because he got a project that he's been working on for a while and he's seriously interested in what he does? You're an OK guy, didn't you reply because you are seriously interested in helping out likeminded people when you can? It helps you while it helps them.

    He knows that if he pops up again without a blend that I'll challenge him. What's he going to do? wtf he's on the board already under other names.



  16. #16
    Moderator Monster's Avatar
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    10,890
    The above Python code injects a Shader.
    By it's nature a Shader is for display only. You can't influence the Physics with a Shader.

    What you can do is, to update the physics mesh with reinstanciatePyhsicsMesh.
    But you need to modify it first to give you a wave mesh.



  17. #17
    Member LaH's Avatar
    Join Date
    Mar 2011
    Location
    Sandviken, Sweden
    Posts
    999
    Or calculate the wave in python to for the position the surfboard are in and put appropriate forces to the surfboard. Hard but probably doable!



  18. #18
    I don't know the game engine that well, but You could model it with basic animation the way they did it in surfs up. New Blender Development Challenges The link at the bottom takes you to a video tutorial of someone making a wave in cinema4d. If you use shape keys in place of the Morph Tag, and you download a loft add on, then in theory you should be able to create a wave.




  19. #19
    Heres a picture of a wave that I quickly molded:
    Last edited by Surfing Game!; 15-Dec-11 at 21:45.



  20. #20
    EPIC!!! but hard.



Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •