Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
c7e112eb
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,发现更多精彩内容 >>
未验证
提交
c7e112eb
编写于
4月 24, 2020
作者:
M
Mr.doob
提交者:
GitHub
4月 24, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19196 from WestLangley/dev_aces_filmic
Examples: Added ACESFilmicTonemappingShader
上级
bdb324ef
79328f2a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
181 addition
and
0 deletion
+181
-0
examples/js/shaders/ACESFilmicToneMappingShader.js
examples/js/shaders/ACESFilmicToneMappingShader.js
+88
-0
examples/jsm/shaders/ACESFilmicToneMappingShader.js
examples/jsm/shaders/ACESFilmicToneMappingShader.js
+92
-0
utils/modularize.js
utils/modularize.js
+1
-0
未找到文件。
examples/js/shaders/ACESFilmicToneMappingShader.js
0 → 100644
浏览文件 @
c7e112eb
/**
* @author WestLangley / http://github.com/WestLangley
*
* ACES Filmic Tone Mapping Shader by Stephen Hill
* source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs
*/
THREE
.
ACESFilmicToneMappingShader
=
{
uniforms
:
{
'
tDiffuse
'
:
{
value
:
null
},
'
exposure
'
:
{
value
:
1.0
}
},
vertexShader
:
[
'
varying vec2 vUv;
'
,
'
void main() {
'
,
'
vUv = uv;
'
,
'
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
'
,
'
}
'
].
join
(
'
\n
'
),
fragmentShader
:
[
'
#define saturate(a) clamp( a, 0.0, 1.0 )
'
,
'
uniform sampler2D tDiffuse;
'
,
'
uniform float exposure;
'
,
'
varying vec2 vUv;
'
,
'
vec3 RRTAndODTFit( vec3 v ) {
'
,
'
vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
'
,
'
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
'
,
'
return a / b;
'
,
'
}
'
,
'
vec3 ACESFilmicToneMapping( vec3 color ) {
'
,
// sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT
'
const mat3 ACESInputMat = mat3(
'
,
'
vec3( 0.59719, 0.07600, 0.02840 ),
'
,
// transposed from source
'
vec3( 0.35458, 0.90834, 0.13383 ),
'
,
'
vec3( 0.04823, 0.01566, 0.83777 )
'
,
'
);
'
,
// ODT_SAT => XYZ => D60_2_D65 => sRGB
'
const mat3 ACESOutputMat = mat3(
'
,
'
vec3( 1.60475, -0.10208, -0.00327 ),
'
,
// transposed from source
'
vec3( -0.53108, 1.10813, -0.07276 ),
'
,
'
vec3( -0.07367, -0.00605, 1.07602 )
'
,
'
);
'
,
'
color = ACESInputMat * color;
'
,
// Apply RRT and ODT
'
color = RRTAndODTFit( color );
'
,
'
color = ACESOutputMat * color;
'
,
// Clamp to [0, 1]
'
return saturate( color );
'
,
'
}
'
,
'
void main() {
'
,
'
vec4 tex = texture2D( tDiffuse, vUv );
'
,
'
tex.rgb *= exposure;
'
,
// pre-exposed, outside of the tone mapping function
'
gl_FragColor = vec4( ACESFilmicToneMapping( tex.rgb ), tex.a );
'
,
'
}
'
].
join
(
'
\n
'
)
};
examples/jsm/shaders/ACESFilmicToneMappingShader.js
0 → 100644
浏览文件 @
c7e112eb
/**
* @author WestLangley / http://github.com/WestLangley
*
* ACES Filmic Tone Mapping Shader by Stephen Hill
* source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs
*/
var
ACESFilmicToneMappingShader
=
{
uniforms
:
{
'
tDiffuse
'
:
{
value
:
null
},
'
exposure
'
:
{
value
:
1.0
}
},
vertexShader
:
[
'
varying vec2 vUv;
'
,
'
void main() {
'
,
'
vUv = uv;
'
,
'
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
'
,
'
}
'
].
join
(
'
\n
'
),
fragmentShader
:
[
'
#define saturate(a) clamp( a, 0.0, 1.0 )
'
,
'
uniform sampler2D tDiffuse;
'
,
'
uniform float exposure;
'
,
'
varying vec2 vUv;
'
,
'
vec3 RRTAndODTFit( vec3 v ) {
'
,
'
vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
'
,
'
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
'
,
'
return a / b;
'
,
'
}
'
,
'
vec3 ACESFilmicToneMapping( vec3 color ) {
'
,
// sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT
'
const mat3 ACESInputMat = mat3(
'
,
'
vec3( 0.59719, 0.07600, 0.02840 ),
'
,
// transposed from source
'
vec3( 0.35458, 0.90834, 0.13383 ),
'
,
'
vec3( 0.04823, 0.01566, 0.83777 )
'
,
'
);
'
,
// ODT_SAT => XYZ => D60_2_D65 => sRGB
'
const mat3 ACESOutputMat = mat3(
'
,
'
vec3( 1.60475, -0.10208, -0.00327 ),
'
,
// transposed from source
'
vec3( -0.53108, 1.10813, -0.07276 ),
'
,
'
vec3( -0.07367, -0.00605, 1.07602 )
'
,
'
);
'
,
'
color = ACESInputMat * color;
'
,
// Apply RRT and ODT
'
color = RRTAndODTFit( color );
'
,
'
color = ACESOutputMat * color;
'
,
// Clamp to [0, 1]
'
return saturate( color );
'
,
'
}
'
,
'
void main() {
'
,
'
vec4 tex = texture2D( tDiffuse, vUv );
'
,
'
tex.rgb *= exposure;
'
,
// pre-exposed, outside of the tone mapping function
'
gl_FragColor = vec4( ACESFilmicToneMapping( tex.rgb ), tex.a );
'
,
'
}
'
].
join
(
'
\n
'
)
};
export
{
ACESFilmicToneMappingShader
};
utils/modularize.js
浏览文件 @
c7e112eb
...
...
@@ -171,6 +171,7 @@ var files = [
{
path
:
'
renderers/Projector.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
renderers/SVGRenderer.js
'
,
dependencies
:
[
{
name
:
'
Projector
'
,
path
:
'
renderers/Projector.js
'
},
{
name
:
'
RenderableFace
'
,
path
:
'
renderers/Projector.js
'
},
{
name
:
'
RenderableLine
'
,
path
:
'
renderers/Projector.js
'
},
{
name
:
'
RenderableSprite
'
,
path
:
'
renderers/Projector.js
'
}
],
ignoreList
:
[]
},
{
path
:
'
shaders/ACESFilmicToneMappingShader.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
shaders/AfterimageShader.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
shaders/BasicShader.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
shaders/BleachBypassShader.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录