カメラと光源もあると仮定すると、コードは基本的に正しく見えます。ここに遊び場のエントリがあります。
そして、後世のために、そのコードは次のとおりです。
var scene = new BABYLON.Scene(engine);
//Create a light
var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(-60, 60, 80), scene);
//Create an Arc Rotate Camera - aimed negative z this time
var camera = new BABYLON.ArcRotateCamera("Camera", Math.PI / 2, 1.0, 210, BABYLON.Vector3.Zero(), scene);
camera.attachControl(canvas, true);
//Creation of a repeated textured material
var materialPlane = new BABYLON.StandardMaterial("texturePlane", scene);
materialPlane.diffuseTexture = new BABYLON.Texture("textures/grass.jpg", scene);
materialPlane.specularColor = new BABYLON.Color3(0, 0, 0);
materialPlane.backFaceCulling = false;//Allways show the front and the back of an element
//Creation of a plane
var plane = BABYLON.Mesh.CreatePlane("plane", 120, scene);
plane.rotation.x = Math.PI / 2;
plane.material = materialPlane;
私は彼らのデモの 1 つから始めて、最小限の例を得るためにほとんどのものをハッキングしました。私はbackFaceCulling = false
(それ以外の場合、画像は一方向からしか見えないため)に残して、specularColor
設定に追加しました。
別のアプローチは、diffuseTexture
を次のように置き換えることemissiveTexture
です。
materialPlane.emissiveTexture = new BABYLON.Texture("textures/grass.jpg", scene);
次に、ライトをコメントアウトしても、まだ表示されます。(実際、光を当てたままだと白とびしてしまいます。)
(キーボード制御と衝突検出の質問については、新しい質問を開始することをお勧めします。または、バビロンのサンプルとチュートリアル ビデオに取り組んでください。)