Suppose you’ve got three numbers. You want to weight and sum them. The 0th should be weighted half as much as the 1st. The 1st should be weighted half as much as the 2nd. What are the weights?
Suppose you’ve got n numbers. You want to weight and sum them. The 0th should be weighted half as much as the 1st. The 1st should be weighted half as much as the 2nd. And so on. What are the weights?
As a lab exercise:
noise
project.noise.*.glsl
shaders to the fog.*.glsl
shaders.Field3
class, a 3D texture (which needs one further parameter to its Upload
call), and a sampler3D
.time
uniform. As time progresses, we will draw the fog out from different planes of our 3D texture.OnDraw
, upload the time uniform such that it increases as our application executes. What do you notice?glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
...
glDisable(GL_BLEND);
In your fragment shader, set the fragment’s color opacity (it’s a
channel) to the fog intensity. How does this look?
gl_Position.z = gl_Position.w;
Comments