List of shaderParm variables: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
m (update water shaderparms)
No edit summary
 
(23 intermediate revisions by 6 users not shown)
Line 22: Line 22:
|0.00 to 1.00
|0.00 to 1.00
|Red value set by [[_color]] spawnarg in the editor
|Red value set by [[_color]] spawnarg in the editor
|once
Damage overlay (tunnel vision): Time since the last damage, so when damage occurs, it can flash
|once<br>run-time


|-
|-
Line 40: Line 41:
|0.00 to 1.00 (or to X.yz)
|0.00 to 1.00 (or to X.yz)
Set by spawnarg shaderParm3 on the entity in the editor.
Set by spawnarg shaderParm3 on the entity in the editor.
|Materials: Alpha (transparency) value, eg, alphatest 0.8. Also used in some LOD materials as the alpha threshold, in this case the engine adjusts the value between 0 and 1.0 at runtime depending on distance to the player.
|Materials: Alpha (transparency) value, eg, alphatest 0.8. Also used in some LOD materials as the alpha threshold. In this case the engine adjusts the value between 0 and 1.0 at runtime depending on distance to the player.
Foglights: Distance in units beyond which fog is completely opaque (so higher values make fog thinner.)
Foglights: Distance in units beyond which fog is completely opaque (so higher values make fog thinner.)
|once<br>run-time
 
Damage overlay (tunnel vision): Alpha, based on player health
 
Light flicker: on flickering lights with a value 0 to 1 to vary the flicker offset so they don't all flicker in sync. Typically used on candles and oil lamps.
|once


|-
|-
|4
|4
|0 to 1
|0 to 1
|set shaderparm4 on flickering lights with a value 0 to 1 to vary the flicker offset so they don't all flicker in sync.
|Light flicker: on flickering lights with a value 0 to 1 to vary the flicker offset so they don't all flicker in sync. Typically used on candles and oil lamps.
|?
|?


|-
|-
|5
|5
|?
|about 0.05 .. 0.5
|?
|Used by [[atdm:liquid_water]] entities to control the (translation) speed of the water waves. Default is 0.1.
|?
|once


|-
|-
|6
|6
|?
|about 0.5 .. 3
|?
|Used by [[atdm:liquid_water]] entities to control the height of the vertex waves. Default is 1.5.
|?
|once


|-
|-
|7
|7
|0..1 (brightness)
|0..1 (brightness)
|Used by the moon-light textures in <code>textures/darkmod/sfx/</code>
 
 
 
0..1 (speed)
|Used by the moonlight textures in <code>textures/darkmod/sfx/</code>
 
Also used by some tree entities to vary leaf movement speed, eg, for wind. See [[Trees and how to make custom ones]]
|once
|once


|-
|-
|8
|8
|0.01 .. 0.5
|0..360
|Used by atdm:liquid entities to control the speed of the water-texture-waves
|Used by the clock hand decals to mimic time-keeping
|run-time
 
'''Warning:''' don't set shaderParm8 on anything with an MD5 model. (It seems to activate code that had a use at some point during Doom 3's development but is now glitched.)
|run-time by script


|-
|-
|9
|9
|1.0 .. 2
|?
|Used by atdm:liquid entities to control the speed of the water (purpose is not clear a.t.m.)
|?
|run-time
|?


|-
|-
Line 93: Line 106:


|}
|}
Angry and possibly ill-informed rant:
''It seems that'' '''Renderworld.h''' ''defines the default values of these parms and their intended use cases.''
<br>''Even in this primary resource, you can see that many of the parm values are '''"shared"''' so that in one context''
<br>'' '''they do one thing''' and in another context (model type, particle spawning, etc) '''they do something else'''.''
<br>''(Explaining the cautionary note about parm 8 and md5. Mappers being caught completely unawares of realtime "skinscale" changes.).''
<u>Did they REALLY need to limit this to '''12 SLOTS'''!?!?</u>
<pre>
// shader parms
#define MAX_GLOBAL_SHADER_PARMS 12
#define SHADERPARM_RED 0
#define SHADERPARM_GREEN 1
#define SHADERPARM_BLUE 2
#define SHADERPARM_ALPHA 3
#define SHADERPARM_TIMESCALE 3
#define SHADERPARM_TIMEOFFSET 4
#define SHADERPARM_DIVERSITY 5 // random between 0.0 and 1.0 for some effects (muzzle flashes, etc)
#define SHADERPARM_MODE 7 // for selecting which shader passes to enable
#define SHADERPARM_TIME_OF_DEATH 7 // for the monster skin-burn-away effect enable and time offset
// model parms
#define SHADERPARM_MD5_SKINSCALE 8 // for scaling vertex offsets on md5 models (jack skellington effect)
#define SHADERPARM_MD3_FRAME 8
#define SHADERPARM_MD3_LASTFRAME 9
#define SHADERPARM_MD3_BACKLERP 10
#define SHADERPARM_BEAM_END_X 8 // for _beam models
#define SHADERPARM_BEAM_END_Y 9
#define SHADERPARM_BEAM_END_Z 10
#define SHADERPARM_BEAM_WIDTH 11
#define SHADERPARM_SPRITE_WIDTH 8
#define SHADERPARM_SPRITE_HEIGHT 9
#define SHADERPARM_PARTICLE_STOPTIME 8 // don't spawn any more particles after this time
</pre>


