
- BabylonJS 教程
- BabylonJS - 主頁
- BabylonJS - 簡介
- BabylonJS - 環境設定
- BabylonJS - 概述
- BabylonJS - 基本元素
- BabylonJS - 材質
- BabylonJS - 動畫
- BabylonJS - 相機
- BabylonJS - 燈光
- BabylonJS - 引數形狀
- BabylonJS - 網格
- VectorPosition 和旋轉
- BabylonJS - 貼花
- BabylonJS - Curve3
- BabylonJS - 動態紋理
- BabylonJS - 視差對映
- BabylonJS - 鏡頭光暈
- BabylonJS - 建立螢幕快照
- BabylonJS - 反射探針
- 標準渲染管道
- BabylonJS - ShaderMaterial
- BabylonJS - 骨骼
- BabylonJS - 物理引擎
- BabylonJS - 播放聲音和音樂
- BabylonJS 實用資源
- BabylonJS - 快速指南
- BabylonJS - 實用資源
- BabylonJS - 討論
BabylonJS - 背面裁剪
背面裁剪決定圖形物件的圖形是否可見。背面裁剪決定 StandardMaterial 是否從背面(後面)可見。
演示
<!doctype html> <html> <head> <meta charset = "utf-8"> <title>BabylonJs - Basic Element-Creating Scene</title> <script src = "babylon.js"></script> <style> canvas {width: 100%; height: 100%;} </style> </head> <body> <canvas id = "renderCanvas"></canvas> <script type = "text/javascript"> var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); var createScene = function() { var scene = new BABYLON.Scene(engine); var camera = new BABYLON.ArcRotateCamera("Camera", 1, 0.8, 10, new BABYLON.Vector3(0, 0, 0), scene); camera.attachControl(canvas, true); var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 1, 0), scene); light.intensity = 0.7; var materialforsphere = new BABYLON.StandardMaterial("texture1", scene); var sphere = BABYLON.Mesh.CreateSphere("Sphere1",20, 3.0, scene); sphere.material = materialforsphere; materialforsphere.diffuseTexture = new BABYLON.Texture("images/rainbow.png", scene); materialforsphere.diffuseTexture.hasAlpha = true materialforsphere.backFaceCulling = false; return scene; }; var scene = createScene(); engine.runRenderLoop(function() { scene.render(); }); </script> </body> </html>
輸出
上述程式碼行生成以下輸出 −

在此演示中,我們使用了一幅名為 rainbow.png 的影像。這些影像儲存在 images/ 本地資料夾中。你可以在演示連結中下載任何你選擇的圖片並使用。
babylonjs_materials.htm
廣告