I have hit a roadblock in my project development. I am striving to create a level using various phong materials on objects of unique sizes and shapes. However, Three.JS's default texture handling causes them to stretch out and look distorted on meshes that are not a perfect 1:1:1 ratio. To work around this issue, textures can be loaded with repeat options. But with over 100 objects of different sizes, each requiring unique repeat settings for their materials, hundreds of textures would need to be loaded, consuming a lot of memory. I need assistance in finding a solution to efficiently handle a large number of objects with different geometries and textures. How can I apply unique repeat settings to a single texture based on the material? Even if this problem is solved, I still need to repeat this process for at least 5 textures per material, resulting in a significant number of texture variations. This is a major challenge.
I am feeling quite desperate about this issue and am considering switching to Unity or UE4 if I cannot manage to handle objects in bulk.
I am willing to completely overhaul my code from scratch. While it may not be perfect, I want to showcase how I work with objects in THREE.js. The following code snippet is just an example of my approach:
var energyRockMaterial =
new THREE.MeshPhongMaterial(
{
envMap: scene.background,
map: new THREE.TextureLoader().load("energyrock.jpg"),
normalMap: new THREE.TextureLoader().load("energyrocknormal.jpg"),
aoMap: new THREE.TextureLoader().load("energyrockao.jpg"),
specularMap: new THREE.TextureLoader().load("energyrockspecular.jpg"),
emissiveMap: new THREE.TextureLoader().load("energyrockemissive.jpg"),
color:"#ffffff",
emissive:"#bb00bb",
specular:"#000000",
reflectivity:1,
});
var energyRockGeometry = new THREE.BoxBufferGeometry(1,1,1);
var energyRockMesh = new THREE.Mesh(energyRockGeometry,energyRockMaterial);
scene.add(energyRockMesh)
Apologies for the formatting issues with the code snippet. Thank you for your understanding.
Any assistance or advice provided would be greatly appreciated.