This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
7
Simple skybox with procedural gradient?
Post Body
Iām trying to implement a simple skybox with a gradient simulating the sun. The sun appears in the right place when I look directly at it, but when I turn it āfollowsā the camera (appearing about halfway between the correct position and the point the camera is facing).
Hereās my shader codeāwhat am I doing wrong?
Vertex shader:
#version 150
in vec3 position;
out vec3 eyeVector;
void main(void)
{
gl_Position = vec4(position, 1.0);
eyeVector = position;
}
Fragment shader:
#version 150
uniform vec3 sunVector;
in vec3 eyeVector;
out vec4 out_Color;
void main(void)
{
gl_FragDepth = gl_DepthRange.far;
float gradient = dot(normalize(sunVector), normalize(eyeVector)) / 2.0 0.5;
out_Color = vec4(pow(gradient, 32), pow(gradient, 48) / 2.0 0.5, gradient / 4.0 0.75, 1.0);
}
The skybox vertices are at unit coordinates, and the sun vector is multiplied by the rotation portion of the view matrix.
Author
Account Strength
100%
Account Age
19 years
Verified Email
Yes
Verified Flair
No
Total Karma
313,973
Link Karma
65,427
Comment Karma
246,756
Profile updated: 3 days ago
Posts updated: 9 months ago
Subreddit
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 11 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/opengl/comm...