Skip to content

Commit

Permalink
change bg color to transparent
Browse files Browse the repository at this point in the history
  • Loading branch information
harshcrop committed Dec 27, 2023
1 parent 939402a commit b506f02
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
3 changes: 2 additions & 1 deletion scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ class App {

initScene = () => {
this.scene = new THREE.Scene();
// this.scene.backgroundColor = new THREE.Color(0xff0000);
};

initRenderer = () => {
this.renderer = new THREE.WebGLRenderer({ alpha: true });
this.renderer.setClearColor(0x141416, 1.0);
this.renderer.setClearColor(0x000000, 0);
this.renderer.setSize(window.innerWidth, window.innerHeight);
this.renderer.setPixelRatio(window.devicePixelRatio * 1.5);
this.renderer.shadowMap.enabled = true;
Expand Down
22 changes: 10 additions & 12 deletions scripts/shaders.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const shaders = {
atmosphere: {},
globe: {},
dot: {}
}
atmosphere: {},
globe: {},
dot: {},
};

shaders.globe.vertexShader = `
varying vec3 vNormal;
Expand All @@ -12,7 +12,7 @@ shaders.globe.vertexShader = `
vNormal = normalize( normalMatrix * normal );
vUv = uv;
}
`
`;

shaders.globe.fragmentShader = `
uniform sampler2D texture;
Expand All @@ -24,15 +24,15 @@ shaders.globe.fragmentShader = `
vec3 atmosphere = vec3( 1.0, 1.0, 1.0 ) * pow( intensity, 3.0 );
gl_FragColor = vec4( diffuse + atmosphere, 1.0 );
}
`
`;

shaders.atmosphere.vertexShader = `
varying vec3 vNormal;
void main() {
vNormal = normalize( normalMatrix * normal );
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}
`
`;

shaders.atmosphere.fragmentShader = `
varying vec3 vNormal;
Expand All @@ -41,8 +41,7 @@ shaders.atmosphere.fragmentShader = `
float intensity = pow( 0.7 - dot( vNormal, vec3( 0.0, 0.0, 1.0 ) ), 4.0 );
gl_FragColor = vec4( 1.0, 1.0, 1.0, 1.0 ) * intensity;
}
`

`;

shaders.dot.vertexShader = `
attribute float size;
Expand All @@ -54,8 +53,7 @@ shaders.dot.vertexShader = `
gl_PointSize = size * ( 300.0 / -mvPosition.z );
gl_Position = projectionMatrix * mvPosition;
}
`

`;

shaders.dot.fragmentShader = `
uniform vec3 color;
Expand All @@ -66,4 +64,4 @@ shaders.dot.fragmentShader = `
gl_FragColor = gl_FragColor * texture2D( pointTexture, gl_PointCoord );
if ( gl_FragColor.a < ALPHATEST ) discard;
}
`
`;

0 comments on commit b506f02

Please sign in to comment.