Texture::createSunBillboardTexture method
color_shader_.glEnableglBlendFuncglDisable
\[ I = I_{a}m_{a} + I_{l}m_{d}(\mathbf{n}\cdot \mathbf{l}) + I_{l}m_{s}(\mathbf{r} \cdot \mathbf{v})^{s} \]
sunlight, \(I_{l} =\) sunlight.// vertex shader
#version 140
#extension GL_ARB_explicit_attrib_location : enable
layout (location = 0) in vec4 v_position;
layout (location = 1) in vec3 v_normal;
layout (location = 2) in vec2 v_texcoord;
out vec2 v2f_texcoord;
out vec3 v2f_normal;
out vec3 v2f_light;
out vec3 v2f_view;
uniform mat4 modelview_projection_matrix;
uniform mat4 modelview_matrix;
uniform mat3 normal_matrix;
uniform vec4 light_position; //in eye space coordinates already
void main()
{
// compute and assign:
// v2f_texcoord, v2f_normal, v2f_light, v2f_view and
// gl_Position
}
// fragment shader
#version 140
in vec3 v2f_normal;
in vec2 v2f_texcoord;
in vec3 v2f_light;
in vec3 v2f_view;
out vec4 f_color;
uniform sampler2D tex;
uniform bool greyscale;
const float shininess = 8.0;
const vec3 sunlight = vec3(1.0, 0.941, 0.898);
void main()
{
// compute and assign `f_color`
}
modelview_matrixnormal_matrix - transformation of normals to view coord. systemlight_position - point light source, fixed to \((0, 0, 0)\)phong.vert)
phong.color)
texture(tex, coords) (use .rgb, .r)day, night – 3 channels (RGB)cloudinesss – 1 channel (grayscale)gloss – 1 channel (grayscale)
Use the Phong lighting model (reuse phong.vert).
gloss and cloudiness textures to get a grayscale value specifying the amount of specularity (\([0, 1]\)).day texture.cloudiness.night texture and scale it down by cloudiness.Note that GLSL provides a mix function where \(\text{mix}(x,y,\alpha) = (1-\alpha) x + \alpha y\)
t is time). Use trigonometric functions. \[ \mathbf{v_{i}^{new}} = \mathbf{v_{i}}(1 + f(\theta, \phi, t)) \]
Suggestions: