Skip to content

Instantly share code, notes, and snippets.

@flushpot1125

flushpot1125/pool_water.js

Last active Aug 15, 2018
Embed
What would you like to do?
//水面
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