Skip to content

Commit

Permalink
Examples: Improved groundprojected example.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Jul 28, 2022
1 parent 8e2f2df commit 384e5d6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 22 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 17 additions & 17 deletions examples/webgl_materials_envmaps_groundprojected.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<body>
<div id="container"></div>
<div id="info">
<a href="https://threejs.org" target="_blank" rel="noopener">threejs</a> - Ground projected environment mapping. By <a href="https://twitter.com/CantBeFaraz" target="_blank" rel="noopener">Faraz Shaikh</a>.<br>
<a href="https://threejs.org" target="_blank" rel="noopener">threejs</a> - Ground projected environment mapping. By <a href="https://twitter.com/CantBeFaraz" target="_blank" rel="noopener">Faraz Shaikh</a>.<br>
Ferrari 458 Italia model by <a href="https://sketchfab.com/models/57bf6cc56931426e87494f554df1dab6" target="_blank" rel="noopener">vicent091036</a><br>
<a href="https://polyhaven.com/a/blouberg_sunrise_2" target="_blank" rel="noopener">Blouberg Sunrise 2</a> by <a href="https://gregzaal.com/" target="_blank" rel="noopener">Greg Zaal</a>
</div>
Expand Down Expand Up @@ -47,7 +47,7 @@
import { RGBELoader } from './jsm/loaders/RGBELoader.js';

const params = {
height: 34,
height: 20,
radius: 440
};

Expand All @@ -58,12 +58,13 @@
async function init() {

camera = new THREE.PerspectiveCamera(
45,
40,
window.innerWidth / window.innerHeight,
1,
1000
);
camera.position.set( - 16, 4, 16 );
camera.position.set( - 20, 7, 20 );
camera.lookAt( 0, 4, 0 );

scene = new THREE.Scene();

Expand All @@ -83,14 +84,13 @@
const loader = new GLTFLoader();
loader.setDRACOLoader( dracoLoader );

const shadow = new THREE.TextureLoader().load(
'models/gltf/ferrari_ao.png'
);
const shadow = new THREE.TextureLoader().load( 'models/gltf/ferrari_ao.png' );

loader.load( 'models/gltf/ferrari.glb', function ( gltf ) {

const bodyMaterial = new THREE.MeshPhysicalMaterial( {
color: 0xff0000, metalness: 1.0, roughness: 0.5, clearcoat: 1.0, clearcoatRoughness: 0.03, sheen: 0.5
color: 0x000000, metalness: 1.0, roughness: 0.8,
clearcoat: 1.0, clearcoatRoughness: 0.2
} );

const detailsMaterial = new THREE.MeshStandardMaterial( {
Expand Down Expand Up @@ -131,7 +131,7 @@
render();

} );

//

renderer = new THREE.WebGLRenderer( { antialias: true } );
Expand All @@ -140,15 +140,15 @@
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 0.85;

//

const controls = new OrbitControls( camera, renderer.domElement );
controls.addEventListener( 'change', render );
controls.target.set( 0, 0, 0 );
controls.maxPolarAngle = THREE.MathUtils.degToRad( 80 );
controls.maxDistance = 100;
controls.minDistance = 30;
controls.target.set( 0, 2, 0 );
controls.maxPolarAngle = THREE.MathUtils.degToRad( 90 );
controls.maxDistance = 80;
controls.minDistance = 20;
controls.enablePan = false;
controls.update();

Expand All @@ -160,7 +160,7 @@

document.body.appendChild( renderer.domElement );
window.addEventListener( 'resize', onWindowResize );

}

function onWindowResize() {
Expand All @@ -182,4 +182,4 @@
}
</script>
</body>
</html>
</html>
5 changes: 0 additions & 5 deletions src/renderers/webgl/WebGLProgram.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,6 @@ function generateEnvMapTypeDefine( parameters ) {

switch ( parameters.envMapMode ) {

case CubeReflectionMapping:
case CubeRefractionMapping:
envMapTypeDefine = 'ENVMAP_TYPE_CUBE';
break;

case CubeUVReflectionMapping:
envMapTypeDefine = 'ENVMAP_TYPE_CUBE_UV';
break;
Expand Down

0 comments on commit 384e5d6

Please sign in to comment.