Update index.html
Browse files- index.html +18 -3
index.html
CHANGED
|
@@ -7,6 +7,7 @@
|
|
| 7 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
|
| 8 |
<script src="https://cdn.jsdelivr.net/npm/three/examples/js/loaders/GLTFLoader.js"></script>
|
| 9 |
<script src="https://cdn.jsdelivr.net/npm/three/examples/js/controls/OrbitControls.js"></script>
|
|
|
|
| 10 |
<style>
|
| 11 |
body { margin: 0; }
|
| 12 |
canvas { display: block; }
|
|
@@ -23,6 +24,8 @@
|
|
| 23 |
|
| 24 |
renderer = new THREE.WebGLRenderer({ antialias: true });
|
| 25 |
renderer.setSize(window.innerWidth, window.innerHeight);
|
|
|
|
|
|
|
| 26 |
document.body.appendChild(renderer.domElement);
|
| 27 |
|
| 28 |
controls = new THREE.OrbitControls(camera, renderer.domElement);
|
|
@@ -32,12 +35,24 @@
|
|
| 32 |
controls.minDistance = 1;
|
| 33 |
controls.maxDistance = 10;
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
scene.add(light);
|
| 38 |
|
|
|
|
|
|
|
|
|
|
| 39 |
const loader = new THREE.GLTFLoader();
|
| 40 |
-
loader.load('
|
| 41 |
let model = gltf.scene;
|
| 42 |
model.scale.set(2, 2, 2);
|
| 43 |
model.position.y = 0;
|
|
|
|
| 7 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
|
| 8 |
<script src="https://cdn.jsdelivr.net/npm/three/examples/js/loaders/GLTFLoader.js"></script>
|
| 9 |
<script src="https://cdn.jsdelivr.net/npm/three/examples/js/controls/OrbitControls.js"></script>
|
| 10 |
+
<script src="https://cdn.jsdelivr.net/npm/three/examples/js/loaders/RGBELoader.js"></script>
|
| 11 |
<style>
|
| 12 |
body { margin: 0; }
|
| 13 |
canvas { display: block; }
|
|
|
|
| 24 |
|
| 25 |
renderer = new THREE.WebGLRenderer({ antialias: true });
|
| 26 |
renderer.setSize(window.innerWidth, window.innerHeight);
|
| 27 |
+
renderer.toneMapping = THREE.ACESFilmicToneMapping;
|
| 28 |
+
renderer.toneMappingExposure = 1;
|
| 29 |
document.body.appendChild(renderer.domElement);
|
| 30 |
|
| 31 |
controls = new THREE.OrbitControls(camera, renderer.domElement);
|
|
|
|
| 35 |
controls.minDistance = 1;
|
| 36 |
controls.maxDistance = 10;
|
| 37 |
|
| 38 |
+
// Load HDR Environment Map
|
| 39 |
+
const rgbeLoader = new THREE.RGBELoader();
|
| 40 |
+
rgbeLoader.load('https://threejs.org/examples/textures/equirectangular/royal_esplanade_1k.hdr', function (texture) {
|
| 41 |
+
texture.mapping = THREE.EquirectangularReflectionMapping;
|
| 42 |
+
scene.environment = texture;
|
| 43 |
+
scene.background = texture;
|
| 44 |
+
});
|
| 45 |
+
|
| 46 |
+
// Adjusted lighting
|
| 47 |
+
const light = new THREE.DirectionalLight(0xffffff, 2);
|
| 48 |
+
light.position.set(5, 10, 5);
|
| 49 |
scene.add(light);
|
| 50 |
|
| 51 |
+
const ambientLight = new THREE.AmbientLight(0x404040, 3);
|
| 52 |
+
scene.add(ambientLight);
|
| 53 |
+
|
| 54 |
const loader = new THREE.GLTFLoader();
|
| 55 |
+
loader.load('model.glb', function (gltf) {
|
| 56 |
let model = gltf.scene;
|
| 57 |
model.scale.set(2, 2, 2);
|
| 58 |
model.position.y = 0;
|