< GtkRadiant

Shader Syntax

GtkRadiant

A shader file consists of a series of surface attribute and rendering instructions formatted within braces: { and }. It uses a syntax similar to the C programming language. All shaders and shader examples in this book will be commented, with the comments being the stuff behind the //. Since this is commented out by the engine as well, you may just leave it if you copy and paste the shader. Below you can see a simple example of syntax and format for a single process, including the Q3Map2 keywords and Surface Parameters, which follow the first bracket and a single bracketed stage:

 textures/liquids/lava-example //Shader Name
 { //Opens the main shader stage
 	deformVertexes wave sin 0 3 0 0.1 //General Shader Keywords
 	q3map_tessSize 64 //Q3Map2 Specific Shader Keywords
 	surfaceparm lava //Q3Map2 Specific Surface Parameter Shader Keywords
 	qer_editorimage textures/common/lava.tga //Editor Specific Shader Keywords
     { //Opens a substage
 	map textures/common/lava.tga //Stage Specific Shader Keywords
     } //Closes the substage
 } //Closes the main stage

Shaders need to be referenced by the map editor, compiler (Q3Map2) and game engine - each of which uses a different part of the shader. In the above example shader, the different sections are listed on the right.

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.