bump_test.js 792 B

1234567891011121314151617181920
  1. var CreateBumpScene = function (engine) {
  2. var scene = new BABYLON.Scene(engine);
  3. var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0, 10, BABYLON.Vector3.Zero(), scene);
  4. var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(20, 100, 2), scene);
  5. var sphere = BABYLON.Mesh.CreateSphere("Sphere", 16, 3, scene);
  6. var material = new BABYLON.StandardMaterial("kosh", scene);
  7. material.bumpTexture = new BABYLON.Texture("Scenes/Customs/normalMap.jpg", scene);
  8. material.diffuseColor = new BABYLON.Color3(1, 0, 0);
  9. sphere.material = material;
  10. camera.setPosition(new BABYLON.Vector3(-5, 5, 0));
  11. // Animations
  12. scene.registerBeforeRender(function() {
  13. sphere.rotation.y += 0.02;
  14. });
  15. return scene;
  16. };