Skip to content

Commit

Permalink
update glsl
Browse files Browse the repository at this point in the history
  • Loading branch information
cavencj committed Mar 20, 2023
1 parent 340cfdf commit 4db6768
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
10 changes: 5 additions & 5 deletions modules/exts/GroundSkyBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ import {

const SkyBoxFS = `
uniform samplerCube u_cubeMap;
varying vec3 v_texCoord;
in vec3 v_texCoord;
void main()
{
vec4 color = textureCube(u_cubeMap, normalize(v_texCoord));
gl_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);
vec4 color = czm_textureCube(u_cubeMap, normalize(v_texCoord));
out_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);
}
`

const SkyBoxVS = `
attribute vec3 position;
varying vec3 v_texCoord;
in vec3 position;
out vec3 v_texCoord;
uniform mat3 u_rotateMatrix;
void main()
{
Expand Down
5 changes: 3 additions & 2 deletions modules/material/shader/weather/FogShader.glsl
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
in vec2 v_textureCoordinates;
uniform sampler2D colorTexture;
uniform sampler2D depthTexture;
uniform vec4 fogByDistance;
uniform vec4 fogColor;
varying vec2 v_textureCoordinates;


float getDistance(sampler2D depthTexture, vec2 texCoords){
float depth = czm_unpackDepth(texture(depthTexture, texCoords));
Expand Down Expand Up @@ -32,5 +33,5 @@ void main(void){
vec4 sceneColor = texture(colorTexture, v_textureCoordinates);
float blendAmount = interpolateByDistance(fogByDistance, distance);
vec4 finalFogColor = vec4(fogColor.rgb, fogColor.a * blendAmount);
gl_FragColor = alphaBlend(finalFogColor, sceneColor);
out_FragColor = alphaBlend(finalFogColor, sceneColor);
}
4 changes: 2 additions & 2 deletions modules/material/shader/weather/RainShader.glsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
in vec2 v_textureCoordinates;
uniform sampler2D colorTexture;
varying vec2 v_textureCoordinates;
uniform float speed;
uniform float mixNum;

Expand All @@ -19,5 +19,5 @@ void main(){
float v=1.-sin(hash(floor(uv.x*100.))*2.);
float b=clamp(abs(sin(20.*time*v+uv.y*(5./(2.+v))))-.95,0.,1.)*10.;
c*=v*b;
gl_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(c,1), mixNum);
out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(c,1), mixNum);
}
4 changes: 2 additions & 2 deletions modules/material/shader/weather/SnowShader.glsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
in vec2 v_textureCoordinates;
uniform sampler2D colorTexture;
varying vec2 v_textureCoordinates;
uniform float speed;

float snow(vec2 uv,float scale){
Expand Down Expand Up @@ -29,5 +29,5 @@ void main(){
c+=snow(uv,6.);
c+=snow(uv,5.);
finalColor=(vec3(c));
gl_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(finalColor,1), 0.3);
out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(finalColor,1), 0.3);
}

0 comments on commit 4db6768

Please sign in to comment.