Game Development Community

dev|Pro Game Development Curriculum

Water Parallax Mapping

by Matt Vitelli · 11/14/2006 (7:38 pm) · 18 comments

Download Code File

Update: 11/28/06
*Fixed the shader
*Added a readme

This was based off of the waterCubeReflectRefractP and V and requires shader model 2.0. I've included a dds in the zip that contains the embedded heightmap information. As always remember to define your shaders in client/scripts/shaders.cs and adjust the materials.cs file to meet these needs.

Hope this helps!

Matt Vitelli

#1
11/14/2006 (3:53 pm)
img213.imageshack.us/img213/8817/parallaxwaterjh1.png
#2
11/14/2006 (7:55 pm)
looks cool.
#3
11/14/2006 (9:01 pm)
Is this for TGE or just TGEA? It looks really cool, I'd love to have that in my game, but my machine won't run TGEA.
#4
11/14/2006 (9:05 pm)
Hi Tim, this is for use in TGEA. However, it can easily be adapted to fit CG water in Torque. The only problem I could see would be the heightmap in the dds.
#5
11/14/2006 (10:31 pm)
Its peanut butter jelly time!
#6
11/15/2006 (4:13 am)
What's with the grid-like (easily spottable in the bottom-right corner of the picture) texture? Is it a pixel shader artifact?
#7
11/15/2006 (5:32 am)
No, it is not an artifact. Just adjust the waveTexScale ingame to fit your needs.
#8
11/15/2006 (5:53 am)
Looks great! Any chance of a close up shot so we can see some more detail?
#9
11/15/2006 (6:08 am)
img216.imageshack.us/img216/1148/parallaxwater2ja3.png
#10
11/15/2006 (4:59 pm)
Care to post up an example material datablock? I can add the shader no problem, but not sure what I need to do to add it to the waterblock.
#11
11/15/2006 (5:47 pm)
new CustomMaterial( Water )
{
   texture[0] = "noise02.dds";
   texture[1] = "$reflectbuff";
   texture[2] = "$backbuff";
   texture[3] = "$fog";
   texture[4] = "$dynamiccubemap";
   shader = WaterParallaxTest;
   specular = "0.75 0.75 0.75 1.0";
   specularPower = 2.0;
   fallback = WaterFallback1_1;
   version = 2.0;
};
#12
11/15/2006 (5:49 pm)
DOH!!! didn't think to try the .dds on the texture ...

Thanks :D
#13
11/15/2006 (7:35 pm)
I'm sorry, I failed to properly test this. There are some known issues and I plan to update it soon.
#14
11/16/2006 (10:16 pm)
Thats looks beautiful
#15
03/23/2007 (1:42 am)
Hi, I followed your instructions and tried your resource, but failed. The water is all black. I think it something is not correct with .dds...
#16
01/21/2008 (12:21 am)
Looks awesome!
#17
01/24/2008 (3:32 pm)
Hi Matt, this is not strictly in topic but...
Do you know where can I find some info about .dds (way of usage, supported features etc...) in TGEA ?
Just made a search but found any usefull info...

;)
JoZ
#18
05/03/2008 (10:08 pm)
The block of code for the material file calles WaterParallaxTest shader. It should be,

shader = WaterParallax;

Chris

You can also get a clear bath water type look just by adding two lines.

new CustomMaterial( Water )
{
texture[0] = "noise02";
texture[1] = "$reflectbuff";
texture[2] = "$backbuff";
texture[3] = "$fog";
texture[4] = "$cubemap";
cubemap = Sky_Day_Blur02;
shader = WaterCubeReflectRefract;
specular = "0.75 0.75 0.75 1.0";
specularPower = 48.0;
fallback = WaterFallback1_1;
translucent = true; // <- added
translucentBlendOp = LerpAlpha; // <- added
version = 2.0;
};