|
@@ -50,8 +50,8 @@
|
|
import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
|
|
import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
|
|
import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
|
|
import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
|
|
import { FilmPass } from 'three/addons/postprocessing/FilmPass.js';
|
|
import { FilmPass } from 'three/addons/postprocessing/FilmPass.js';
|
|
-
|
|
|
|
- THREE.ColorManagement.enabled = false; // TODO: Consider enabling color management.
|
|
|
|
|
|
+ import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js';
|
|
|
|
+ import { GammaCorrectionShader } from 'three/addons/shaders/GammaCorrectionShader.js';
|
|
|
|
|
|
const radius = 6371;
|
|
const radius = 6371;
|
|
const tilt = 0.41;
|
|
const tilt = 0.41;
|
|
@@ -94,7 +94,7 @@
|
|
|
|
|
|
const materialNormalMap = new THREE.MeshPhongMaterial( {
|
|
const materialNormalMap = new THREE.MeshPhongMaterial( {
|
|
|
|
|
|
- specular: 0x333333,
|
|
|
|
|
|
+ specular: 0x7c7c7c,
|
|
shininess: 15,
|
|
shininess: 15,
|
|
map: textureLoader.load( 'textures/planets/earth_atmos_2048.jpg' ),
|
|
map: textureLoader.load( 'textures/planets/earth_atmos_2048.jpg' ),
|
|
specularMap: textureLoader.load( 'textures/planets/earth_specular_2048.jpg' ),
|
|
specularMap: textureLoader.load( 'textures/planets/earth_specular_2048.jpg' ),
|
|
@@ -104,6 +104,7 @@
|
|
normalScale: new THREE.Vector2( 0.85, - 0.85 )
|
|
normalScale: new THREE.Vector2( 0.85, - 0.85 )
|
|
|
|
|
|
} );
|
|
} );
|
|
|
|
+ materialNormalMap.map.colorSpace = THREE.SRGBColorSpace;
|
|
|
|
|
|
// planet
|
|
// planet
|
|
|
|
|
|
@@ -122,6 +123,7 @@
|
|
transparent: true
|
|
transparent: true
|
|
|
|
|
|
} );
|
|
} );
|
|
|
|
+ materialClouds.map.colorSpace = THREE.SRGBColorSpace;
|
|
|
|
|
|
meshClouds = new THREE.Mesh( geometry, materialClouds );
|
|
meshClouds = new THREE.Mesh( geometry, materialClouds );
|
|
meshClouds.scale.set( cloudsScale, cloudsScale, cloudsScale );
|
|
meshClouds.scale.set( cloudsScale, cloudsScale, cloudsScale );
|
|
@@ -135,6 +137,7 @@
|
|
map: textureLoader.load( 'textures/planets/moon_1024.jpg' )
|
|
map: textureLoader.load( 'textures/planets/moon_1024.jpg' )
|
|
|
|
|
|
} );
|
|
} );
|
|
|
|
+ materialMoon.map.colorSpace = THREE.SRGBColorSpace;
|
|
|
|
|
|
meshMoon = new THREE.Mesh( geometry, materialMoon );
|
|
meshMoon = new THREE.Mesh( geometry, materialMoon );
|
|
meshMoon.position.set( radius * 5, 0, 0 );
|
|
meshMoon.position.set( radius * 5, 0, 0 );
|
|
@@ -176,12 +179,12 @@
|
|
starsGeometry[ 1 ].setAttribute( 'position', new THREE.Float32BufferAttribute( vertices2, 3 ) );
|
|
starsGeometry[ 1 ].setAttribute( 'position', new THREE.Float32BufferAttribute( vertices2, 3 ) );
|
|
|
|
|
|
const starsMaterials = [
|
|
const starsMaterials = [
|
|
- new THREE.PointsMaterial( { color: 0x555555, size: 2, sizeAttenuation: false } ),
|
|
|
|
- new THREE.PointsMaterial( { color: 0x555555, size: 1, sizeAttenuation: false } ),
|
|
|
|
- new THREE.PointsMaterial( { color: 0x333333, size: 2, sizeAttenuation: false } ),
|
|
|
|
- new THREE.PointsMaterial( { color: 0x3a3a3a, size: 1, sizeAttenuation: false } ),
|
|
|
|
- new THREE.PointsMaterial( { color: 0x1a1a1a, size: 2, sizeAttenuation: false } ),
|
|
|
|
- new THREE.PointsMaterial( { color: 0x1a1a1a, size: 1, sizeAttenuation: false } )
|
|
|
|
|
|
+ new THREE.PointsMaterial( { color: 0x9c9c9c, size: 2, sizeAttenuation: false } ),
|
|
|
|
+ new THREE.PointsMaterial( { color: 0x9c9c9c, size: 1, sizeAttenuation: false } ),
|
|
|
|
+ new THREE.PointsMaterial( { color: 0x7c7c7c, size: 2, sizeAttenuation: false } ),
|
|
|
|
+ new THREE.PointsMaterial( { color: 0x838383, size: 1, sizeAttenuation: false } ),
|
|
|
|
+ new THREE.PointsMaterial( { color: 0x5a5a5a, size: 2, sizeAttenuation: false } ),
|
|
|
|
+ new THREE.PointsMaterial( { color: 0x5a5a5a, size: 1, sizeAttenuation: false } )
|
|
];
|
|
];
|
|
|
|
|
|
for ( let i = 10; i < 30; i ++ ) {
|
|
for ( let i = 10; i < 30; i ++ ) {
|
|
@@ -226,11 +229,13 @@
|
|
|
|
|
|
const renderModel = new RenderPass( scene, camera );
|
|
const renderModel = new RenderPass( scene, camera );
|
|
const effectFilm = new FilmPass( 0.35, 0.75, 2048, false );
|
|
const effectFilm = new FilmPass( 0.35, 0.75, 2048, false );
|
|
|
|
+ const gammaCorrection = new ShaderPass( GammaCorrectionShader );
|
|
|
|
|
|
composer = new EffectComposer( renderer );
|
|
composer = new EffectComposer( renderer );
|
|
|
|
|
|
composer.addPass( renderModel );
|
|
composer.addPass( renderModel );
|
|
composer.addPass( effectFilm );
|
|
composer.addPass( effectFilm );
|
|
|
|
+ composer.addPass( gammaCorrection );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|