My custom shader appears to not be working on the mesh I just imported. To illustrate what it is suppose to be looking like I rendered a sphere right above it, upon which the shader does seem to act normally. My suspicion is the normals on the mesh are wrong. Image below:
The code I use to import (for testing only):
BABYLON.SceneLoader.ImportMesh('', "../Meshes/", "scene.gltf", scene, function(newMeshes){
camera.target = newMeshes[0];
var amigaMaterial = new BABYLON.ShaderMaterial("amiga", scene, "../HighContrast",
{
attributes: ["position", "normal", "uv"],
uniforms: ["world", "worldViewProjection", "lightSource", "threshold"]
});
amigaMaterial.setVector3("lightSource", new BABYLON.Vector3(10, 10., 40.));
amigaMaterial.setFloat("threshold", 0.7);
scene.clearColor = new BABYLON.Color3(255., 255., 255.);
newMeshes[0].material = amigaMaterial;
var sphere = BABYLON.Mesh.CreateSphere("Sphere", 16, 1, scene);
sphere.material = amigaMaterial;
sphere.position.y += 2
newMeshes[0].position = BABYLON.Vector3.Zero();
});
Anyone got any idea what I’m doing wrong here?