Babylonjs学习笔记(六)——贴图的使用

编程入门 行业动态 更新时间:2024-10-26 02:24:35

Babylonjs<a href=https://www.elefans.com/category/jswz/34/1770117.html style=学习笔记(六)——贴图的使用"/>

Babylonjs学习笔记(六)——贴图的使用

书接上回,这里讨论贴图的运用!!!

// 创建球网格const ball = MeshBuilder.CreateSphere('ball',{diameter:1},scene)ball.position = new Vector3(0,1,0)// 创建PRB材质const ballMat = new PBRMaterial('pbr',scene)// albedoTexture 反照率贴图ballMat.albedoTexture = new Texture('./textures/aerial_beach_02_diff_4k.jpg',scene)// 法线贴图ballMat.bumpTexture = new Texture('./textures/aerial_beach_02_nor_gl_4k.jpg',scene)ballMat.invertNormalMapX = trueballMat.invertNormalMapY = true// ao贴图ballMat.metallicTexture = new Texture('./textures/aerial_beach_02_ao_4k.jpg',scene)ballMat.useAmbientOcclusionFromMetallicTextureRed = trueballMat.useRoughnessFromMetallicTextureGreen = trueballMat.useMetallnessFromMetallicTextureBlue = true// 发光贴图ballMat.emissiveTexture = new Texture('./textures/emissive.jpg',scene)// 默认是黑色 不发光ballMat.emissiveColor = new Color3(1,1,1)// 发光强度ballMat.emissiveIntensity = 1// 材质接收到的环境光强度ballMat.environmentIntensity = 0.25// 发光层const glowLayer  = new GlowLayer('glow',scene)glowLayer.intensity = 1// 应用材质ball.material = ballMat;

更多推荐

Babylonjs学习笔记(六)——贴图的使用

本文发布于:2023-12-03 09:33:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1653814.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:学习笔记   贴图   Babylonjs

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!