Render.ru

Экспорт .jlb в проект three.js, проблема с матереалом

кот-баюн

Пользователь сайта
Рейтинг
2
#1
Объект с (зеленым диффузным) материалом экспортируется, но при загрузке проекта выглядит серым. Подскажите пожалуйста как решить проблему. Спасибо. Blender 4.5.3. Прилагаю main.js файл.
import * as THREE from 'three';

import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';

const scene = new THREE.Scene();
scene.background = new THREE.Color( 0x9999ff );

const camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 0.1, 1000 );

const renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.setAnimationLoop( animate );
document.body.appendChild( renderer.domElement );

//const gridHelper = THREE.GridHelper(100, 100);
//scene.add(gridHelper);

const loader = new GLTFLoader();
loader.load( '../model.glb', function ( gltf ) {
scene.add(gltf.scene);
} );

const ambientLight = new THREE.AmbientLight(0xffffff, 0.5); // Soft white light
scene.add(ambientLight);

const directionalLight = new THREE.DirectionalLight(0xffffff, 0.8);
directionalLight.position.set(1, 1, 1).normalize(); // Position the light
scene.add(directionalLight);

camera.position.set(0, 0, 5);
camera.position.z = 0.1;
camera.lookAt(0, 0, 0);

const controls = new OrbitControls(camera, renderer.domElement);

function animate() {
requestAnimationFrame(animate);
controls.update();

renderer.render( scene, camera );

}
 

Вложения

  • 10,1 КБ Просмотров: 0

walter liz

Пользователь сайта
Рейтинг
2
#2
Объект с (зеленым диффузным) материалом экспортируется, но при загрузке проекта выглядит серым. Подскажите пожалуйста как решить проблему geometry dash jump. Спасибо. Blender 4.5.3. Прилагаю main.js файл.
import * as THREE from 'three';

import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';

const scene = new THREE.Scene();
scene.background = new THREE.Color( 0x9999ff );

const camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 0.1, 1000 );

const renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.setAnimationLoop( animate );
document.body.appendChild( renderer.domElement );

//const gridHelper = THREE.GridHelper(100, 100);
//scene.add(gridHelper);

const loader = new GLTFLoader();
loader.load( '../model.glb', function ( gltf ) {
scene.add(gltf.scene);
} );

const ambientLight = new THREE.AmbientLight(0xffffff, 0.5); // Soft white light
scene.add(ambientLight);

const directionalLight = new THREE.DirectionalLight(0xffffff, 0.8);
directionalLight.position.set(1, 1, 1).normalize(); // Position the light
scene.add(directionalLight);

camera.position.set(0, 0, 5);
camera.position.z = 0.1;
camera.lookAt(0, 0, 0);

const controls = new OrbitControls(camera, renderer.domElement);

function animate() {
requestAnimationFrame(animate);
controls.update();

renderer.render( scene, camera );

}
Please double check your material node in Blender and make sure to export the material file (FBX/GLTF/MTL)
 
Сверху