Shaderbench fragment shader.
More...
|
in vec4 | dir |
| View world direction.
|
|
in vec2 | uv |
| Texture coordinates.
|
|
uniform uniform float | iTime |
| Time since beginning of playback.
|
|
uniform float | iTimeDelta |
| Time since last frame.
|
|
uniform float | iFrame |
| Frame count since beginning of playback.
|
|
uniform vec3 | iResolution |
| Screen resolution.
|
|
uniform vec4 | iMouse |
| xy: mouse position if left button pressed, zw: left/right button clicked?
|
|
uniform mat4 | iView |
| View matrix.
|
|
uniform mat4 | iProj |
| Projection matrix.
|
|
uniform mat4 | iViewProj |
| View projection matrix.
|
|
uniform mat4 | iViewInv |
| Inverse view matrix.
|
|
uniform mat4 | iProjInv |
| Inverse projection matrix.
|
|
uniform mat4 | iViewProjInv |
| Inverse view projection matrix.
|
|
uniform mat4 | iNormalMat |
| Normal transformation matrix.
|
|
uniform vec3 | iCamPos |
| Camera position.
|
|
uniform vec3 | iCamUp |
| Camera up vector.
|
|
uniform vec3 | iCamCenter |
| Camera lookat position.
|
|
uniform float | iCamFov |
| Camera field of view.
|
|
uniform float | gamma |
| Gamma correction.
|
|
uniform float | specExponent |
| Specular exponent.
|
|
uniform float | radius |
| Sphere radius.
|
|
uniform float | epsilon |
| Raymarching tolerance.
|
|
uniform vec3 | skyBottom |
| Sky color bottom.
|
|
uniform vec3 | skyLight |
| Light color bottom.
|
|
uniform vec3 | skyTop |
| Sky color.
|
|
uniform vec3 | lightColor |
| Light color.
|
|
uniform vec3 | sphereColor |
| Sphere color.
|
|
uniform vec3 | ground0 |
| Ground color 0.
|
|
uniform vec3 | ground1 |
| Ground color 1.
|
|
uniform vec4 | lightDirection |
| Light direction.
|
|
uniform int | stepCount |
| Maximum step count.
|
|
uniform bool | showPlane |
| Show the moving plane.
|
|
out vec4 | fragColor |
| Output color.
|
|
◆ main()
void GPUShaders::Frag::Shaderbench::main |
( |
| ) |
|
|
inline |
Main render function.
Exposure tweak, output.
◆ map()
vec2 GPUShaders::Frag::Shaderbench::map |
( |
vec3 |
pos | ) |
|
|
inline |
Scene signed distance function.
- Parameters
-
- Returns
- the distance to the surface and the material ID.
◆ normal()
vec3 GPUShaders::Frag::Shaderbench::normal |
( |
vec3 |
p | ) |
|
|
inline |
Compute the normal to the surface of the scene at a given world point.
- Parameters
-
p | the point to evaluate the normal at |
- Returns
- the normal
◆ raymarch()
bool GPUShaders::Frag::Shaderbench::raymarch |
( |
vec3 |
orig, |
|
|
vec3 |
dir, |
|
|
out float |
t, |
|
|
out vec2 |
res |
|
) |
| |
|
inline |
Raymarch until hitting the scene surface or reaching the max number of steps.
- Parameters
-
orig | the ray position |
dir | the ray direction |
t | will contain the distance along the ray to the intersection |
res | will contain final distance to the surface and material ID |
- Returns
- true if there was an intersection
The documentation for this class was generated from the following file:
- resources/shaderbench/shaders/shaderbench.frag