The water simulate on ios(fresnel and Interactive ripple)

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
Post Reply
User avatar
akilar
Greenskin
Posts: 138
Joined: Wed Jun 20, 2007 11:42 am
Location: Taiwan
x 17
Contact:

The water simulate on ios(fresnel and Interactive ripple)

Post by akilar »

The water fresnel and ripple simulate on ios.

Just look.


welcome to my blogger, thanks. :D
http://makedreamvsogre.blogspot.com/
scrawl
OGRE Expert User
OGRE Expert User
Posts: 1119
Joined: Sat Jan 01, 2011 7:57 pm
x 216

Re: The water simulate on ios(fresnel and Interactive ripple

Post by scrawl »

Impressive :)

Can you describe how it works (or upload the source)? How are the ripples achieved? Do you modify the geometry, or is it just a normal map overlay?
User avatar
akilar
Greenskin
Posts: 138
Joined: Wed Jun 20, 2007 11:42 am
Location: Taiwan
x 17
Contact:

Re: The water simulate on ios(fresnel and Interactive ripple

Post by akilar »

Thanks for your respond.

The left four overlay icons are fresnel simulate result.
The up right four overlay is ripple simulate result.
The ripple simulate is use three rtt to store height data. switch three buffer to simulate ripple height change, and convert it to normal map,
Last, just combine the ripple normal map and fresnel result in pixel shader.
scrawl wrote:Impressive :)

Can you describe how it works (or upload the source)? How are the ripples achieved? Do you modify the geometry, or is it just a normal map overlay?
scrawl
OGRE Expert User
OGRE Expert User
Posts: 1119
Joined: Sat Jan 01, 2011 7:57 pm
x 216

Re: The water simulate on ios(fresnel and Interactive ripple

Post by scrawl »

Is there a reason the camera is limited to a fixed distance / angle ? Your normal map seems to be generated in screen space, so in theory shouldn't this work for a first person camera (with a very large amount of water visible) as well?
User avatar
akilar
Greenskin
Posts: 138
Joined: Wed Jun 20, 2007 11:42 am
Location: Taiwan
x 17
Contact:

Re: The water simulate on ios(fresnel and Interactive ripple

Post by akilar »

no, not screen base. i use another a camera to capture Water Impulsers, so can support multi Impulsers(other npc, monster).
I think it's can support big water, just tile texture uv.
scrawl wrote:Is there a reason the camera is limited to a fixed distance / angle ? Your normal map seems to be generated in screen space, so in theory shouldn't this work for a first person camera (with a very large amount of water visible) as well?
scrawl
OGRE Expert User
OGRE Expert User
Posts: 1119
Joined: Sat Jan 01, 2011 7:57 pm
x 216

Re: The water simulate on ios(fresnel and Interactive ripple

Post by scrawl »

Ok, so I want to implement the ripples (in a scene with a big water plane) myself, and I still don't fully understand how you did that.

1. Why do you have 3 render targets for ripples? Wouldn't it be enough to use 2, and ping-pong between them each frame? Similiar as described here: http://www.patriciogonzalezvivo.com/blog/?p=657

2. How big are your ripple textures (in texels), and how much area does that cover in screen space (i.e. how many screens away are the ripples simulated)?

3. How do you handle moving the camera? I think you are passing the camera offset from last frame to ripple shader, so that it displaces the ripples location by that amount... right?

4. When the character moves, you just draw something on the ripple texture? And because you only have to draw to a very small area, this should be quite fast, I guess.

Apologies if my questions are annoying, I would very much appreciate if you released the sources, so I could figure it all out myself :)
User avatar
akilar
Greenskin
Posts: 138
Joined: Wed Jun 20, 2007 11:42 am
Location: Taiwan
x 17
Contact:

Re: The water simulate on ios(fresnel and Interactive ripple

Post by akilar »

The full reference book is there:
http://cmlab.csie.ntu.edu.tw/~perng/3D/
The chapter 16(water ripple)
http://cmlab.csie.ntu.edu.tw/~perng/3D/ ... part3.html
scrawl wrote:Ok, so I want to implement the ripples (in a scene with a big water plane) myself, and I still don't fully understand how you did that.

1. Why do you have 3 render targets for ripples? Wouldn't it be enough to use 2, and ping-pong between them each frame? Similiar as described here: http://www.patriciogonzalezvivo.com/blog/?p=657

2. How big are your ripple textures (in texels), and how much area does that cover in screen space (i.e. how many screens away are the ripples simulated)?

3. How do you handle moving the camera? I think you are passing the camera offset from last frame to ripple shader, so that it displaces the ripples location by that amount... right?

4. When the character moves, you just draw something on the ripple texture? And because you only have to draw to a very small area, this should be quite fast, I guess.

Apologies if my questions are annoying, I would very much appreciate if you released the sources, so I could figure it all out myself :)
scrawl
OGRE Expert User
OGRE Expert User
Posts: 1119
Joined: Sat Jan 01, 2011 7:57 pm
x 216

Re: The water simulate on ios(fresnel and Interactive ripple

Post by scrawl »

Thanks, that really cleared things up. I'll see what I can come up with then :)
User avatar
akilar
Greenskin
Posts: 138
Joined: Wed Jun 20, 2007 11:42 am
Location: Taiwan
x 17
Contact:

Re: The water simulate on ios(fresnel and Interactive ripple

Post by akilar »

No problem, maybe you got it.
welcome my blog. http://makedreamvsogre.blogspot.tw/ :)
scrawl wrote:Thanks, that really cleared things up. I'll see what I can come up with then :)
scrawl
OGRE Expert User
OGRE Expert User
Posts: 1119
Joined: Sat Jan 01, 2011 7:57 pm
x 216

Re: The water simulate on ios(fresnel and Interactive ripple

Post by scrawl »

Here is my version. The water plane is infinite and you can move around as much as you want.

Image

The ripples are simulated in a rectangular region centered on the player. Every frame, I remember the 2d position offset (how much the player has moved that frame) and the previous frame offset. In the heightmap simulation, I've then shifted the texture samples by previousFrameOffset + currentFrameOffset for the heightmap from previous frame, and shifted by currentFrameOffset for current frame heightmap.

Code: http://github.com/scrawl/watertest

Thanks again for your demo link. It was very helpful :D
Post Reply