== See also ==
== See also ==

Latest revision as of 21:22, 9 January 2019

Variables named shaderParm0 to shaderParm11 influence the rendering of certain materials. They are either set once in the map editor for some specific entity, or at run-time by various scripts or the C++ code.

Inside material definitions, these can be accessed via parm0 ... parm11.

The parms are on a per-entity base, so you can f.i. influence the material (and thus color) of entities or the color of the light.

See also the list of global variables.

List of shaderParms

# Value Used by Type
0 0.00 to 1.00 Red value set by _color spawnarg in the editor

Damage overlay (tunnel vision): Time since the last damage, so when damage occurs, it can flash

once
run-time
1 0.00 to 1.00 Green value set by _color spawnarg in the editor once
2 0.00 to 1.00 Blue value set by _color spawnarg in the editor once
3 0.00 to 1.00 (or to X.yz)

Set by spawnarg shaderParm3 on the entity in the editor.

Materials: Alpha (transparency) value, eg, alphatest 0.8. Also used in some LOD materials as the alpha threshold. In this case the engine adjusts the value between 0 and 1.0 at runtime depending on distance to the player.

Foglights: Distance in units beyond which fog is completely opaque (so higher values make fog thinner.)

Damage overlay (tunnel vision): Alpha, based on player health

Light flicker: on flickering lights with a value 0 to 1 to vary the flicker offset so they don't all flicker in sync. Typically used on candles and oil lamps.

once
4 0 to 1 Light flicker: on flickering lights with a value 0 to 1 to vary the flicker offset so they don't all flicker in sync. Typically used on candles and oil lamps. ?
5 about 0.05 .. 0.5 Used by atdm:liquid_water entities to control the (translation) speed of the water waves. Default is 0.1. once
6 about 0.5 .. 3 Used by atdm:liquid_water entities to control the height of the vertex waves. Default is 1.5. once
7 0..1 (brightness)


0..1 (speed)

Used by the moonlight textures in textures/darkmod/sfx/

Also used by some tree entities to vary leaf movement speed, eg, for wind. See Trees and how to make custom ones

once
8 0..360 Used by the clock hand decals to mimic time-keeping

Warning: don't set shaderParm8 on anything with an MD5 model. (It seems to activate code that had a use at some point during Doom 3's development but is now glitched.)

run-time by script
9 ? ? ?
10 ? ? ?
11 0 or 1 non-zero when something is highlighted for frob. This is used by material definitions to make materials "light up" when entities are in the frob-highlight. run-time

Angry and possibly ill-informed rant:

It seems that Renderworld.h defines the default values of these parms and their intended use cases.
Even in this primary resource, you can see that many of the parm values are "shared" so that in one context
they do one thing and in another context (model type, particle spawning, etc) they do something else.
(Explaining the cautionary note about parm 8 and md5. Mappers being caught completely unawares of realtime "skinscale" changes.).

Did they REALLY need to limit this to 12 SLOTS!?!?


// shader parms
#define	MAX_GLOBAL_SHADER_PARMS		12

#define SHADERPARM_RED				0
#define SHADERPARM_GREEN			1
#define SHADERPARM_BLUE				2
#define SHADERPARM_ALPHA			3

#define SHADERPARM_TIMESCALE		3
#define SHADERPARM_TIMEOFFSET		4
#define SHADERPARM_DIVERSITY		5	// random between 0.0 and 1.0 for some effects (muzzle flashes, etc)
#define SHADERPARM_MODE				7	// for selecting which shader passes to enable
#define SHADERPARM_TIME_OF_DEATH	7	// for the monster skin-burn-away effect enable and time offset

// model parms
#define SHADERPARM_MD5_SKINSCALE	8	// for scaling vertex offsets on md5 models (jack skellington effect)
#define SHADERPARM_MD3_FRAME		8
#define SHADERPARM_MD3_LASTFRAME	9
#define SHADERPARM_MD3_BACKLERP		10

#define SHADERPARM_BEAM_END_X		8	// for _beam models
#define SHADERPARM_BEAM_END_Y		9
#define SHADERPARM_BEAM_END_Z		10
#define SHADERPARM_BEAM_WIDTH		11

#define SHADERPARM_SPRITE_WIDTH		8
#define SHADERPARM_SPRITE_HEIGHT	9

#define SHADERPARM_PARTICLE_STOPTIME 8	// don't spawn any more particles after this time

See also