Sign in to follow this  

Need help ... simple C++ water animation

This topic is 4863 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am working on a "prrof of concept" prototype for a project I am looking into starting. If I can get things going I will hire some real game programmers and use the proper technology (maybe I'll look at gamedev.net for some resources), but for now I need something quick and easy that I can demo. I have been programming C++ for 10+ years, but have never done anything with animation like this. I am looking for someone to supply me with a an example of a C++/MFC application that draws water on the bottom half (a static sky image takes up the upper half) of a CFrame window. Based on some variables I want to be able to move forward, backward, and turn at various speeds. Almost as if you are sitting on the bow a boat and the water is moving under you. I want to avoid the overhead of DirectDraw, OpenGL, etc. for this prototype and do the work with the MFC CDC objects and bitmaps (i.e. BitBlt, StrectchBlt, etc.). If soemone can supply me with something that will work in my prototype I have no problem adding your name and contact information to the prototype which hopefully many people will see. thanks, Kevin

Share this post


Link to post
Share on other sites
You need to use OGL or D3D, it will be more difficult to do this using device-contexts and will run extremely slow.

Wave simulation is tricky, do you just want the view to bob or do you want to model waves propegating across the water? Do you want a wake from the boat?

The DirectX SDK comes with an MFC example (called MFC Fog I think), and OGL is pretty easy to setup in a window, maybe you'd write your own COGLWindow class derived from a CFrame.

Share this post


Link to post
Share on other sites

This sort of water effect is very simple - just mirror the sky and shift rows of pixels left and right. I'm assuming you want, however, something a bit more complex..?

Share this post


Link to post
Share on other sites
I'll look into that option.

I am looking for something much simplier (for now). All I need is water surface (whether it is glass calm, dynamic waves, or just a bunch of static waves). It does not have to react with anything (i.e. no boat wakes, floating objects, shorelines, etc.) and I want the whole image to appear to be moving based on a couple variables (i.e. cx (-100 full speed backwards to +100 full speed forward) & cy ( -100 full speed left to +100 full speed right) and of course a combination (i.e. cx=-10 & cy=47).

This is just a prototype, so simple is better. My other option is to have a solid blue image with yellow grid lines on it that move based on the variables. This looks horrible and ANYTHING would be an improvement.

Thanks,
Kevin

Share this post


Link to post
Share on other sites
Quote:
Original post by KSorber
I'll look into that option.

I am looking for something much simplier (for now). All I need is water surface (whether it is glass calm, dynamic waves, or just a bunch of static waves). It does not have to react with anything (i.e. no boat wakes, floating objects, shorelines, etc.) and I want the whole image to appear to be moving based on a couple variables (i.e. cx (-100 full speed backwards to +100 full speed forward) & cy ( -100 full speed left to +100 full speed right) and of course a combination (i.e. cx=-10 & cy=47).

This is just a prototype, so simple is better. My other option is to have a solid blue image with yellow grid lines on it that move based on the variables. This looks horrible and ANYTHING would be an improvement.

Thanks,
Kevin


If you're going for a purely software based solution, look into voxels. They'd look pretty neat, I can imagine, and you could animate them too. Not to mention you could texture the world. It might look a little pixelly, that's all

Share this post


Link to post
Share on other sites
the mirroring of the sky and shifting of pixels sounds interesting, but I'm confused at the effect.

let's say I have a 500x500 bitmap of the sky and I display it in a 500x500 area (mirrored along the x axis). If I want to move forward (into/up the image) what pixels would I shift? If AND what do I do replace the first row of pixels with?


Kevin

Share this post


Link to post
Share on other sites
Quote:
Original post by KSorber
the mirroring of the sky and shifting of pixels sounds interesting, but I'm confused at the effect.

let's say I have a 500x500 bitmap of the sky and I display it in a 500x500 area (mirrored along the x axis). If I want to move forward (into/up the image) what pixels would I shift? If AND what do I do replace the first row of pixels with?


Kevin


Unfortunately, that method just draws a rippling effect horizontally; it would not look at all good if you were to use it for moving around.

Is your sky to be static unless you look left/right, at which point it shifts?
Really; all I can suggest is voxels.

Share this post


Link to post
Share on other sites
Unfortunately, that method just draws a rippling effect horizontally; it would not look at all good if you were to use it for moving around.

Is your sky to be static unless you look left/right, at which point it shifts?
Really; all I can suggest is voxels.[/quote]

That makes sense now ... thanks for clearing it up. I'll do a little research on the voxels and see if I can come up with.

If anyone has any examples of doing anything like this with voxels (or other technology) I would love to see it.

Thanks,
Kevin

Share this post


Link to post
Share on other sites

This topic is 4863 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this