Author Topic: Fog shader: did I do it right?  (Read 6423 times)

swamp-cecil

  • Posts: 774
  • Turrets: +80/-163
    • Tremulous
Fog shader: did I do it right?
« on: November 13, 2011, 06:42:35 pm »
I am making a fog shader for my map. Did I do it right? I want the fog to be a orange colour
Code: [Select]
{
qer_editorimage textures/uncreation/blue
surfaceparm fog
fogparms 0.8 0.5 0.1
}
these are stupid suggestions, don't even waste our time.
I don't like your negative attitude.

Knowitall66

  • Posts: 492
  • Turrets: +70/-52
Re: Fog shader: did I do it right?
« Reply #1 on: November 13, 2011, 11:19:35 pm »
Your 'qer_editorimage' attribute is missing the file type also your missing a parameter for the 'fogparam' attribute.

Extract from the Shader Manual;
Quote from: Q3AShaderManual ( http://www.airrocket.net/mirror/quake3/shadermanual/ )
3.4 fogparms <red value> <green value> <blue value> <distance to Opaque>
 Note: you must also specify "surfaceparm fog" to cause q3map to identify the surfaces inside the volume. Fogparms only describes how to render the fog on the surfaces.

<red value> <green value> <blue value> These are normalized values. A good computer art program should give you the RGB values for a color. To obtain the values that define fog color for Quake III Arena , divide the desired color's Red, Green and Blue values by 255 to obtain three normalized numbers within the 0.0 to 1.0 range.

<distance to opaque> This is the distance, in game units, until the fog becomes totally opaque, as measured from the point of view of the observer. By making the height of the fog brush shorter than the distance to opaque , the apparent density of the fog can be reduced (because it never reaches the depth at which full opacity occurs)..

Also there are a number of other attributes that should be used as well, I'd advise you start with an existing fog shader and tweak it to look how you want it to.

Example Fog Shader from Flap;
Code: [Select]
textures/flap/flap_fog_s
{
qer_editorimage textures/common-trem/nobuild.tga
surfaceparm trans
surfaceparm nonsolid
surfaceparm fog
surfaceparm nolightmap
qer_nocarve
fogparms ( 0.05 0.05 0.05 ) 500
}

Further extract from the shader manual in regards to the use of fog, in case your not already familiar with it;
Quote
- The fog volume can only have one surface visible (from outside the fog).
- Fog must be made of one brush. It cannot be made of adjacent brushes.
- Fog brushes must be axial. This means that only square or rectangular brushes may contain fog, and those must have their edges drawn along the axes of the map grid (all 90 degree angles).


Design Notes:

- If a water texture contains a fog parameter, it must be treated as if it were a fog texture when in use.
- If a room is to be filled completely with a fog volume, it can only be entered through one surface (and still have the fog function correctly).
- Additional shader passes may be placed on a fog brush, as with other brushes.
« Last Edit: November 13, 2011, 11:23:21 pm by Knowitall66 »