Difference between revisions of "Textures:Shaders"

From Custom Map Makers Wiki
Jump to: navigation, search
(What is a shader?)
(I have rewritten whole page to make it friendly for people who have no idea what 'shaders' are. It might sound retarded for medium/advanced mapper, but newbies will understand it clearly.)
Line 1: Line 1:
 
{{WIP}}
 
{{WIP}}
  
== What is a shader? ==
 
Shaders are short text scripts that define the properties of a surface as it appears and functions in a game world or radiant.
 
  
By convention, the documents that contain these scripts usually has the same name as the texture set which contains the textures being modified (e.g; ut4_mymap, bobsmap, castle, etc,). Several specific script documents have also been created to handle special cases, like liquids, sky and special effects.
+
Shader is short text string, that defines the properties of texture. Using texture in Radiant on solid brush which has to be a simple wall doesn't require to write a shader for it. Every other surface with special attribute - it does. Shaders tells Q3 engine what kind of surface it has to deal with. Wall, water, sky, mirror, etc. You can have sky texture, but it wont act as a 'real' sky in game until you write a shader for it.
  
These are called the common shaders. Their definition comes from a textfile, normally found in your mapping/scripts folder called common.shader.
+
Your main shader file should always be named as your map: ut4_mymap.shader. You should keep it in your /scripts folder and also make sure, it's in your shaderlist.txt file, which is also in /scripts folder. You can call shaderlist.txt 'the main list of shaders'. If it is not on the main list, it will not be on the list in the GTK Radiant Level Editor.
  
The bitmap images for common shaders can be found in the [[File:common-spog.pk3]].
+
You must understand the difference between shader '''file''' and '''shader'''. ut4_yourmap.shader file consists shaders - it might sound complicated, but mappers use term "shader" for every single one texture with special attributes. So when someone speaks about 'shader', he speaks about a particular fragment of your shader file.
 +
 
 +
 
 +
Let's use exmaple:
 +
 
 +
<pre>
 +
textures/ut_subway/plant_bush01
 +
 
 +
{
 +
        qer_editorimage textures/ut_subway/w2k_bush1.tga
 +
    surfaceparm trans
 +
  surfaceparm nonsolid
 +
//DeformVertexes autosprite2
 +
cull none
 +
        nopicmip
 +
{
 +
map textures/ut_subway/w2k_bush1.tga
 +
blendFunc GL_ONE GL_ZERO
 +
alphaFunc GE128
 +
depthWrite
 +
rgbGen identity
 +
}
 +
{
 +
map $lightmap
 +
rgbGen identity
 +
blendFunc GL_DST_COLOR GL_ZERO
 +
depthFunc equal
 +
}
 +
}
 +
textures/ut_subway/chain_link
 +
{
 +
        qer_editorimage textures/ut_subway/fence.tga
 +
    surfaceparm trans
 +
  //surfaceparm nonsolid
 +
//DeformVertexes autosprite2
 +
cull none
 +
        nopicmip
 +
{
 +
map textures/ut_subway/fence.tga
 +
blendFunc GL_ONE GL_ZERO
 +
alphaFunc GE128
 +
depthWrite
 +
rgbGen identity
 +
}
 +
{
 +
map $lightmap
 +
rgbGen identity
 +
blendFunc GL_DST_COLOR GL_ZERO
 +
depthFunc equal
 +
}
 +
}
 +
</pre>
 +
 
 +
 
 +
This is fragment of shader file for "ut4_subway" map. I pasted 2 shaders from it - for plant_bush01 and chain_link. Your shader file will also consists several shaders written by you.
 +
 
 +
 
 +
The most basic shader will consist at least one texture and one script for it. By the time You will learn to create complicated ones, to achieve special and unique effects for your map. Complete manual explaing all the parameters, strings and variables is here: [http://www.custommapmakers.org/wiki/shaders/index.html here]
 +
 
 +
 
 +
Like famous Rayne said once: 'It's all in the shaders'.
  
== Reference ==
 
The complete manual is available [http://www.custommapmakers.org/wiki/shaders/index.html here]
 
  
 
[[Category:Textures]]
 
[[Category:Textures]]

Revision as of 11:34, 20 August 2011

Roadworks.png This page is work in progress!


Shader is short text string, that defines the properties of texture. Using texture in Radiant on solid brush which has to be a simple wall doesn't require to write a shader for it. Every other surface with special attribute - it does. Shaders tells Q3 engine what kind of surface it has to deal with. Wall, water, sky, mirror, etc. You can have sky texture, but it wont act as a 'real' sky in game until you write a shader for it.

Your main shader file should always be named as your map: ut4_mymap.shader. You should keep it in your /scripts folder and also make sure, it's in your shaderlist.txt file, which is also in /scripts folder. You can call shaderlist.txt 'the main list of shaders'. If it is not on the main list, it will not be on the list in the GTK Radiant Level Editor.

You must understand the difference between shader file and shader. ut4_yourmap.shader file consists shaders - it might sound complicated, but mappers use term "shader" for every single one texture with special attributes. So when someone speaks about 'shader', he speaks about a particular fragment of your shader file.


Let's use exmaple:

textures/ut_subway/plant_bush01

{
        qer_editorimage textures/ut_subway/w2k_bush1.tga
    	surfaceparm trans
   	surfaceparm nonsolid
	//DeformVertexes autosprite2
	cull none
        nopicmip
	{
		map textures/ut_subway/w2k_bush1.tga
		blendFunc GL_ONE GL_ZERO
		alphaFunc GE128
		depthWrite
		rgbGen identity
	}
	{
		map $lightmap
		rgbGen identity
		blendFunc GL_DST_COLOR GL_ZERO
		depthFunc equal
	}
}
textures/ut_subway/chain_link
{
        qer_editorimage textures/ut_subway/fence.tga
    	surfaceparm trans
   	//surfaceparm nonsolid
	//DeformVertexes autosprite2
	cull none
        nopicmip
	{
		map textures/ut_subway/fence.tga
		blendFunc GL_ONE GL_ZERO
		alphaFunc GE128
		depthWrite
		rgbGen identity
	}
	{
		map $lightmap
		rgbGen identity
		blendFunc GL_DST_COLOR GL_ZERO
		depthFunc equal
	}
}


This is fragment of shader file for "ut4_subway" map. I pasted 2 shaders from it - for plant_bush01 and chain_link. Your shader file will also consists several shaders written by you.


The most basic shader will consist at least one texture and one script for it. By the time You will learn to create complicated ones, to achieve special and unique effects for your map. Complete manual explaing all the parameters, strings and variables is here: here


Like famous Rayne said once: 'It's all in the shaders'.