When attempting to render a 'soft' cube with a normal map, I encountered an issue. Despite not receiving any errors or warnings while running the code, adding the normal map parameter resulted in a black object when refreshing the browser. Removing the normal map allowed me to successfully render a cube with a Phong material. Interestingly, changing the material to a Normal material and trying to texture the cube caused the actual RGB normal map to be applied unintentionally. Additionally, the normal map worked correctly when I omitted the THREE.SubdivisionModifier() on the cube and rendered a sharp-edged cube instead. Any suggestions on how to address this issue would be greatly appreciated. Here is the code snippet:
var cube_geo = new THREE.BoxGeometry(.1, .1, .1, 5, 5, 5);
var smooth = cube_geo.clone();
var modifier = new THREE.SubdivisionModifier(5);
modifier.modify(smooth);
var cube_mat = new THREE.MeshPhongMaterial(
{
color: 0x000000,
specular: 0x222222,
normalMap: cube_normal_map,
}
);
cube = new THREE.Mesh(smooth, cube_mat);
scene.add(cube);