The three virtues of a programmer: Laziness, Impatience, and Hubris. – Larry Wall
Legacy:Creating A Material
Contents
Creating the material[edit]
Basic texture[edit]
We have to create a new material to use as a surface. It will be a liquid, reflective, moving and translucent.
1. We'll steal and edit a moss texture.(don't worry. Although moss is not water, all will become clearin the end.) There is a good one in Antalus (AWGlobal.utx).
You'll need to export this.
Because we don't want to cover the whole surface with it, we'll use an alpha channel. In a Graphics Application like Paint Shop Pro or Photoshop, open your moss image and create a new mask (see screen shot in PSP).
An alpha channel is used to vary the transparency in an image. The image is opaque where the alpha channel is white. Draw some stuff on the alpha channel. You'll have to save your image in a format supporting alpha chanels (.TGA). It will be store inside the file. In PSP you have to use the Save in an alpha channel in the Mask menu.
If you want to use this moss texture for other purposes and don't need the alpha channel, hide it before saving.
2. Import the texture. Using MyLevel in the package field will force the editor to save the textures inside the map file. Name the texture mossmask or something similar. You can put it in a group if you have a lot of textures in the MyLevel package.
Note: when opening a level containing textures (or something else) in a MyLevel package, you may want to relaunch the editor before opening another map (yours ;)) otherwise it could mess up your MyLevel package.
3. If you're not sure of the scale of your texture, you can resize it by creating a new material: Chose File -> New in the textures browser. Use MyLevel as package, choose an appropriate name like mossmaskscaller and TexScaler in properies. Now hit New and the properties window should open. Here you can view, and edit the details of your material.
On the properties tree at the bottom, Click Material then choose your moss texture in the browser and click on the Use button in the material line. Adjust the scale of the texture with the UScale and VScale field and the position with UOffset and VOffset.
Animation[edit]
Now we are able to animate the moss.
Create a material of class TexOscillator. In the material field, put the previous texture (the scaler). Adjust the fields to your liking. UOscillationRate and OscillationRate determine how fast the texture moves. UOscillationAmplitude and UOscillationAmplitude determine how far it goes. Use small values for the amplitude and even smaller for the rate. Choose OT_Stretch for both UOscillationType and VOscillationType (the other ones are simple panning).
Reflection[edit]
The water surface will also reflect the world. But because it can't be done in real time, we'll use predefined environment maps. With the texture browser open CubMaps.utx, examine the several groups it contains. We'll create a material that blends the moss texture with a reflective texture.
Choose File -> New one more time, set the package and name correctly and chose Combiner in the list. You will need to set 2 materials and 1 mask. In the first material field put the moss oscillator. In the second, put one of the cube maps in CubeMaps.utx (only pick the textures bordered in blue). Cubemap'CubeMaps.Kretzig.Kretzigcube2' is a good one for what we need.
Choose CO_Alphablend_With_Mask in CombineOperation. The mask will determine how the 2 materials will mix. Because the moss texture has an alpha channel, we will use it. Depending on how You did the mask, you may have to use the InvertMask option.
Translucency[edit]
We could use this material for the water surface but it would look strange. Mainly because it would be opaque ;) Therefor we are going to create another masked texture to make it translucent. And to make the things perfect, it will fit the shape of the water zone!
The zone I want want to fill with water is bordered by a terrain and I'll make the water more translucent toward its "shores". I will use the height map of the terrain as to find the shores.
Create a new image, the same size as the terrain height map, use the shores map as an alpha channel and save it. Don't use white in your alpha channel as the water has to be a least a little translucent.
7. Back in UnrealEd, import the texture like you did with the moss texture. Now we have to make sure that the shores of this mask will fit with the shores of the terrain. In order to do that, create a TexScaler material for this texture (see above).
8. All we have to do now is to apply the mask to the other material. Choose File -> New (for the last time ;)), set everything and choose Shader. A shader is a material containing useful informations. Use the combiner you created as the Diffuse layer and the TexScaler (created in the 7th step) as the Opacity layer. You can set TwoSided to True and the SurfaceType to EST_Water (although I'm not sure whether it's useful or not :p).
Discussion[edit]
Bob_The_Beheader: I think I've removed all the references to FluidSurfaces, but I could be wrong...
"Guest" This is very foggy information, i think u should upload previews screenshots.