Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
1.0.0:postfx [2023/02/23 14:22] – [Runtime] admin | 1.0.0:postfx [2023/02/23 14:41] (current) – [Shaders] admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PostFX ====== | ====== PostFX ====== | ||
- | Even though Gorilla3D is compatible Firemonkey post effects, it is difficult for many users to build their own post effect. | + | Even though Gorilla3D is compatible |
To solve this issue we provide the TGorillaRenderPassPostFX component. | To solve this issue we provide the TGorillaRenderPassPostFX component. | ||
- | It is now possible for you to easily create your own effect and to design it in the IDE at design time. | + | It is now possible for you to easily create your own effect and to write a shader |
{{: | {{: | ||
Line 17: | Line 17: | ||
- Write GLSL shader code using "vec3 SurfaceShader(inout TLocals DATA){...}" | - Write GLSL shader code using "vec3 SurfaceShader(inout TLocals DATA){...}" | ||
- | Here is some nice television post effect for the surface shader: | + | Here is some nice television post-effect for the surface shader. |
+ | |||
+ | Just copy & paste into **GorillaRenderPassPostFX1.SurfaceShader** property editor: | ||
<file glsl> | <file glsl> | ||
Line 92: | Line 94: | ||
</ | </ | ||
- | __WARNING:__ GLSL compiler does not allow comments in shader code. | + | Source: [[https:// |
===== Runtime ===== | ===== Runtime ===== | ||
Line 108: | Line 109: | ||
' | ' | ||
</ | </ | ||
+ | |||
+ | |||
+ | ===== Shaders ===== | ||
+ | |||
+ | You can write shaders in GLSL syntax compatible with OpenGL 4.3 (on Windows) and OpenGLES 3.1+ (on Android). | ||
+ | |||
+ | __WARNING: | ||
+ | |||
+ | The **SurfaceShader** property of the PostFX instance allows to put a string with compatible shader code into. | ||
+ | |||
+ | At least every shader needs a " | ||
+ | |||
+ | <file glsl> | ||
+ | vec3 SurfaceShader(inout TLocals DATA){ | ||
+ | ... | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | The shader itself provides some variables for usage: | ||
+ | |||
+ | ^Shader Variable ^Type ^ Description ^ | ||
+ | |_RenderedTexture|sampler2D|The main render pass result texture.| | ||
+ | |_MaskTexture|sampler2D|Optional texture for post effects. You can use this texture for additional shader computation.| | ||
+ | |_TimeInfo.x|float|Starting timestamp of the post effect shader| | ||
+ | |_TimeInfo.y|float|Current timestamp of the post effect shader| | ||
+ | |_TimeInfo.z|float|Previous timestamp of the post effect shader| | ||
+ | |_TimeInfo.w|float|Delta timestamp of the post effect shader| | ||
+ | |DATA.TexCoord0|vec2|Texture coordinate of the post effect plane.| | ||
+ | |DATA.WorldViewProjVertPos|vec4|World-View-Projected vertex position of the post effect plane.| | ||
+ | |DATA.Normal|vec3|Normal vector of the post effect plane.| | ||
+ | |||
+ | ==== Links ==== | ||
+ | |||
+ | You can find many free shaders in the web with less need of change. | ||
+ | * https:// | ||
+ | * https:// | ||
+ | * https:// | ||
+ | * ... |