| 1 | # Override Shaders Demo |
| 2 | |
| 3 | Set GLSL shader of a particular 3D object. |
| 4 | We do this by setting up nodes: |
| 5 | |
| 6 | - TShaderPartNode (2x, once for vertex shader, once for fragment shader) |
| 7 | - TComposedShaderNode |
| 8 | |
| 9 | See https://castle-engine.io/x3d_implementation_shaders.php about these nodes. |
| 10 | |
| 11 | This approach completely overrides all Castle Game Engine rendering features, |
| 12 | you have to supply the shader code to do everything. |
| 13 | |
| 14 | In most cases, you should rather prefer the approach using "composable shader effects" |
| 15 | demonstrated in ../shader_effects/ demo. |
| 16 | It uses the TEffectNode and TEffectPartNode |
| 17 | instead of TComposedShaderNode and TShaderPartNode. |
| 18 | See https://castle-engine.io/compositing_shaders.php . |
| 19 | |
| 20 | Press S to toggle usage of the custom shader. |
| 21 | |
| 22 | Using [Castle Game Engine](https://castle-engine.io/). |
| 23 | |
| 24 | ## Building |
| 25 | |
| 26 | Compile by: |
| 27 | |
| 28 | - [CGE editor](https://castle-engine.io/editor). Just use menu items _"Compile"_ or _"Compile And Run"_. |
| 29 | |
| 30 | - Or use [CGE command-line build tool](https://castle-engine.io/build_tool). Run `castle-engine compile` in this directory. |
| 31 | |
| 32 | - Or use [Lazarus](https://www.lazarus-ide.org/). Open in Lazarus `shader_override_standalone.lpi` file and compile / run from Lazarus. Make sure to first register [CGE Lazarus packages](https://castle-engine.io/lazarus). |
| 33 | |
| 34 | - Or use [Delphi](https://www.embarcadero.com/products/Delphi). Open in Delphi `shader_override_standalone.dproj` file and compile / run from Delphi. See [CGE and Delphi](https://castle-engine.io/delphi) documentation for details. |