We’re adding a new feature in our game to help us control the river-current in some of our game levels, so the physics solver can send floating things down-stream, into eddies and out, slowing, speeding, etc. Pretty cool.
We’re going to use a normal map to control the current, per-pixel. Awesome. Red and green channels will control direction and speed of the current in the XY plane. Also we can use the length of the normals for additional speed control.
I’m wondering how to author these textures though. So far I’m thinking the best way is just to hand-paint each channel individually. Full-on red for full-strength left-wards current, black “red” for full-on right-wards current, etc. Eddies and swirls get weird though, hard to visualize.
And then there’s the length of the normals… how do we paint that? Can’t just sculpt a heightfield, how would you represent full-speed current going left down the middle of a river?
Anyone else make something like this, or have some ideas how they would create the map?
Sounds like a similar problem to dynamic normal maps for clothes wrinkles.
You can probably have the red and green maps warp the UVs to get the normal maps to rotate, I think there was another thread here on how to go about that.
Sounds like a neat feature and straight forward enough, the hard part is getting the physics sim to spit out the textures properly, the rest is cake.
You can also use decals for this, where you have a base plane which you have the regular current with a scrolling UV based on the overall speed of the river, and then whenever there’s a rock or a diversion of the current you place a decal over the base river with the appropriate normal map.
lenghts of the normals can usually be put on the blue channel of the normal map, sometimes it gets wonky and you need to normalize the map but it generally works.
You can probably get something looking like this with decals
I’ve worked on something like this, but we went for something simpler. UVs for the direction of the flow, Red vertex colour for speed of the flow, Green vertex for turbulance areas. This was on a simpler proxy mesh also used for collsion, the visual water was higher res - sub div smoothed.
The rendered water had a few different frequency normal maps running at different speeds. I was relatively happy with the results considering the short time frame.
Thanks for the input. The game is using a non-realistic style, and the water won’t be using a visually complicated shader for the rendermesh. In fact the normalmap for the flow will probably be super-low like 32x32. It’s a late feature, so not much time to devote for tools. Vertex color might make sense for storage though. I’ll post some pics in a few months when the project goes public.
[QUOTE=mikiex;3159]I’ve worked on something like this, but we went for something simpler. UVs for the direction of the flow, Red vertex colour for speed of the flow, Green vertex for turbulance areas. This was on a simpler proxy mesh also used for collsion, the visual water was higher res - sub div smoothed.
The rendered water had a few different frequency normal maps running at different speeds. I was relatively happy with the results considering the short time frame.[/QUOTE]
This sounds a lot like what I’m doing. (Wii)
Various vertex colour channels control a number of effects, foam, speed etc…
There’s a Maxscript tutorial that ships with Max that shows you how to create a simple paint program with MaxScript. I started with that and expanded it to build a program that allows our character artists to paint directional maps. The color that the brush paints is defined by the direction that you paint. We’re using it for hair at the moment. Sounds like this is the kind of thing you’re looking for - to paint the direction of the flow.
Is this for rendering the water or for defining the physics for the volume? The two are very different. For rendering, there are all sorts of fun constraints on warping and stuff, as alluded to , another thread talks about perpixel rotations, and those issues. If this is for the physics, this gets a lot more fun. Programs that paint vector fields are super easy and fun to make. You can use mouse velocity to get really nice vectors. If you are talking hundreds by hundreds, you could write it in pygame or processing easily. If you need thousands by thousands, directx or ogl may be a better bet. It is /really/fun and rewarding to make programs like these.
One of the coders on TCE posted a link to some work he did recently. Very interesting demo, could be an interesting way to create a flow map. Fun to play with too. He said he’s going to write a bmp/tiff converter/exporter for it this weekend.
For expediency I hand-painted a quickie test map this afternoon, just picking colors from a world-space-lit hemisphere, painting swaths and blending them together. Should be good enough for now.
If we have to do more than two of these maps I’m going to look into some of the ideas posted here. Thanks again, will post some pics once the game is announced.