Home Tutorials Download Beta Store Forum Documentation KnowledgeBase Wiki Blog
Main Page About Help FAQ Special pages Log in

Creating a Fountain

From ShiVa Wiki


Part 1 - Modelling and unwrapping


What's the deal?

Creating a water surface in shiva is not particularly difficult. It can be easily solved by using a rendermap and a reflector, as pointed out in those two examples: WIKI - SimpleReflection and Making of The Hunt - page 24. But in order to make it look good on a fountain that requires certain adjustments for things like circular waves, we have to modify those two tutorials.


Let's start with something simple. Because the water is running down on the sides of the fountain, from top to bottom, it is sufficient to do a simple box unwrap. That's it.

The Basin

We encounter our first problem here. If you just did a basic unwrap of the basin water plane as you would do with an ordinary plane, you will get unwanted results with the water movement. In order to understand this, let us have a look at how shiva interprets UV movement in "sawtooth" mode:


Shiva will just scroll the texture along the u and v directions. But this is not waht we want, we want the water to go form the inside to the rim of the basin. In order to achieve this, we need to re-think our uv mapping.

We need to align all triangles to the "v" axis. This cannot be done with a closed circle, instead, we will have to cut it open, piece by piece.


Now, that looks like a little pac-man, doesn't it? The method how to achieve this is different from modeller to modeller. Usually, it involves some "break" command, or unwrapping of all faces separately. The idea is to have all triangles separately, aligned in one way (along the v axis), and one triange on top of the others, so it looks like just one triangle:


Part 2 - Importing into shiva, setting materials straight


Import your DAE into shiVa. If you have difficulties seeing anything or if all textures are black, add a DefaultDynamicLightSet.

The Reflector

In order to get real time reflections, we need to create a reflector, which will allow you to render rendermap, a special kind of texture. Create one in the Data Explorer, menu create > model > reflector. it will be stored in the Models folder in the Data Explorer.


Put the reflector at the center of the basin, a little under the water surface.

The Rendermap

Reflections require a dynamic texture which shiva calls rendermap. We need to create one by clicking Data explorer, menu create > resource > rendermap. Depending on your target platform and computer power, choose the render map size wisely. We will go with 1024 for this example. Now we need to tell the reflector which rendermap it needs to render to. This is done in the reflector's attributes editor.


Setting up the Materials

Pick your water material. In the Effect map 0 slot, place your rendermap. In order to make it look right, you need to access the Texture mapping modifier, which is the small "fx" spyglass button located next to the texture preview. The projection mode needs to be set to "camera", and the V scale needs to be set to -1, to invert (mirror) the camera output.


If your water is still all black, here are some common errors:

Now we are going to animate the water with the help of a du/dv map, which is derived form a normal map (hence the name). To learn more, please visit WIKI - SimpleReflection.

Put the du/dv map into the Effect map 1 slot, and adjust the values according to this screenshot:


The frequency value indicates the flow speed of the water.

On to the side parts, the "waterfall". We are in a real time environment, so we won't use (meta)particles to simulate the falling water, but instead, scroll a texture, like in the basin... realtime 3d is, indeed, one big fake. For the color map, we will use a standard shiVa texture in slot 0, and a du/dv map for distortion in slot 1. Adjust the values as in the screenshot:


Part 3 - The finishing touch

Water Jets

We are modelling the jets with polygons, and in order to achieve a realistic look, we need to take into consideration the physics of such a jet. We will fake the speed of the water by using a good uv map. Now, the original poster of this tutorial uses 3ds max and two plugins that helped him to achieve a good unwrap. For us mere mortals, i suggest modelling a straigt jet, unwrapping it, then squishing it/stretching it and THEN bend it into shape.

To achieve a realistic water flowing behaviour, align your uv map to this guide:


Back in shiva, use the same texture setup as for the waterfall. If the water flows in the wrong direction, use SawtoothInv instead of Sawtooth.



Particle systems can be attached to objects, but in order to have greater control over them, it is wise to attach them to helper objects (the small yellow boxes that will not be rendered after export).

Create several helpers and move one of them to the end of each jet stream to create a splash effect. Create a particle system in the Particle Editor of the type "cone". Hit the "play" button under the particle system editor. Drag the partilce system onto one of those helpers and adjust their rotation by right-clicking in the object's attributes editor - sfx attributes, "edit position/orientation".


Now, the particle editor is a mighty tool, you will need some time and patience to get the hang of it. Please refer to the official documentation for detailed info on that module. Here's the setting for the splash effect:


For the bottom of the waterfall, we used a "circle" emitter with the following properties:



This tutorial has been sponsored by user v!nc3r from http://www.digital-primitives.com who have done various samples form the ShiVa Showcase page. The original tutorial can be found on the digital-primitives.com website. Translated and slightly edited by broozar.

Final Scene

click here to watch the final scene in the web player!

Retrieved from "http://www.stonetrip.com/developer/wiki/index.php?title=Creating_a_Fountain"

This page has been accessed 13,076 times. This page was last modified on 24 November 2010, at 12:57.