Hi !
I’m Maxime ! I’m quite new here but I already have few questions, I searched on Internet and the forum but all the answer I saw were a little bit complex for my problem.
So…
- I made a 3D model on Cinema4D, with Materials and textures and I decided to remake the lighting in three.js (Because I saw C4D was not correctly exporting lights…)
- I exported to GLTF
- I passed hours to figure why my materials were not showing but I found out I needed to make PBR Materials.
- I put Directional Light and Spotlight with anti-aliasing, etc.
Here I am, after trying to recreate examples, I have several problems with my lightings and I really don’t know how to resolve them…
Here the render with cinema4D, the result I would like :
Here the render with threeJS :
Here my scene in C4D : I used a big square to make and infinite and shadows for the tree with a specific color
So could you explain to me (like I was 5), why :
- I see kind of shadows on the right ? Is it because I have a big square around to make my background ?
- Why my material is so dark when I check the reflectance button in C4D? And so…
- Have you any idea how to make a Reflectance Material with C4D?
- Which light are essentials ?
Here my code :
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xFFD500);
const camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 5000);
const windowHalf = new THREE.Vector2(window.innerWidth / 2, window.innerHeight / 2);
//INIT POSITION
camera.position.set(-1.2, 1.3, 10)
camera.rotation.set(0, 0.15, 0)
scene.position.set(0, 0, 0)
scene.rotation.set(0, 0, 0)
// LOAD OBJECT
let loader = new THREE.GLTFLoader();
loader.load('models/modeles15.glb', function(gltf) {
let car = gltf.scene;
car.traverse(n => {
if (n.isMesh) {
n.castShadow = true;
n.receiveShadow = true;
if (n.material.map) n.material.map.anisotropy = 16;
}
})
car.position.y = 1
car.position.x = -2
car.rotation.y = 14
scene.add(car);
animate();
})
// LIGHT //
const light_2 = new THREE.DirectionalLight(0xFFFFFF);
light_2.position.set(10, 10, 20)
light_2.intensity = 3
light_2.castShadow = true;
scene.add(light_2)
const ambient = new THREE.SpotLight(0xFFD500, 2);
ambient.castShadow = true;
ambient.position.set(0, 100, 10)
ambient.shadow.bias = -0.0001;
ambient.shadow.mapSize.width = 1024 * 4;
ambient.shadow.mapSize.height = 1024 * 4;
scene.add(ambient);
const renderer = new THREE.WebGLRenderer({
antialias: true
});
renderer.toneMappingExposure = 2.3
renderer.shadowMap.enabled = true;
renderer.gammaFactor = 0;
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
function animate() {
renderer.render(scene, camera);
}
Last thing : sorry for my english !
Thank you for your help !