Difference between revisions of "Css"

From Custom Map Makers Wiki
Jump to: navigation, search
(Use Case)
(Usage)
Line 44: Line 44:
 
Add the surfaceparm strip directive to shader to strip out of the bsp.
 
Add the surfaceparm strip directive to shader to strip out of the bsp.
  
Compile the bsp and vis stage as usual. Add the "-strip" options for the light stage of your compilation:
+
Compile the bsp and vis stage as usual. Add the '''-strip''' options for the light stage of your compilation:
  
 
     q3map2 -threads X ... -light ... -strip path/to/map.bsp
 
     q3map2 -threads X ... -light ... -strip path/to/map.bsp

Revision as of 14:43, 6 January 2012

CSS

CSS is an experimental modification of q3map2 2.5.16 map compiler. It allows to selectively strip drawSurfaces from the bsp generated by q3map2. CSS introduces a new shader surfaceparm directive called "strip". This directive instructs the q3map2 modified compiler to remove any surface textured with "strip" shaders from the bsp after the light stage.

Error.png Don't blame the tool if you waste hours of compilation for a broken bsp


Use Case

An interesting application of CSS is for maps that use invisible, non solid, light emitting shaders like the one below (the stage defines a fully transparent surface):

   textures/mytextures/light_white_1k
   {
     q3map_lightRGB 1.0 1.0 1.0
     q3map_surfacelight 1000
     
     surfaceparm nolightmap
     surfaceparm nonsolid
     surfaceparm trans
     {
       map $whiteimage
       alphaFunc GE128
       alphaGen const 0
     }
   }

Considering lights in Urbanterror are computed at compile time, surface painted with this shader have no effect ingame. With the addition of the surfaceparm strip directive, CSS can remove surface using this shader from the bsp generated by q3map in order to improve ingame performance (see test case below)

Internals

As of today, CSS does not remove the surface definitions from bsp files, It only invalidates references to stripped surfaces from the leaf nodes of the bsp trees.

Installation

Download CSS. CSS is provided as a single patch file for q3map2 2.5.16 source (CSS modifies 2 files, eg, game_quake3.h and light.c).

Place the downloaded file in your q3map2 source directory "tools/quake3/q3map2/"

Apply the patch to your q3map2 source using the patch command line tool (screw you windows' users)

   patch -p0 css.patch

Recompile q3map2 (from the root directory of the source tree):

   scons target=q3map2

Usage

Add the surfaceparm strip directive to shader to strip out of the bsp.

Compile the bsp and vis stage as usual. Add the -strip options for the light stage of your compilation:

   q3map2 -threads X ... -light ... -strip path/to/map.bsp

Success Stories

The CSS modification has been used for the creation of various maps:

ut4_azurea_a1

This project is the main motivation for the creation of CSS.

screenshots etc