Non-Reflective Water

Downloads

NonReflectiveWater.rar [7.9Mb] – C# 2.0 (VS.NET 2005)

Description

I had a request from a MMORPG developer to make a lightweight water shader that doesn’t need a reflection rendersurface, yet looks acceptable.
It looks nowhere as shiny as the reflective water shader or even TV’s built-in water, but it runs a zillion times faster because it doesn’t do any parallaxing, nor specular bumpmapping, nor perspective projection… Its implementation is alot simpler as well.

Features

  • Two test environments : sunset and day skies
  • Uses a L8 (8-bit grayscale luminance) texture for alphablending, which allows semi-transparent shores
  • Two lookups of the same normal-map, scrolling in opposite directions, is used to simulate wave animation
  • Diffuse bump-mapping is made using the composite normal-map
  • A specular/gloss-map defines the specular spots; it’s also bumped by the normal-map
  • Two parameterized colors define the darkest and lightest parts of the water
  • Supports vertex fog in both SM2.0 and SM3.0 paths (this version does not yet map to TV3D semantics… will be updated soon)

Screenshots

12 thoughts on “Non-Reflective Water”

  1. Renaud.

    I cannot get this project to run when I unzip it. I get this message..
    error PRJ0019: A tool returned an error code from “Preforming Custom Build Step”.

    Also, there is a file column and “Shaders” is listed under that column. Any idea? This tutorial is exactly what I was looking for too. A light weight water system so as to not kill my frame rate.

    I have been surfing this web site and your skills are amazing. Also, this is a total shot in the dark but I have to ask… Did you ever play DAOC?, I frequently ran up against a plaer named Zaknafein.

  2. I got past that error by just removing the shader from the project. However, I now get a memory access violation error. I suspect its cause I’m using a new version of the MTV3D65.dll then you did cause I see licsense input boxes. I’ll try and track down an older dll and reference that

  3. Yes, the shader project was referencing a tool that is in the DirectX SDK and it’s an old version, so the usage probably changed… deleting the shader project solves this, and it’s not necessary.

    For the other problem, try making it work with the newest TV3D DLLs. There are breaking changes that occured in TV3D since then, like you have to do Scene.CreateLandscape instead of “= new TVLandscape()”, probably other ones… but yeah, running with an old DLL won’t help much.
    You should remove everything about beta keys too.

  4. I got most of your tutorial working by making the changes you suggested, thanks. The landscape does not render, but that’s ok since I’m focusing on the water.

    Now here is the unfortunate part for me….When I add your water code (not landscape) to my project I don’t get anything and there are no errors in the debug file. I don’t even see the blank mesh I usually get when something only partially works. Any ideas? it should appear at the coordinates I set in the AddFloorGrid() method, correct?
    I did not add your water class directly, I just copied the code from it and put it in the “code behind” file of my main form.

  5. Hard to tell what’s the problem here… Check the TV debug file, maybe you’re missing resources like shaders or textures.
    One thing to keep in mind, this shader uses an alpha (transparency) map that defines the shores and that lets the terrain be visible in those areas.

  6. Finally, someone can make it run??
    I can only see the landscape but no the water.
    I’m removing the shader from the project, and removing the “Engine.SetBetaKey(settings but nothing…)” part. but nothing
    I changed this part “Scene.CreateLandscape instead of “= new TVLandscape()” whit the same result.
    any ideas??

  7. Hi jp, I just tested it and there seems to be a problem with the SM3 technique of the shader.
    It’s really wierd because it compiles in most compilers (SFxE and XNA) but when I build the effect in TV3D it rejects it.
    Workaround : Remove the SM3 technique and leave only the SM2 one, then it works.

  8. Nop, I can not make to run properly, I only can se de landscape but nothing about nonreflect water. Can you explain me more specificly what is the problem? what I need to do? I can not understand the meaning of SM2 and SM3 and how to fix the problem.
    Thanks for your time.

Leave a Reply

Your email address will not be published. Required fields are marked *