Wavesets

Revision as of 20:10, 15 May 2008 by Nadnerb (Talk | contribs) (Shores)

Introduction

Wavesets are the classes that Cyan uses to create their standing water effects. When you see a pool of rippling, shiny, water, you are looking at a waveset, or more specifically, a mesh being modified by a waveset. Wavesets take a enormous number of parameters, which can make them seem daunting at first, but you should be able to get something reasonable simply by using the plugin's default settings. I will start this tutorial by walking you through the creation of a simple waveset, and then going on to explain some of the more common parameters. Also, keep in mind that we do not, in fact, know what every single one of the parameters actually does, so if we can't answer your questions, try experimenting on your own, and reporting your findings.

Also, as a prerequisite for Wavesets, Dynamic Environment Maps have been implemented in PyPRP. Dynamic EnvMaps are rendered by the game when you play, so they don't have to be pre-rendered in blender and saved. To use a dynamic envmap, simply leave the envmap texture layer setting at "static" or "anim", rather than selecting "load" and loading a texture.

IMPORTANT NOTE: Not everyone will be able to see wavesets, because they require certain graphics card and driver features. Older cards/drivers may simply see nothing, or refuse to render the entire age.

Setting up a wavset

The first thing you need to know about wavesets is that the geometry doesn't quite look like you think it does. The actual mesh in the file conforms to the bottom of the pool, or the seafloor, and at run-time the mesh is flattened to a specific z-height, and then rendered. This is the "WaterHeight" and PyPRP will assume this to be the Z coordinate of the object center. At this point, it is good to know that you can change the center of an object by placing the 3D cursor somewhere, and, with the object selected, choose Object > Transform > Center Cursor from the menu. The object center will also be the location from which the dynamic environment map is rendered.

To begin, we'll start with a classic "Hole in the Ground" age with a little depression in the middle for our pool.

To get the geometry for our waveset, we will select the bottom of the pool, duplicate it, (Shift-D) and part (P) it from the object. Then we'll leave edit mode, select the waveset, rename it, and change it's material.

Make sure the material is not linked. (press the number next to the material name and click "single user") and then remove all the texture layers. Change the "Col" color to the color you want your water to appear when there is nothing reflected off of it. Generally this is a very dark blue or green.

Finally, we'll add an alcscript to make the plugin export this object as a waveset:

<object name>:
    type: waveset

before you export, there is one other thing it would probably be good to do. The "envradius" parameter is used to approximate reflections of objects closer than infinity in an envmap. This is done by setting a fixed radius, and rendering as though the objects were being reflected off of a sphere of that size around the center point. This means you should set the envradius parameter to the distance from the center of the object to the first visible object that you want to see reflected properly. to set parameters for wavesets, simply add them to the waveset dict:

<object name>:
    type: waveset
    waveset:
        envradius: 100

The Parameters

If you want to play with these, it helps to understand how wavesets actually work, and to do that, it is recommended that you read this article in GPU Gems, written by Mark Finch, the same person that implemented these in plasma.

Shores

One of the more "advanced" features of the waveset is the "shore" which is an object referenced by the waveset. The referenced object becomes an animated rolling wave texture.

<object name>:
    waveset:
        shores:
            - <scnobjname>
            - <scnobjname>