LGUI2:Pixel Shaders

From Lavish Software Wiki
Revision as of 15:11, 26 June 2018 by Lax (talk | contribs) (Created page with "A Pixel Shader is a piece of code that determines the color of each pixel as a scene is rendered. Pixel Shaders are supported by LGUI2:Brushes. == Defining a Pixel Shade...")
(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)
Jump to navigation Jump to search

A Pixel Shader is a piece of code that determines the color of each pixel as a scene is rendered. Pixel Shaders are supported by Brushes.

Defining a Pixel Shader

A Pixel Shader is defined by a JSON object enclosed by {}.

LavishGUI 2 supports multiple shader models in order to support many graphics engines. Different versions of DirectX allow use of different shader models:

  • DirectX 9: Use ps_3_0 or ps_2_0
  • DirectX 10: Additionally supports ps_4_0 and friends
  • DirectX 10.1: Additionally supports ps_4_1
  • DirectX 11: Additionally supports ps_5_0
  • DirectX 12: Additionally supports ps_6_0 (note that DirectX 12 is not yet supported)
Pixel Shader properties
entryPoint The name of the Entry Point function within the pixel shader code. Default is PS.
useFile A boolean (true/false) value indicating whether the pixel shader definition is a file (true) or the code itself (false). Default is false.
ps_5_0 Pixel Shader model 5.0 code or filename
ps_4_1 Pixel Shader model 4.1 code or filename
ps_4_0 Pixel Shader model 4.0 code or filename
ps_4_0_level_9_3 Pixel Shader model 4.0 level 9.3 code or filename
ps_4_0_level_9_1 Pixel Shader model 4.0 level 9.1 code or filename
ps_3_0 Pixel Shader model 3.0 code or filename
ps_2_0 Pixel Shader model 2.0 code or filename


Examples

A simple solid green shader
"pixelShader": {
 "entryPoint": "SimplePixelShader",
 "ps_4_0_level_9_1": "struct PixelShaderInput\n{\n    float4 pos : SV_POSITION;\n};\nfloat4 SimplePixelShader(PixelShaderInput input) : SV_TARGET\n{\n    // Draw the entire triangle green.\n    return float4(0.0f, 0.2f, 0.0f, 1.0f);}"
}