New or Revised Q3map Shader Commands

q3map command line switches:

q3map
-----

-threads 
	Number of threads used to compile the map. For the fastest compile
	times the number of threads is set to the number of system processors.
-glview
	Write a .gl file of the bsp tree for debugging.
-v
	Output verbose information.
-draw
	Enable realtime debug drawing output.
-nowater
	Water, slime and lava brushes are not compiled and won't show up when running the map in Quake.
-noopt
	unused.
-nofill
	unused.
-nodetail
	Detail brushes are not compiled and won't show up when running the map in Quake.
-fulldetail
	Detail brushes will be treated as normal brushes.
-onlyents
	Only change the entities in a .bsp using a .ent file.
-onlytextures
	Only change the textures in a .bsp file.
-micro
	unused.
-nofog
	Visible surfaces that cross fog boundaries will not be split along the bound.
	This can cause visually incorrect fog in the map.
-nosubdivide
	Visible surfaces are not subdivided as required by shader tesselation.
	The shader parameter "tesssize" sets the tesselation of a surface.
-leaktest
	Only test the map for leaks. If a leak is found the compilation is stopped.
-verboseentities
	Output verbose information about entity sub-models.
-nocurves
	Curves are not compiled and won't show up when running the map in Quake.
-notjunc
	T-junctions are not fixed. This can cause tiny slits where a surface meets halfway another surface.
-expand
	Expands all the brush planes and saves a new map out to allow visual inspection of the clipping bevels
-tmpout
	Output files to a folder called "tmp".
-fakemap
	Write out a fakemap.map This map will contain a worldspawn entity with all the world brushes.
-samplesize 
	Set the lightmap pixel size to NxN units. Default 16x16.
-custinfoparms
	Will enable custom surface flags (see below)

q3map -vis
----------

-threads 
	Number of threads used to compile the map. For the fastest compile
	times the number of threads is set to the number of system processors.
-fast
	Only calculate a very loose visiblity list. It doesn't take much time to
	calculate but a lot more polygons will be drawn by the Q3 engine than necesary.
-merge
	Merge bsp leaves before calculating the visibility list. This will speed up
	the vis calculations but mostly more polygons will be drawn by the Q3 engine
	than necesary.
-nopassage
	Disable the passage visibility algorithm. The passage vis is faster and a bit more
	tight than the old algorithm.
-level
	unused.
-v
	Output verbose information.
-nosort
	Don't sort the portals on complexity. Sorting mostly speeds up visibility calculations
	because more complex portals can use information from less complex portals.
-saveprt
	Don't delete the .prt file after creating the visibility list.
-tmpin 
	Input files will be read from a folder called "tmp".
-tmpout 
	Output files will be written to a folder called "tmp".


q3map -light
------------

-threads 
	Number of threads used to compile the map. For the fastest compile
	times the number of threads is set to the number of system processors.
-area 
	This scales the light intensity of area lights.
-point 
	This scales the light intensity of point lights.
-notrace
	No light tracing is performed. As a result no shadows will be casted.
-patchshadows
	Enable patches casting shadows.
-novertex
	Don't calculate vertex lighting.
-nogrid
	Don't calculate light grid for dynamic model lighting.
-extra
	Take four samples per lightmap pixel and store the average light value of these
	four samples for the actual lightmap pixel.
	This super sampling is used for anti-aliasing.
-extrawide
	Just like -extra four samples per lightmap pixel are calculated. However the
	average of 12 samples is stored per lightmap pixel.
-samplesize 
	Set the lightmap pixel size to NxN units. Default 16x16.
-border
	Create a debugging border around the lightmap.
-v
	Output verbose information.
-nosurf
	unused.
-dump
	unused.


q3map -vlight
-------------

-threads 
	Number of threads used to compile the map. For the fastest compile
	times the number of threads is set to the number of system processors.
-area 
	This scales the light intensity of area lights.
-point 
	This scales the light intensity of point lights.
-novertex
	Don't calculate vertex lighting.
