返回介绍

手册

参考

示例

开发者参考

物理网格材质(MeshPhysicalMaterial)

发布于 2021-07-10 14:14:18 字数 6412 浏览 1797 评论 0 收藏 0

MeshStandardMaterial的扩展,提供了更高级的基于物理的渲染属性:

  • Clearcoat: Some materials — like car paints, carbon fiber, and wet surfaces — require a clear, reflective layer on top of another layer that may be irregular or rough. Clearcoat approximates this effect, without the need for a separate transparent surface.
  • Physically-based transparency: One limitation of .opacity is that highly transparent materials are less reflective. Physically-based .transmission provides a more realistic option for thin, transparent surfaces like glass.
  • Advanced reflectivity: More flexible reflectivity for non-metallic materials.

As a result of these complex shading features, MeshPhysicalMaterial has a higher performance cost, per pixel, than other three.js materials. Most effects are disabled by default, and add cost as they are enabled. For best results, always specify an environment map when using this material.

// iOS iframe auto-resize workaround if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) { const scene = document.getElementById( 'scene' ); scene.style.width = getComputedStyle( scene ).width; scene.style.height = getComputedStyle( scene ).height; scene.setAttribute( 'scrolling', 'no' ); }

例子

materials / variations / physical
materials / physical / clearcoat
materials / physical / reflectivity
materials / physical / sheen
materials / physical / transmission

构造函数(Constructor)

MeshPhysicalMaterial( parameters : Object )

parameters - (可选)用于定义材质外观的对象,具有一个或多个属性。 材质的任何属性都可以从此处传入(包括从MaterialMeshStandardMaterial继承的任何属性)

属性color例外,其可以作为十六进制字符串传递,默认情况下为 0xffffff(白色),内部调用Color.set(color)。

属性(Properties)

共有属性请参见其基类MaterialMeshStandardMaterial

.clearcoat : Float

Represents the intensity of the clear coat layer, from 0.0 to 1.0. Use clear coat related properties to enable multilayer materials that have a thin translucent layer over the base layer. Default is 0.0.

.clearcoatMap : Texture

The red channel of this texture is multiplied against .clearcoat, for per-pixel control over a coating's intensity. Default is null.

.clearcoatNormalMap : Texture

Can be used to enable independent normals for the clear coat layer. Default is null.

.clearcoatNormalScale : Vector2

How much .clearcoatNormalMap affects the clear coat layer, from (0,0) to (1,1). Default is (1,1).

.clearcoatRoughness : Float

Roughness of the clear coat layer, from 0.0 to 1.0. Default is 0.0.

.clearcoatRoughnessMap : Texture

The green channel of this texture is multiplied against .clearcoatRoughness, for per-pixel control over a coating's roughness. Default is null.

.defines : Object

如下形式的对象:

{
      'STANDARD': ''
      'PHYSICAL': '',
    };
WebGLRenderer使用它来选择shaders。

.ior : Float

Index-of-refraction for non-metallic materials, from 1.0 to 2.333. Default is 1.5.

.reflectivity : Float

Degree of reflectivity, from 0.0 to 1.0. Default is 0.5, which corresponds to an index-of-refraction of 1.5.
这模拟了非金属材质的反射率。当MeshStandardMaterial1.0时,此属性无效。

.sheen : Color

If a color is assigned to this property, the material will use a special sheen BRDF intended for rendering cloth materials such as velvet. The sheen color provides the ability to create two-tone specular materials. null by default.

.transmission : Float

Degree of transmission (or optical transparency), from 0.0 to 1.0. Default is 0.0.
Thin, transparent or semitransparent, plastic or glass materials remain largely reflective even if they are fully transmissive. The transmission property can be used to model these materials.
When transmission is non-zero, opacity should be set to 1.

.transmissionMap : Texture

The red channel of this texture is multiplied against .transmission, for per-pixel control over optical transparency. Default is null.

方法(Methods)

共有方法请参见其基类MaterialMeshStandardMaterial

源码(Source)

src/materials/MeshPhysicalMaterial.js

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文