XNA Creators Club Online
Page 1 of 1 (3 items)
Sort Posts: Previous Next

reflection in ocean and thunder (red alerts3)

Last post 23/03/2009 12:38 by akira32. 2 replies.
  • 22/03/2009 10:49

    reflection in ocean and thunder (red alerts3)

    The effects of reflection on ocean and thunder shot by ship are very wonderful.
    Could somebody know the teachinque?
    How do I implment the two effects by DirectX 9?

    The two effects in the website's picture 5
    http://acg.gamer.com.tw/picShow.php?s=8182&n=245698&t=61&k=0

  • 23/03/2009 11:11 In reply to

    Re: reflection in ocean and thunder (red alerts3)

    I don't know how they did the water/thinder in this game as there are alot of different approaches to something like this, but it looks like there is a combination of shadows( from the boat ) and refraction from air to water, and it's perfectly possible to implement these two effects using DirectX 9.

    The relection/refraction
    This can easily be made with snell's law( More info on Snell's law ) using a HLSL pixelshader.

    What you need to have in order to implement reflection and refraction is a cubemap around the water that will be used as a lookup texture for both reflection and refraction. Render the scene( except for the reflective object, the water in this case ) into this cubemap texture, and in the shader, use the view vector and surface normal vector as two lookup vectors from the cubemap, in order to compute the reflection and refraction( see snell's law ) color.
    The cubemap must inclue these six versions of the rendered scene: One rendered from the reflection object to the sky, another to the bottom of the ocean, an other forwarc, backwards, left and right.

    Thunder shot
    There are many ways to create thunder. One way is to use a few animated textures and render them like an animation. Say you have 10 different texture that creates one thunder shot animation, render these in a plane that range from the shooter to the target. Use alpha to blend the thunder with the environment.
    An other way is to generate lines/tubes, that form a thunder, from the shooter and ending up at the target. To make this look better, you can also apply glow on the lines so they look more alive. The tubes can also have a random effect so they are generated differently each frame, making them move trough the air.

    If you want the tubes reflected in the ocean, remember to draw them into the cubemap as well, making the reflection vector hit the lighting in some spots.



    This is a very general answer, and if you want to implement this I can assist you with this. Just send me a mail or visit my blog.
    Petri Wilhelmsen
    Dark Codex Studios

    Blog | Twitter

    Microsoft XNA/DirectX MVP
  • 23/03/2009 12:38 In reply to

    Re: reflection in ocean and thunder (red alerts3)

    digitalerr0rDCC:

    This is a very general answer, and if you want to implement this I can assist you with this. Just send me a mail or visit my blog.


    digitalerr0rDCC,Thank you! Your answer is very good. You are very kind.
Page 1 of 1 (3 items) Previous Next