-nogrid
	Don't calculate light grid for dynamic model lighting.
-nostitching
	No polygon stitching before lighting.
-noalphashading
	Don't use alpha shading at all.
-nocolorshading
	Don't use colored alpha shading. The alpha channel will be used as if it were binary.
	The light goes through or not and does not change color.
-tracelight
	Use the "-light" light algorithm for all surface unless a surface
	uses a shader with the shader option "q3map_vlight".
-samplesize 
	Set the lightmap pixel size to NxN units. Default 16x16.
-v
	Output verbose information.

The q3map options are a subset of the shader instructions that require recompiling of the map.

q3map_tracelight

      [NEW] Surfaces using a shader with this option will always be lit with the original "-light" light algorithm. Patches will not cast shadows on this surface unless the shader option q3map_patchshadows is used.

q3map_patchshadows

      [NEW] When this option is used in conjunction with the original (-light) lighting algorithm, surfaces with textures modified by this option will will show shadows cast by curve patches (under normal circumstances, curve patches do not cast shadows).

q3map_vertexshadows

      [NEW] By default, no shadows are cast on vertex-only lit surfaces (see surfaceparm pointlight). Also when running Quake III Arena in vertex  lighting mode, no shadows are cast upon any surfaces (shadows are part of the light map). When using this shader option shadows *will* be cast on the surface when vertex lit. However sharp shadow edges won't be seen on the surface because light values are only calculated at the vertexes.

q3map_novertexshadows

      [NEW] Shaders used for misc_models and terrain can now use q3map_novertexshadows to disable shadows to be cast at the vertex lit surfaces. Shadows being cast at small misc_model objects often makes sense. However shadows on large vertex lit terrain surfaces often look bad. By default no shadows are cast at forced vertex list surfaces ( shaders with "pointlight" ).

q3map_forcesunlight

      [NEW] No sunlight is cast at vertex lit md3 models and terrain by default. Using this option sunlight (overbright bits created by q3map_sun option) will be cast on these surfaces.

q3map_vertexscale <scale>

      [NEW] The light value at the vertexes of a surface using a shader with this option is multiplied by the scale value. This is a way to lighten or darken a vertex light only surface in comparison to other, light-map lit surfaces around it.

q3map_notjunc

      [NEW] Surfaces modified by a shader with this option are not used for tjunction fixing.

q3map_vlight

      [NEW] Surfaces modified by a shader with this option will always be lit with the "-vlight" algorithm when q3map is used with the options "-vlight -tracelight".

q3map_lightmapsamplesize <S>

      [NEW] Surfaces using a shader with this shader option will use lightmaps with pixel size SxS. This option can be used to produce high resolution shadows on certain surfaces or can be used to reduce the size of lightmap data where high resolution shadows are not required.

q3map_lightimage <image>

      Image to use for the light color of a surface light instead of the image(s) used by the shader. Color is averaged from the texture. Texture must be the same size as the base image map.

q3map_surfacelight <value>

Sets the amount of light this surface emits.

q3map_lightsubdivide <value>

      A surface light is subdivided into a bunch of point lights for the actual lighting of the world. This parameter controls the space between those point lights. Default value is 120.

q3map_backsplash <percent> <distance>

      A surface light is also lit by itself using back splash point lights with a lower intensity. The <percent> parameter specifies the intensity percentage they use from the q3map_surfacelight <value> parameter. The <distance> parameter controls the distance of these back splash lights from the surface. You can set the <percent> to zero or a negative value to disable the back splash lights.

      q3map_globaltexture

When this option is set the texture is not aligned to the world.

      q3map_backshader <shader>

<shader> is the path/name of the shader or texture to be used at the back side of the surface.

      q3map_flare <shader>

Creates a flare using the specified <shader> at the center of the surface using a shader with this option.

      light <value>

Old style flare specification always using the shader "flareshader". The <value> parameter is unused.

      q3map_sun <red> <green> <blue> <intensity> <degrees> <elevation>

