Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
7a6666b8
T
three.js
项目概览
Ablesons
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7a6666b8
编写于
8月 02, 2019
作者:
S
sunag
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
energy-preservation flag
上级
d1f94e36
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
18 addition
and
2 deletion
+18
-2
examples/jsm/nodes/materials/nodes/StandardNode.js
examples/jsm/nodes/materials/nodes/StandardNode.js
+4
-0
src/materials/MeshStandardMaterial.d.ts
src/materials/MeshStandardMaterial.d.ts
+2
-0
src/materials/MeshStandardMaterial.js
src/materials/MeshStandardMaterial.js
+6
-0
src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js
...shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js
+2
-2
src/renderers/webgl/WebGLProgram.js
src/renderers/webgl/WebGLProgram.js
+2
-0
src/renderers/webgl/WebGLPrograms.js
src/renderers/webgl/WebGLPrograms.js
+2
-0
未找到文件。
examples/jsm/nodes/materials/nodes/StandardNode.js
浏览文件 @
7a6666b8
...
...
@@ -20,6 +20,8 @@ function StandardNode() {
this
.
roughness
=
new
FloatNode
(
0.5
);
this
.
metalness
=
new
FloatNode
(
0.5
);
this
.
energyPreservation
=
true
;
}
StandardNode
.
prototype
=
Object
.
create
(
Node
.
prototype
);
...
...
@@ -32,6 +34,8 @@ StandardNode.prototype.build = function ( builder ) {
builder
.
define
(
this
.
clearCoat
||
this
.
clearCoatRoughness
?
'
PHYSICAL
'
:
'
STANDARD
'
);
if
(
this
.
energyPreservation
)
builder
.
define
(
'
ENERGY_PRESERVATION
'
);
builder
.
requires
.
lights
=
true
;
builder
.
extensions
.
shaderTextureLOD
=
true
;
...
...
src/materials/MeshStandardMaterial.d.ts
浏览文件 @
7a6666b8
...
...
@@ -29,6 +29,7 @@ export interface MeshStandardMaterialParameters extends MaterialParameters {
alphaMap
?:
Texture
;
envMap
?:
Texture
;
envMapIntensity
?:
number
;
energyPreservation
:
boolean
;
refractionRatio
?:
number
;
wireframe
?:
boolean
;
wireframeLinewidth
?:
number
;
...
...
@@ -66,6 +67,7 @@ export class MeshStandardMaterial extends Material {
alphaMap
:
Texture
|
null
;
envMap
:
Texture
|
null
;
envMapIntensity
:
number
;
energyPreservation
:
boolean
;
refractionRatio
:
number
;
wireframe
:
boolean
;
wireframeLinewidth
:
number
;
...
...
src/materials/MeshStandardMaterial.js
浏览文件 @
7a6666b8
...
...
@@ -44,6 +44,8 @@ import { Color } from '../math/Color.js';
* envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),
* envMapIntensity: <float>
*
* energyPreservation: <bool>,
*
* refractionRatio: <float>,
*
* wireframe: <boolean>,
...
...
@@ -99,6 +101,8 @@ function MeshStandardMaterial( parameters ) {
this
.
envMap
=
null
;
this
.
envMapIntensity
=
1.0
;
this
.
energyPreservation
=
true
;
this
.
refractionRatio
=
0.98
;
this
.
wireframe
=
false
;
...
...
@@ -161,6 +165,8 @@ MeshStandardMaterial.prototype.copy = function ( source ) {
this
.
envMap
=
source
.
envMap
;
this
.
envMapIntensity
=
source
.
envMapIntensity
;
this
.
energyPreservation
=
source
.
energyPreservation
;
this
.
refractionRatio
=
source
.
refractionRatio
;
this
.
wireframe
=
source
.
wireframe
;
...
...
src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js
浏览文件 @
7a6666b8
...
...
@@ -98,7 +98,7 @@ void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricCo
// Defer to the IndirectSpecular function to compute
// the indirectDiffuse if energy preservation is enabled.
#ifndef EN
VMAP_TYPE_CUBE_UV
#ifndef EN
ERGY_PRESERVATION
reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
...
...
@@ -120,7 +120,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
// Both indirect specular and diffuse light accumulate here
// if energy preservation enabled, and PMREM provided.
#if defined( EN
VMAP_TYPE_CUBE_UV
)
#if defined( EN
ERGY_PRESERVATION
)
vec3 singleScattering = vec3( 0.0 );
vec3 multiScattering = vec3( 0.0 );
...
...
src/renderers/webgl/WebGLProgram.js
浏览文件 @
7a6666b8
...
...
@@ -522,6 +522,8 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters,
parameters
.
physicallyCorrectLights
?
'
#define PHYSICALLY_CORRECT_LIGHTS
'
:
''
,
parameters
.
energyPreservation
?
'
#define ENERGY_PRESERVATION
'
:
''
,
parameters
.
logarithmicDepthBuffer
?
'
#define USE_LOGDEPTHBUF
'
:
''
,
parameters
.
logarithmicDepthBuffer
&&
(
capabilities
.
isWebGL2
||
extensions
.
get
(
'
EXT_frag_depth
'
)
)
?
'
#define USE_LOGDEPTHBUF_EXT
'
:
''
,
...
...
src/renderers/webgl/WebGLPrograms.js
浏览文件 @
7a6666b8
...
...
@@ -201,6 +201,8 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
toneMapping
:
renderer
.
toneMapping
,
physicallyCorrectLights
:
renderer
.
physicallyCorrectLights
,
energyPreservation
:
material
.
energyPreservation
,
premultipliedAlpha
:
material
.
premultipliedAlpha
,
alphaTest
:
material
.
alphaTest
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录