Difference between revisions of "Post processing.tbl"

From FreeSpace Wiki
Jump to: navigation, search
(Adding post_processing.tbl)
 
Line 10: Line 10:
 
For each effect, the following options apply:
 
For each effect, the following options apply:
  
 +
==#Effects==
 
===$Name:===
 
===$Name:===
 
*Name of the effect. This is used to refer to the effect with the post-processing sexps.
 
*Name of the effect. This is used to refer to the effect with the post-processing sexps.
Line 35: Line 36:
 
===$Add:===
 
===$Add:===
 
*Syntax: '''''Float'''''
 
*Syntax: '''''Float'''''
 +
 +
==#Ship Effects==
 +
This section is used to define effects for use with the ship-effect sexp or ship::addShipEffect() lua function.
 +
===$Name===
 +
*Syntax: '''''String'''''
 +
*Defines a unique name for this effect, which is used as input for the sexp and lua function.
 +
===$Shader Effect:===
 +
*Syntax: '''''Integer'''''
 +
*Defines a unique ID for this effect. This will be passed to the main shader as a uniform parameter. Note that IDs 0 and 1 are reserved for in-engine use.
 +
===$Disables Rendering:===
 +
*Syntax: '''''Boolean'''''
 +
*If this is set to true, the ship will not be rendered after the effect is completed.
 +
===$Invert Timer:===
 +
*Syntax: '''''Boolean'''''
 +
*Controls the behaviour of the timer passed to the shader as a uniform variable. Timer values are always in the [0.0, 1.0] range, and are computed as follows:
 +
(Current time in milliseconds - effect start time in milliseconds) / (effect duration in milliseconds)
 +
If this parameter is set to true, the computation is altered as follows:
 +
1.0 - ((Current time in milliseconds - effect start time in milliseconds) / (effect duration in milliseconds))
  
 
==Sample==
 
==Sample==

Revision as of 11:19, 4 August 2011

General Format

Post_processing.tbl is a table file that controls the use of the post-processing effects available in FSO. In order to use post-processing, the following prerequisites must be met:

  • FSO version 3.6.12 or higher
  • GPU capable of running Shaders written in GLSL 1.2 or higher
  • -post_process commandline flag must be enabled
  • post-processing shader files must be present and named post-f.sdr/post-v.sdr

Post_processing.tbl allows the modder to set default values for the effects supported effects. The table must begin with "#Effects" and must end with "#End". For each effect, the following options apply:

#Effects

$Name:

  • Name of the effect. This is used to refer to the effect with the post-processing sexps.
  • Syntax: String

$Uniform:

  • For every effect, a uniform variable is needed to pass data from the engine to the shader. This is the variables' name, and it has to match the name as used by the shader. All uniforms declared here are of type "float".
  • Syntax: String

$Define:

  • In the post-processing shader, each effects' code is encapsulated in a preprocessor define. Since the engine only uses one post-processing shader, the shader has to be recompiled every time an effect is activated or deactivated. To control which effects are in use, preprocessor defines are used. The name given here must match the name used in the shader.
  • Syntax: String

$AlwaysOn:

  • If set to true, the effect will be on by default.
  • Syntax: Boolean

$Default:

  • The default value of the passed uniform variable. This value is modified by the values given in $Div and $Add as follows: value = (default value / div) + add
  • Syntax: Float

$Div:

  • Syntax: Float

$Add:

  • Syntax: Float

#Ship Effects

This section is used to define effects for use with the ship-effect sexp or ship::addShipEffect() lua function.

$Name

  • Syntax: String
  • Defines a unique name for this effect, which is used as input for the sexp and lua function.

$Shader Effect:

  • Syntax: Integer
  • Defines a unique ID for this effect. This will be passed to the main shader as a uniform parameter. Note that IDs 0 and 1 are reserved for in-engine use.

$Disables Rendering:

  • Syntax: Boolean
  • If this is set to true, the ship will not be rendered after the effect is completed.

$Invert Timer:

  • Syntax: Boolean
  • Controls the behaviour of the timer passed to the shader as a uniform variable. Timer values are always in the [0.0, 1.0] range, and are computed as follows:

(Current time in milliseconds - effect start time in milliseconds) / (effect duration in milliseconds) If this parameter is set to true, the computation is altered as follows: 1.0 - ((Current time in milliseconds - effect start time in milliseconds) / (effect duration in milliseconds))

Sample

This is the default table used by FSO executables if no post_processing.tbl can be found.

#Effects										
												
$Name:			distort noise					
$Uniform:		noise_amount					
$Define:		FLAG_DISTORT_NOISE				
$AlwaysOn: 		false							
$Default:		0.0								
$Div:			20000							
$Add:			0								
												
$Name:			saturation						
$Uniform:		saturation						
$Define:		FLAG_SATURATION					
$AlwaysOn: 		false							
$Default:		0.9								
$Div:			50								
$Add:			0								
												
$Name:			contrast						
$Uniform:		contrast						
$Define:		FLAG_CONTRAST					
$AlwaysOn: 		false							
$Default:		1.1								
$Div:			50								
$Add:			0								
												
$Name:			film grain						
$Uniform:		film_grain						
$Define:		FLAG_GRAIN						
$AlwaysOn: 		false							
$Default:		0.1								
$Div:			50								
$Add:			0								
												
$Name:			stripes							
$Uniform:		tv_stripes						
$Define:		FLAG_STRIPES					
$AlwaysOn:		false							
$Default:		0.0								
$Div:			50								
$Add:			0								
												
$Name:			dithering						
$Uniform:		dither							
$Define:		FLAG_DITH						
$AlwaysOn:		false							
$Default:		0.0								
$Div:			50								
$Add:			0								
												
#End