Color will be normalized, so it doesn't matter what range you use. The intensity falls off with angle but not distance. A value of 100 is a fairly bright sun.

      degree of 0 = from the east, 90 = north, etc.

      elevation of 0 = sunrise/set, 90 = noon

      surfaceparm pointlight

Surfaces using a shader with this parameter will always be vertex lit

This option can be used to reduce the lightmap data. Often used on surfaces

that don't need any shadows.

Surfaceparm dust

If a player lands (jumps onto) on a surfaces using a shader with this parameter, a put of dust will appear at the player’s feet. Note that the worldspawn entity of that map must have an enableDust key set to a value of 1.

Custom surfaceparms

With the new q3map tool you can add custom surface parameters for mods without the need to recompile the q3map tool. These custom surfaceparms are stored in a file called ‘custinfoparms.txt’ in the folder scripts/. An example of this file with the new surfaceparm treacle and surfaceparm grass is shown below.

// Custom Infoparms File
// Custom Contentsflags
{
treacle 0x4000
}
// Custom Surfaceflags
{
grass 0x80000
}

 

NOTE: For linux users, when using the -custinfoparms parameter q3map first looks in your homedir, and only if it doesn't find a custinfoparms.txt there, it uses the one stored in the

quake3 install dir (usually /usr/local/games).

 

Content Flags

Contents flags are flags similar to CONTENTS_FOG in the original Q3A. These flags define the contents of volumes inside the game (for instance lava, fog, water, etc.).

If you look in the source file game/surfaceflags.h, it has defines for all contents flags. The define is split into a name and a hexadecimal value, for instance CONTENTS_PLAYERCLIP 0x10000. These hexadecimal values are powers of 2 and can be ored together (binary) to form a bit mask. Up to 32 contents flags can be ored together this way.

Example: creating a volume with treacle.

The following outlines how a custom contents flag can be added and used in a mod. First open the ‘custinfoparms.txt’ file and add ‘treacle 0x4000’ to the Custom Contentsflags section as shown in the example file above (0x4000 is one of the unused values available for custom use). Next write a shader script which uses ‘surfaceparm treacle’. Apply this new shader to all sides of a brush in a test map. When you compile the map, add the -custinfoparms parameter to the command line following q3map.

Next, add CONTENTS_TREACLE 0x4000 to the source file game/surfaceflags.h in your mod. Now you can call the point contents function. If the point is inside the brush with the shader using the ‘surfaceparm treacle’ then the point contents call will return a bit mask with CONTENTS_TREACLE set. This can for instance be used to slow down player movement when a player is inside such a brush.

 

Surface Flags

The surface flags are texture properties that often affect entities in contact with surfaces using such flags. The ‘surfaceparm metalsteps’ parameter from Q3A is a good example.

If you look in the source file game/surfaceflags.h, it has defines for all surface flags. The define is split into a name and a hexadecimal value, for instance SURF_NODAMAGE 0x1. These hexadecimal values are powers of 2 and can be ored together (binary) to form a bit mask. Up to 32 surface flags can be ored together this way.

Example: Making ‘footsteps on grass’ sounds

The following outlines how a custom surface flag can be added and used in a mod. First open up the ‘custinfoparms.txt’ file and add 'grass 0x80000' to the Custom Surfaceflags section as shown in the example file above (0x80000 is the first available unused value in surfaceflags.h for surface flags). Next write a shader script which uses a grass image and has 'surfaceparm grass’. Create a test map with the grass shader covering the ground surface. When you compile the map, add the -custinfoparms parameter to the command line following q3map.

Next, add SURF_GRASS 0x80000 to the source file game/surfaceflags.h in your mod. Now you'll be able to execute a trace and the trace information will be returned in the trace_t structure. If the trace hits a surface with the grass surfaceparm then the SURF_GRASS flag will be set in trace_t->surfaceFlags. Such a trace can be used to trigger playing a sound of a person stepping on grass. For a reference example, see the existing metal steps in the game code.

 

 

Back - Table of Contents - Links

 

 

 

-27-