Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
f91185a3
T
three.js
项目概览
车家大少爷
/
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,发现更多精彩内容 >>
提交
f91185a3
编写于
11月 26, 2016
作者:
M
Mr.doob
提交者:
GitHub
11月 26, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #10230 from NickGerleman/dev
Rename ManualMSAARenderPass to SSAARenderPass
上级
fe574935
756d3fb7
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
51 addition
and
55 deletion
+51
-55
examples/files.js
examples/files.js
+2
-2
examples/js/postprocessing/SSAARenderPass.js
examples/js/postprocessing/SSAARenderPass.js
+9
-9
examples/js/postprocessing/TAARenderPass.js
examples/js/postprocessing/TAARenderPass.js
+7
-7
examples/webgl_postprocessing_ssaa.html
examples/webgl_postprocessing_ssaa.html
+11
-13
examples/webgl_postprocessing_ssaa_unbiased.html
examples/webgl_postprocessing_ssaa_unbiased.html
+19
-21
examples/webgl_postprocessing_taa.html
examples/webgl_postprocessing_taa.html
+3
-3
未找到文件。
examples/files.js
浏览文件 @
f91185a3
...
...
@@ -204,8 +204,8 @@ var files = {
"
webgl_postprocessing_glitch
"
,
"
webgl_postprocessing_godrays
"
,
"
webgl_postprocessing_masking
"
,
"
webgl_postprocessing_
m
saa
"
,
"
webgl_postprocessing_
m
saa_unbiased
"
,
"
webgl_postprocessing_
s
saa
"
,
"
webgl_postprocessing_
s
saa_unbiased
"
,
"
webgl_postprocessing_nodes
"
,
"
webgl_postprocessing_outline
"
,
"
webgl_postprocessing_procedural
"
,
...
...
examples/js/postprocessing/
ManualM
SAARenderPass.js
→
examples/js/postprocessing/
S
SAARenderPass.js
浏览文件 @
f91185a3
/**
*
*
Manual Multi-S
ample Anti-Aliasing Render Pass
*
Supers
ample Anti-Aliasing Render Pass
*
* @author bhouston / http://clara.io/
*
* This manual approach to
M
SAA re-renders the scene ones for each sample with camera jitter and accumulates the results.
* This manual approach to
S
SAA re-renders the scene ones for each sample with camera jitter and accumulates the results.
*
* References: https://en.wikipedia.org/wiki/
Multisample_anti-alias
ing
* References: https://en.wikipedia.org/wiki/
Supersampl
ing
*
*/
THREE
.
ManualM
SAARenderPass
=
function
(
scene
,
camera
,
clearColor
,
clearAlpha
)
{
THREE
.
S
SAARenderPass
=
function
(
scene
,
camera
,
clearColor
,
clearAlpha
)
{
THREE
.
Pass
.
call
(
this
);
...
...
@@ -24,7 +24,7 @@ THREE.ManualMSAARenderPass = function ( scene, camera, clearColor, clearAlpha )
this
.
clearColor
=
(
clearColor
!==
undefined
)
?
clearColor
:
0x000000
;
this
.
clearAlpha
=
(
clearAlpha
!==
undefined
)
?
clearAlpha
:
0
;
if
(
THREE
.
CopyShader
===
undefined
)
console
.
error
(
"
THREE.
ManualM
SAARenderPass relies on THREE.CopyShader
"
);
if
(
THREE
.
CopyShader
===
undefined
)
console
.
error
(
"
THREE.
S
SAARenderPass relies on THREE.CopyShader
"
);
var
copyShader
=
THREE
.
CopyShader
;
this
.
copyUniforms
=
Object
.
assign
(
{},
copyShader
.
uniforms
);
...
...
@@ -47,9 +47,9 @@ THREE.ManualMSAARenderPass = function ( scene, camera, clearColor, clearAlpha )
};
THREE
.
ManualM
SAARenderPass
.
prototype
=
Object
.
assign
(
Object
.
create
(
THREE
.
Pass
.
prototype
),
{
THREE
.
S
SAARenderPass
.
prototype
=
Object
.
assign
(
Object
.
create
(
THREE
.
Pass
.
prototype
),
{
constructor
:
THREE
.
ManualM
SAARenderPass
,
constructor
:
THREE
.
S
SAARenderPass
,
dispose
:
function
()
{
...
...
@@ -77,7 +77,7 @@ THREE.ManualMSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.
}
var
jitterOffsets
=
THREE
.
ManualM
SAARenderPass
.
JitterVectors
[
Math
.
max
(
0
,
Math
.
min
(
this
.
sampleLevel
,
5
)
)
];
var
jitterOffsets
=
THREE
.
S
SAARenderPass
.
JitterVectors
[
Math
.
max
(
0
,
Math
.
min
(
this
.
sampleLevel
,
5
)
)
];
var
autoClear
=
renderer
.
autoClear
;
renderer
.
autoClear
=
false
;
...
...
@@ -135,7 +135,7 @@ THREE.ManualMSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.
// before being used, thus these integers need to be scaled by 1/16.
//
// Sample patterns reference: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476218%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
THREE
.
ManualM
SAARenderPass
.
JitterVectors
=
[
THREE
.
S
SAARenderPass
.
JitterVectors
=
[
[
[
0
,
0
]
],
...
...
examples/js/postprocessing/TAARenderPass.js
浏览文件 @
f91185a3
...
...
@@ -14,21 +14,21 @@
THREE
.
TAARenderPass
=
function
(
scene
,
camera
,
params
)
{
if
(
THREE
.
ManualM
SAARenderPass
===
undefined
)
{
if
(
THREE
.
S
SAARenderPass
===
undefined
)
{
console
.
error
(
"
THREE.TAARenderPass relies on THREE.Manual
M
SAARenderPass
"
);
console
.
error
(
"
THREE.TAARenderPass relies on THREE.Manual
S
SAARenderPass
"
);
}
THREE
.
ManualM
SAARenderPass
.
call
(
this
,
scene
,
camera
,
params
);
THREE
.
S
SAARenderPass
.
call
(
this
,
scene
,
camera
,
params
);
this
.
sampleLevel
=
0
;
this
.
accumulate
=
false
;
};
THREE
.
TAARenderPass
.
JitterVectors
=
THREE
.
ManualM
SAARenderPass
.
JitterVectors
;
THREE
.
TAARenderPass
.
JitterVectors
=
THREE
.
S
SAARenderPass
.
JitterVectors
;
THREE
.
TAARenderPass
.
prototype
=
Object
.
assign
(
Object
.
create
(
THREE
.
ManualM
SAARenderPass
.
prototype
),
{
THREE
.
TAARenderPass
.
prototype
=
Object
.
assign
(
Object
.
create
(
THREE
.
S
SAARenderPass
.
prototype
),
{
constructor
:
THREE
.
TAARenderPass
,
...
...
@@ -36,7 +36,7 @@ THREE.TAARenderPass.prototype = Object.assign( Object.create( THREE.ManualMSAARe
if
(
!
this
.
accumulate
)
{
THREE
.
ManualM
SAARenderPass
.
prototype
.
render
.
call
(
this
,
renderer
,
writeBuffer
,
readBuffer
,
delta
);
THREE
.
S
SAARenderPass
.
prototype
.
render
.
call
(
this
,
renderer
,
writeBuffer
,
readBuffer
,
delta
);
this
.
accumulateIndex
=
-
1
;
return
;
...
...
@@ -59,7 +59,7 @@ THREE.TAARenderPass.prototype = Object.assign( Object.create( THREE.ManualMSAARe
if
(
this
.
accumulate
&&
this
.
accumulateIndex
===
-
1
)
{
THREE
.
ManualM
SAARenderPass
.
prototype
.
render
.
call
(
this
,
renderer
,
this
.
holdRenderTarget
,
readBuffer
,
delta
);
THREE
.
S
SAARenderPass
.
prototype
.
render
.
call
(
this
,
renderer
,
this
.
holdRenderTarget
,
readBuffer
,
delta
);
this
.
accumulateIndex
=
0
;
...
...
examples/webgl_postprocessing_
m
saa.html
→
examples/webgl_postprocessing_
s
saa.html
浏览文件 @
f91185a3
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<title>
three.js webgl - postprocessing
manual m
saa
</title>
<title>
three.js webgl - postprocessing
s
saa
</title>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
>
<style>
...
...
@@ -30,9 +30,9 @@
</head>
<body>
<div
id=
"info"
>
<a
href=
"http://threejs.org"
target=
"_blank"
>
three.js
</a>
- Manual
Multi-Sample Anti-Aliasing (M
SAA) pass by
<a
href=
"https://clara.io"
target=
"_blank"
>
Ben Houston
</a><br/><br/>
This manual approach to
MSAA re-renders the scene ones
for each sample with camera jitter and accumulates the results.
<br/><br/>
Texture interpolation, mipmapping and anistropic sampling is disabled to emphasize
<br/>
the effect
M
SAA levels have one the resulting render quality.
<a
href=
"http://threejs.org"
target=
"_blank"
>
three.js
</a>
- Manual
Supersampling Anti-Aliasing (S
SAA) pass by
<a
href=
"https://clara.io"
target=
"_blank"
>
Ben Houston
</a><br/><br/>
This manual approach to
SSAA re-renders the scene once
for each sample with camera jitter and accumulates the results.
<br/><br/>
Texture interpolation, mipmapping and anistropic sampling is disabled to emphasize
<br/>
the effect
S
SAA levels have one the resulting render quality.
</div>
<div
id=
"container"
></div>
...
...
@@ -44,7 +44,7 @@
<script
src=
"js/shaders/CopyShader.js"
></script>
<script
src=
"js/postprocessing/EffectComposer.js"
></script>
<script
src=
"js/postprocessing/
ManualM
SAARenderPass.js"
></script>
<script
src=
"js/postprocessing/
S
SAARenderPass.js"
></script>
<script
src=
"js/postprocessing/RenderPass.js"
></script>
<script
src=
"js/postprocessing/MaskPass.js"
></script>
<script
src=
"js/postprocessing/ShaderPass.js"
></script>
...
...
@@ -52,7 +52,7 @@
<script>
var
camera
,
scene
,
renderer
,
composer
,
copyPass
,
m
saaRenderPass
;
var
camera
,
scene
,
renderer
,
composer
,
copyPass
,
s
saaRenderPass
;
var
gui
,
stats
,
texture
;
var
param
=
{
...
...
@@ -95,8 +95,6 @@
stats
=
new
Stats
();
container
.
appendChild
(
stats
.
dom
);
//
camera
=
new
THREE
.
PerspectiveCamera
(
70
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
1000
);
camera
.
position
.
z
=
300
;
...
...
@@ -125,12 +123,12 @@
composer
=
new
THREE
.
EffectComposer
(
renderer
);
msaaRenderPass
=
new
THREE
.
ManualM
SAARenderPass
(
scene
,
camera
);
m
saaRenderPass
.
unbiased
=
false
;
composer
.
addPass
(
m
saaRenderPass
);
ssaaRenderPass
=
new
THREE
.
S
SAARenderPass
(
scene
,
camera
);
s
saaRenderPass
.
unbiased
=
false
;
composer
.
addPass
(
s
saaRenderPass
);
copyPass
=
new
THREE
.
ShaderPass
(
THREE
.
CopyShader
);
copyPass
.
renderToScreen
=
true
;
copyPass
.
renderToScreen
=
true
;
composer
.
addPass
(
copyPass
);
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
...
...
@@ -169,7 +167,7 @@
}
m
saaRenderPass
.
sampleLevel
=
param
.
sampleLevel
;
s
saaRenderPass
.
sampleLevel
=
param
.
sampleLevel
;
composer
.
render
();
stats
.
end
();
...
...
examples/webgl_postprocessing_
m
saa_unbiased.html
→
examples/webgl_postprocessing_
s
saa_unbiased.html
浏览文件 @
f91185a3
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<title>
three.js webgl - postprocessing manual
m
saa
</title>
<title>
three.js webgl - postprocessing manual
s
saa
</title>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
>
<style>
...
...
@@ -30,8 +30,8 @@
</head>
<body>
<div
id=
"info"
>
<a
href=
"http://threejs.org"
target=
"_blank"
>
three.js
</a>
- Unbiased Manual
Multi-Sample Anti-Aliasing (M
SAA) pass by
<a
href=
"https://clara.io"
target=
"_blank"
>
Ben Houston
</a><br/><br/>
This example shows how to unbias the rounding errors accumulated using high number of
M
SAA samples on a 8-bit per channel buffer.
<br/><br/>
<a
href=
"http://threejs.org"
target=
"_blank"
>
three.js
</a>
- Unbiased Manual
Supersamling Anti-Aliasing (S
SAA) pass by
<a
href=
"https://clara.io"
target=
"_blank"
>
Ben Houston
</a><br/><br/>
This example shows how to unbias the rounding errors accumulated using high number of
S
SAA samples on a 8-bit per channel buffer.
<br/><br/>
Turn off the "unbiased" feature to see the banding that results from accumulated rounding errors.
</div>
...
...
@@ -44,7 +44,7 @@
<script
src=
"js/shaders/CopyShader.js"
></script>
<script
src=
"js/postprocessing/EffectComposer.js"
></script>
<script
src=
"js/postprocessing/
ManualM
SAARenderPass.js"
></script>
<script
src=
"js/postprocessing/
S
SAARenderPass.js"
></script>
<script
src=
"js/postprocessing/RenderPass.js"
></script>
<script
src=
"js/postprocessing/MaskPass.js"
></script>
<script
src=
"js/postprocessing/ShaderPass.js"
></script>
...
...
@@ -53,8 +53,8 @@
<script>
var
scene
,
renderer
,
composer
,
copyPass
;
var
cameraP
,
m
saaRenderPassP
;
var
cameraO
,
m
saaRenderPassO
;
var
cameraP
,
s
saaRenderPassP
;
var
cameraO
,
s
saaRenderPassO
;
var
gui
,
stats
,
texture
;
var
params
=
{
...
...
@@ -115,8 +115,6 @@
stats
=
new
Stats
();
container
.
appendChild
(
stats
.
dom
);
//
cameraP
=
new
THREE
.
PerspectiveCamera
(
65
,
aspect
,
3
,
10
);
cameraP
.
position
.
z
=
7
;
...
...
@@ -178,14 +176,14 @@
// postprocessing
composer
=
new
THREE
.
EffectComposer
(
renderer
);
msaaRenderPassP
=
new
THREE
.
ManualM
SAARenderPass
(
scene
,
cameraP
);
composer
.
addPass
(
m
saaRenderPassP
);
msaaRenderPassO
=
new
THREE
.
ManualM
SAARenderPass
(
scene
,
cameraO
);
composer
.
addPass
(
m
saaRenderPassO
);
ssaaRenderPassP
=
new
THREE
.
S
SAARenderPass
(
scene
,
cameraP
);
composer
.
addPass
(
s
saaRenderPassP
);
ssaaRenderPassO
=
new
THREE
.
S
SAARenderPass
(
scene
,
cameraO
);
composer
.
addPass
(
s
saaRenderPassO
);
copyPass
=
new
THREE
.
ShaderPass
(
THREE
.
CopyShader
);
copyPass
.
renderToScreen
=
true
;
composer
.
addPass
(
copyPass
);
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
...
...
@@ -231,7 +229,7 @@
}
}
var
newColor
=
m
saaRenderPassP
.
clearColor
;
var
newColor
=
s
saaRenderPassP
.
clearColor
;
switch
(
params
.
clearColor
)
{
case
'
blue
'
:
newColor
=
0x0000ff
;
break
;
case
'
red
'
:
newColor
=
0xff0000
;
break
;
...
...
@@ -239,16 +237,16 @@
case
'
white
'
:
newColor
=
0xffffff
;
break
;
case
'
black
'
:
newColor
=
0x000000
;
break
;
}
msaaRenderPassP
.
clearColor
=
m
saaRenderPassO
.
clearColor
=
newColor
;
msaaRenderPassP
.
clearAlpha
=
m
saaRenderPassO
.
clearAlpha
=
params
.
clearAlpha
;
ssaaRenderPassP
.
clearColor
=
s
saaRenderPassO
.
clearColor
=
newColor
;
ssaaRenderPassP
.
clearAlpha
=
s
saaRenderPassO
.
clearAlpha
=
params
.
clearAlpha
;
msaaRenderPassP
.
sampleLevel
=
m
saaRenderPassO
.
sampleLevel
=
params
.
sampleLevel
;
msaaRenderPassP
.
unbiased
=
m
saaRenderPassO
.
unbiased
=
params
.
unbiased
;
ssaaRenderPassP
.
sampleLevel
=
s
saaRenderPassO
.
sampleLevel
=
params
.
sampleLevel
;
ssaaRenderPassP
.
unbiased
=
s
saaRenderPassO
.
unbiased
=
params
.
unbiased
;
m
saaRenderPassP
.
enabled
=
(
params
.
camera
===
'
perspective
'
);
m
saaRenderPassO
.
enabled
=
(
params
.
camera
===
'
orthographic
'
);
s
saaRenderPassP
.
enabled
=
(
params
.
camera
===
'
perspective
'
);
s
saaRenderPassO
.
enabled
=
(
params
.
camera
===
'
orthographic
'
);
msaaRenderPassP
.
renderToScreen
=
m
saaRenderPassO
.
renderToScreen
=
params
.
renderToScreen
;
ssaaRenderPassP
.
renderToScreen
=
s
saaRenderPassO
.
renderToScreen
=
params
.
renderToScreen
;
copyPass
.
enabled
=
!
params
.
renderToScreen
;
composer
.
render
();
...
...
examples/webgl_postprocessing_taa.html
浏览文件 @
f91185a3
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<title>
three.js webgl - postprocessing manual
m
saa
</title>
<title>
three.js webgl - postprocessing manual
taa and s
saa
</title>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
>
<style>
...
...
@@ -33,7 +33,7 @@
<a
href=
"http://threejs.org"
target=
"_blank"
>
three.js
</a>
- Temporal Anti-Aliasing (TAA) pass by
<a
href=
"https://clara.io"
target=
"_blank"
>
Ben Houston
</a><br/><br/>
When there is no motion in the scene, the TAA render pass accumulates jittered camera samples
<br/>
across frames to create a high quality anti-aliased result.
<br/><br/>
Texture interpolation, mipmapping and anistropic sampling is disabled to emphasize
<br/>
the effect
M
SAA levels have one the resulting render quality.
Texture interpolation, mipmapping and anistropic sampling is disabled to emphasize
<br/>
the effect
S
SAA levels have one the resulting render quality.
</div>
<div
id=
"container"
></div>
...
...
@@ -45,7 +45,7 @@
<script
src=
"js/shaders/CopyShader.js"
></script>
<script
src=
"js/postprocessing/EffectComposer.js"
></script>
<script
src=
"js/postprocessing/
ManualM
SAARenderPass.js"
></script>
<script
src=
"js/postprocessing/
S
SAARenderPass.js"
></script>
<script
src=
"js/postprocessing/TAARenderPass.js"
></script>
<script
src=
"js/postprocessing/RenderPass.js"
></script>
<script
src=
"js/postprocessing/MaskPass.js"
></script>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录