Finally working decent sky
This commit is contained in:
1 parent
c475b1ecac
commit
04836f2271
25 files changed
+221
-98
No files matched your search
@@ -0,0 +1,21 @@
|
||||
uniform samplerCube Env;
|
||||
|
||||
varying vec3 dir;
|
||||
|
||||
void main(){
|
||||
gl_FragColor = textureCube(Env, normalize(dir));
|
||||
|
||||
vec4 fogColor = vec4(0.25, 0.55, 1.0, 1.0);
|
||||
|
||||
float coef = dir.y+1.0;
|
||||
coef = clamp(coef, 0.0, 1.0);
|
||||
|
||||
gl_FragColor = mix(gl_FragColor,fogColor, coef);
|
||||
|
||||
//if (dir.z < 0)
|
||||
//{
|
||||
// gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
//}
|
||||
//gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
attribute vec3 vPosition;
|
||||
|
||||
uniform mat4 ProjectionMatrix;
|
||||
uniform mat3 ModelRotateMatrix;
|
||||
uniform vec3 ModelTranslateVector;
|
||||
|
||||
varying vec3 dir;
|
||||
|
||||
void main(){
|
||||
vec4 realVertexPos = vec4(ModelRotateMatrix * vPosition.xyz + ModelTranslateVector, 1.0);
|
||||
gl_Position = ProjectionMatrix * realVertexPos;
|
||||
|
||||
dir = -vPosition;
|
||||
}
|
||||
@@ -13,11 +13,13 @@ void main()
|
||||
{
|
||||
vec3 camVec2 = normalize(camVec);
|
||||
|
||||
/*camVec2.y = -camVec2.y;
|
||||
|
||||
vec4 reflectColor = textureCube(Env, camVec2);
|
||||
|
||||
gl_FragColor = vec4(reflectColor.xyz, 1.0f);
|
||||
*/
|
||||
|
||||
/*
|
||||
mat3 rot;
|
||||
|
||||
rot[0] = vec3(0.0,0.0,1.0);
|
||||
@@ -44,9 +46,9 @@ void main()
|
||||
vec4 reflectColor = textureCube(Env, dir1);
|
||||
vec4 refractColor = textureCube(Env, dir2);
|
||||
|
||||
vec4 texColor = reflectColor*0.2 + refractColor*0.8;
|
||||
vec4 texColor = reflectColor*0.5 + refractColor*0.5;
|
||||
|
||||
gl_FragColor = vec4(texColor.xyz, 1.0f);*/
|
||||
gl_FragColor = vec4(texColor.xyz, 1.0f);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ void main()
|
||||
|
||||
texCoord = vTexCoord;
|
||||
|
||||
camVec = -(vPosition.xyz - CamPos);
|
||||
camVec = (vPosition.xyz - CamPos);
|
||||
|
||||
//camVec = vec3(0, 1, 0);
|
||||
|
||||
|
||||
Reference in new issue
Block a user