Skip to content

Instantly share code, notes, and snippets.

@flushpot1125
Last active August 15, 2018 04:44
Show Gist options
  • Save flushpot1125/39b4bf9d168d9b076eff0da1dd2f722b to your computer and use it in GitHub Desktop.
Save flushpot1125/39b4bf9d168d9b076eff0da1dd2f722b to your computer and use it in GitHub Desktop.
//水面
var waterMesh = BABYLON.Mesh.CreateGround("waterMesh", 512, 512, 32, scene, false);
//水のマテリアルを宣言
var water = new BABYLON.WaterMaterial("water", scene, new BABYLON.Vector2(512, 512));
//風の有無、色、反射対象を指定
water.backFaceCulling = true;
water.bumpTexture = new BABYLON.Texture("textures/waterbump.png", scene);
water.windForce = -10;
water.waveHeight = 0.6;
water.bumpHeight = 0.1;
water.windDirection = new BABYLON.Vector2(1, 1);
water.waterColor = new BABYLON.Color3(0, 0, 221 / 255);
water.colorBlendFactor = 0.0;
water.addToRenderList(skybox);//水面にskyboxを反射させる
water.addToRenderList(sphere1);//水面に光の球を反射させる 表現が好みの範囲なので、今回は試験的にSphere1(赤色)のみ適用
waterMesh.material = water;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment