Waterflow
Visualize water in terrain
src/shaders/watershader.frag File Reference

Fragment shader for water rendering. More...

Go to the source code of this file.

Classes

struct  LightParam
 Struct that contains one light source. More...

Functions

 layout (std140, binding=0) uniform LightInfo
 < All the lights are stored in this buffer
void main (void)

Variables

const float airRefInd = 1.0
 Refraction index of air.
float alpha
 Angle used for refraction approximation.
vec3 ambLight
 Ambient light color.
float bottomDisplacement1
 Distance to displace along the bottom for the first approximation.
float bottomDisplacement2
 Better displacement approximation distance.
vec3 bottomLight
 Total bottom light color.
vec3 bottomNormal
 Normal of seen bottom.
vec3 bottomPos
 Position of seen bottom.
uniform vec3 camPos
 Camera position.
float depth
 Water depth at fragment.
float depthAtDis1
 Depth at first displacement approximation.
float depthAtDis2
 Depth at better approximation.
vec3 diffLight
 Diffuse light color.
vec3 displacement1
 Displacement vector (first approximation).
vec3 displacement2
 Better displacement approximation vector.
vec3 displacementDirection
 Refraction direction in the xz-plane.
vec3 eye
 Vector from the fragment to the camera.
float h
 Height at first approximation.
uniform sampler2D height_texUnit
 Terrain geometry (normal and height) texture.
float kamb
 Ambient light coefficient.
float kblue
 "Blueness" coefficient.
float kdiff
 Diffuse light coefficient.
float krefl
 Reflected light coefficient.
float ktransb
 Transparent light (blue channel) coefficient.
float ktransg
 Transparent light (green channel) coefficient.
float ktransr
 Transparent light (red channel) coefficient.
vec3 Normal
 (Modified) fragment normal.
out vec4 out_Color
 Fragment (out) pixel value.
in vec3 out_Normal
 Fragment normal.
in vec3 out_ObjPos
 Fragment position.
in vec2 out_TexCoord
 Fragment texture coordinate.
vec3 r
 Reflected light vector.
vec3 re
 Reflected eye vector.
vec3 reflLight
 Reflected light (skybox) color.
vec3 right
 Vector to the right (camera position dependent).
vec3 s
 Incident light vector.
uniform vec3 size
 Data size.
uniform samplerCube sky_texUnit
 Skybox texture.
vec3 skyrefl
 Skybox color.
vec3 specLight
 Specular light color.
vec3 surfaceLight
 Total surface light color.
uniform sampler2D terr_texUnit
 Terrain (color) texture.
vec4 terrainDataAtBottom
 Terrain geometry at better approximation.
vec4 terrainDataAtDis1
 Terrain geometry at first approximation.
vec4 terrainDataUnderSurface
 Terrain geometry under fragment.
vec4 texDataAtBottom
 Terrain color at bottom.
float theta1
 Incident light angle (from camera to bottom).
float theta2
 Refracted light angle (from camera to bottom).
uniform float time
 Time variable.
uniform float transparency
 Transparency of the water.
const vec3 up = vec3(0.0, 1.0, 0.0)
 Up vector (world coordinates).
const float waterRefInd = 1.34451
 Refraction index of water.
float wdist
 Distance from surface to better approximation.

Detailed Description

Fragment shader for water rendering.

Definition in file watershader.frag.

 All Classes Files Functions Variables Enumerations