Quake3World.com Forums
     Level Editing & Modeling
        Proper use of water shaders?


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: Proper use of water shaders?

Boink!
Boink!
Joined: 19 Apr 2003
Posts: 4493
PostPosted: 11-20-2009 04:00 AM           Profile Send private message  E-mail  Edit post Reply with quote


This is probably quite known, but I never really looked into it since I normally never use water.

When you use a id water shader on a complete brush and place its edges "in the geometry" to avoid edge and floor "overlap" effects, I noted that the geometry deformations are seen on all the water brush edges (r_showtris), thus wasting resources. I then just turned the top texture "water" and the other faces nodraw. That keeps the surface working, it still "looks" like water, but has lost the water properties (e.g. splashing sound).

What is the proper way to place water shaders?

(My guess is that the "first" random face is picked, it's nodraw and thus the water properties are lost?)




Top
                 

Mercenary
Mercenary
Joined: 24 Mar 2008
Posts: 223
PostPosted: 11-20-2009 04:10 AM           Profile Send private message  E-mail  Edit post Reply with quote


I think your guess is right. I have a nodrawwater shader for this purpose.




Top
                 

Boink!
Boink!
Joined: 19 Apr 2003
Posts: 4493
PostPosted: 11-20-2009 04:21 AM           Profile Send private message  E-mail  Edit post Reply with quote


Could you copy/paste that nodrawwater shader here?

It probably looks like this?

    textures/common/nodrawwater
    {
    qer_editorimage textures/common/nodraw.tga
    surfaceparm nodraw
    surfaceparm nolightmap
    surfaceparm nonsolid
    surfaceparm trans
    surfaceparm nomarks
    surfaceparm water
    }




Top
                 

Warrior
Warrior
Joined: 07 Aug 2009
Posts: 76
PostPosted: 11-20-2009 06:54 AM           Profile Send private message  E-mail  Edit post Reply with quote


I will make no claims to have done this "right," but I used a trick to control the water surface better in tabq1dm5:

  • I wrote a shader for water effects, that has no stages, but just creates an invisible water brush (with fog). This has "q3map_noTJunc" and "q3map_noClip" added to avoid unnecessary addition of polygons (dunno if you really need both).
    - I placed various mesh patches to fill the surface area for the rooms, so the whole water surface is covered with a visible layer. Then I wrote a shader for that, which gave me all the control I needed for lightmap and making both sides of the shader different.

That really helped me get the effects I wanted. It will probably be considered a hack by most, but what the heck.



_________________
www.tabun.nl


Top
                 

I'm the dude!
I'm the dude!
Joined: 04 Feb 2002
Posts: 12498
PostPosted: 11-20-2009 08:12 AM           Profile Send private message  E-mail  Edit post Reply with quote


The problem with water and no draw is that they are placed on the same brush and as far as the entire properties of the brush is concerned, Q3Map2 has no idea which shader to take priority over the other, so it chooses one at random and uses that. Sometimes, you'll find that you recompile and it works, other times, it won't.

To take some of the silly randomness out of the equation, you can use a modified watercaulk shader.

Code:
// Obsidian: 2 usages for watercaulk depending on water brush complexity
// SIMPLE WATER BRUSHES - use watercaulk on faces between water brushes
// COMPLEX WATER BRUSHES - overlap complex water brushes with watercaulk.
//      Water shader should be nodraw, nonsolid, trans, *sans-water*
textures/common/watercaulk
{
   qer_trans 0.5
   surfaceparm nodraw
     surfaceparm nonsolid
     surfaceparm trans
     surfaceparm water
}


Also, editor image here

Note that there are two methods of using this, on relatively simple water surfaces (just a few brushes) texture the top of the water with your water shader and the rest with watercaulk. On complex water surfaces, create a new water surface shader (nodraw, nonsolid, trans, NO surfaceparm water) applied to the top face of the visible water surface with nodraw on all other faces and overlap the entire swim-able area with one or more watercaulk volumes.

Edited for clarity



_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 

Boink!
Boink!
Joined: 19 Apr 2003
Posts: 4493
PostPosted: 11-20-2009 09:14 AM           Profile Send private message  E-mail  Edit post Reply with quote


obsidian wrote:
The problem with water and no draw is that they are placed on the same brush and as far as the entire properties of the brush is concerned, Q3Map2 has no idea which shader to take priority over the other, so it chooses one at random and uses that. Sometimes, you'll find that you recompile and it works, other times, it won't.


I seem to remember we had this discussion on the topic of glass in AEneon... I had been wondering why the weapon clipping would work on some glass faces and not on others (at random). I ended up always placing weapclip right over all the glass brushes.

Will give your watercaulk a spin... though in my case these are all trivial 1-brush water areas on rectangular floor areas.




Top
                 

Boink!
Boink!
Joined: 19 Apr 2003
Posts: 4493
PostPosted: 11-20-2009 10:12 AM           Profile Send private message  E-mail  Edit post Reply with quote


Hmm... using id's clear_calm1 water shaders and your watercaulk, this *totally* messes up everything. Not only are the brush edges still drawn, the shader is treated like caulk you look right through the map floor (at full bright).

What is going on here?

Update: Solution... simply put the water shaders on all brush faces (in my simple 1-brush fills up everything case), then *ensure* that you drag the water brush faces (other than the top surface face obviously) into solid geometry (or void), and bingo all "useless" side faces are gone and it works. Edges in detail geometry are *not* removed!




Top
                 

btw cocks
btw cocks
Joined: 16 Aug 2003
Posts: 3216
PostPosted: 11-21-2009 10:21 AM           Profile Send private message  E-mail  Edit post Reply with quote


does clear_calm1 have surfaceparm water?

if so, that would be why it doesn't work in conjunction with watercaulk




Top
                 

btw cocks
btw cocks
Joined: 16 Aug 2003
Posts: 3216
PostPosted: 11-21-2009 10:27 AM           Profile Send private message  E-mail  Edit post Reply with quote


honestly doing what Obsidian described, separating the "media volume" (hey it is a brush inside the bounds of which one may swim) functionality of water from the visual surface quality, that is really the best course of action

watercaulk brush to define the media volume, then just create a patch or something and apply a shader to it to create the visuals for the water surface itself




Top
                 

Boink!
Boink!
Joined: 19 Apr 2003
Posts: 4493
PostPosted: 11-21-2009 10:31 AM           Profile Send private message  E-mail  Edit post Reply with quote


It does... I must have misread the application of watercaulk. I though you only need to change the water shader, i.e. remove the surfaceparm water if you are using watercaulk in the second case. Seems I was wrong.




Top
                 

Warrior
Warrior
Joined: 07 Aug 2009
Posts: 76
PostPosted: 11-21-2009 11:21 AM           Profile Send private message  E-mail  Edit post Reply with quote


I'm kind of lost now. Are you guys talking about what I suggested or what obsidian suggested? Obsidian's method is bound to be the way to go, seeing as he's the shader guru. I just thought up a hack that seemed to work well enough for what I needed.



_________________
www.tabun.nl


Top
                 

Mercenary
Mercenary
Joined: 24 Mar 2008
Posts: 223
PostPosted: 11-22-2009 02:23 AM           Profile Send private message  E-mail  Edit post Reply with quote


AEon wrote:
Could you copy/paste that nodrawwater shader here?


It's just nodraw with surfaceparm water added.




Top
                 

Etile
Etile
Joined: 19 Nov 2003
Posts: 34899
PostPosted: 11-22-2009 11:39 AM           Profile Send private message  E-mail  Edit post Reply with quote


ydnar had a water caulk shader that worked great (as a substitute for nodrawing all the non-surface sides). damned if i can find it though :(




Top
                 

I'm the dude!
I'm the dude!
Joined: 04 Feb 2002
Posts: 12498
PostPosted: 11-22-2009 07:20 PM           Profile Send private message  E-mail  Edit post Reply with quote


ydnar's water caulk shader is the same as the one I have above.



_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 
Quake3World.com | Forum Index | Level Editing & Modeling


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.