38three.js StandardMaterial和RectAreaLight

https://threejs.org/docs/index.html#api/materials/MeshStandardMaterial

A standard physically based material, using Metallic-Roughness workflow.

Physically based rendering (PBR) has recently become the standard in many 3D applications, such as Unity, Unreal and 3D Studio Max.

This approach differs from older approaches in that instead of using approximations for the way in which light interacts with a surface, a physically correct model is used. The idea is that, instead of tweaking materials to look good under specific lighting, a material can be created that will react 'correctly' under all lighting scenarios.

Three.js中的新型标准化材质,可以制作出金属或者玻璃效果。
能对矩形光源生效,矩形光源也只对MeshStandardMaterial和 MeshPhysicalMaterial
材质生效。RectAreaLight非常的消耗性能,低端的手机会出现卡顿现象。
有几个重要的属性可以设置,再配置过程中应该参考官方文档,因为版本更新比较大,很多书籍和网络教程都过时了。

object.traverse( function ( child ) {
                if ( child.isMesh ) {
                    child.castShadow = true;
                    child.receiveShadow = true;
                    child.material = new THREE.MeshStandardMaterial({
                        color:child.material.color,
                        //reflectivity:0, //反射率 默认1  不适用该材质
                        refractionRatio:0,//环境贴图折射率 默认0.98
                        roughness: 0, //粗糙程度 0镜面 1完全扩散 默认0.5
                        //roughnessMap:texture2,//与 粗糙程度相乘
                        metalness: 0.5, //金属1 塑料0 默认0.5
                        //metalnessMap:texture2,// 金属贴图和金属属性相乘
                        //wireframe:true //测试线框
                    });
                    child.material.side = THREE.DoubleSide;
                }
            } );

RectAreaLight

RectAreaLight emits light uniformly across the face a rectangular plane. This light type can be used to simulate light sources such as bright windows or strip lighting.
intensity光线强度默认为1,可以设置大于1的值。

var width = 10;
var height = 10;
var intensity = 10;
var rectLight = new THREE.RectAreaLight( 0xffffff, intensity,  width, height );
rectLight.position.set( 5, 5, 0 );
rectLight.lookAt( 0, 0, 0 );
scene.add( rectLight )

rectLightHelper = new THREE.RectAreaLightHelper( rectLight );
scene.add( rectLightHelper );
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,847评论 0 10
  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 11,052评论 0 23
  • “你奶奶呢?” “买葡萄去了”小女孩眨巴着眼睛说 “不是哩,你奶奶走啦,回五亩(地名)去啦” 小女孩大哭。 回家的...
    帅姑娘T阅读 179评论 0 0
  • 十多年前碧玉年华,一人离家独闯江湖。深夜无眠,是金庸老爷子的一本本经典神著伴我度过。看过六神磊磊分析了诸多人物,好...
    蓝戒子阅读 1,063评论 0 1
  • 道理我都懂,所以困难我来抗。 太多的为什么,没有答案;太多的答案,没有为什么。一切皆有定数,求之不得,弃之不舍。 ...
    假行僧的我阅读 154评论 0 0

友情链接更多精彩内容