Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
badfaad7
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,发现更多精彩内容 >>
提交
badfaad7
编写于
2月 15, 2016
作者:
B
Ben Houston
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix msaa pass, improve example.
上级
3c8cb97f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
77 addition
and
7 deletion
+77
-7
examples/js/postprocessing/MSAAPass.js
examples/js/postprocessing/MSAAPass.js
+8
-0
examples/webgl_postprocessing_msaa.html
examples/webgl_postprocessing_msaa.html
+69
-7
未找到文件。
examples/js/postprocessing/MSAAPass.js
浏览文件 @
badfaad7
/**
* @author bhouston / http://clara.io/
*
* NOTE: Accumulating a lot of samples with a 8-bit-per-channel RGB/RGBA buffer will
* lead to discretization effects. For accurate sample accumulation use a floating
* point buffer.
*
*/
THREE
.
MSAAPass
=
function
(
scene
,
camera
,
params
)
{
...
...
@@ -83,7 +88,10 @@ THREE.MSAAPass.prototype = {
renderer
.
render
(
this
.
scene
,
camera
,
this
.
sampleRenderTarget
,
true
);
// clear on the first render, accumulate the others
var
autoClear
=
renderer
.
autoClear
;
renderer
.
autoClear
=
false
;
renderer
.
render
(
this
.
scene2
,
this
.
camera2
,
writeBuffer
,
i
===
0
);
renderer
.
autoClear
=
true
;
}
...
...
examples/webgl_postprocessing_msaa.html
浏览文件 @
badfaad7
...
...
@@ -7,17 +7,36 @@
<style>
body
{
margin
:
0px
;
background-color
:
#000
000
;
background-color
:
#000
;
overflow
:
hidden
;
font-family
:
Monospace
;
font-size
:
13px
;
margin
:
0px
;
text-align
:
center
;
overflow
:
hidden
;
}
#info
{
color
:
#fff
;
position
:
absolute
;
top
:
10px
;
width
:
100%
;
text-align
:
center
;
display
:
block
;
}
</style>
</head>
<body>
<div
id=
"container"
></div>
<div
id=
"info"
>
<a
href=
"http://threejs.org"
target=
"_blank"
>
three.js
</a>
- Manual Multi-Sample Anti-Aliasing (MSAA) pass by
<a
href=
"https://clara.io"
target=
"_blank"
>
Ben Houston
</a>
<a
href=
"http://threejs.org"
target=
"_blank"
>
three.js
</a>
- Manual Multi-Sample Anti-Aliasing (MSAA) pass by
<a
href=
"https://clara.io"
target=
"_blank"
>
Ben Houston
</a></br></br>
WARNING: High MSAA samples count will lead
</br>
to discretization effects when used with 8-bit per channel Render Buffers.
</div>
<div
id=
"container"
></div>
<script
src=
"../build/three.min.js"
></script>
<script
src=
"js/libs/stats.min.js"
></script>
<script
src=
"js/libs/dat.gui.min.js"
></script>
<script
src=
"js/postprocessing/MSAAPass.js"
></script>
<script
src=
"js/shaders/CopyShader.js"
></script>
...
...
@@ -32,15 +51,56 @@
<script>
var
camera
,
scene
,
renderer
,
composer
,
pass
;
var
geometry
,
material
,
object
;
var
geometry
,
material
,
gui
,
object
,
msaaPass
,
stats
;
var
param
=
{
MSAASampleLevel
:
2
};
var
clock
=
new
THREE
.
Clock
();
var
textureLoader
=
new
THREE
.
TextureLoader
();
container
=
document
.
getElementById
(
"
container
"
);
stats
=
new
Stats
();
stats
.
domElement
.
style
.
position
=
'
absolute
'
;
stats
.
domElement
.
style
.
top
=
'
0px
'
;
container
.
appendChild
(
stats
.
domElement
);
textureLoader
.
load
(
"
textures/brick_diffuse.jpg
"
,
function
(
meshTexture
)
{
init
(
meshTexture
);
animate
();
clearGui
();
});
function
clearGui
()
{
if
(
gui
)
gui
.
destroy
();
gui
=
new
dat
.
GUI
();
var
example
=
gui
.
add
(
param
,
'
MSAASampleLevel
'
,
{
'
Level 0: 1 Sample
'
:
0
,
'
Level 1: 2 Samples
'
:
1
,
'
Level 2: 4 Samples
'
:
2
,
'
Level 3: 8 Samples
'
:
3
,
'
Level 4: 16 Samples
'
:
4
,
'
Level 5: 32 Samples
'
:
5
}
).
onFinishChange
(
function
()
{
if
(
massPass
)
{
massPass
.
sampleLevel
=
param
.
MSAASampleLevel
;
}
}
);
gui
.
open
();
}
function
init
(
meshTexture
)
{
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
false
}
);
...
...
@@ -65,8 +125,8 @@
composer
=
new
THREE
.
EffectComposer
(
renderer
);
var
massPass
=
new
THREE
.
MSAAPass
(
scene
,
camera
);
massPass
.
sampleLevel
=
1
;
massPass
=
new
THREE
.
MSAAPass
(
scene
,
camera
);
massPass
.
sampleLevel
=
param
.
MSAASampleLevel
;
composer
.
addPass
(
massPass
);
var
copyPass
=
new
THREE
.
ShaderPass
(
THREE
.
CopyShader
);
...
...
@@ -104,9 +164,11 @@
composer
.
render
();
stats
.
update
();
}
</script>
<div>
</body>
</html>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录