Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
e3e90dd5
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,发现更多精彩内容 >>
提交
e3e90dd5
编写于
6月 08, 2017
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Renamed modified material example and simplified.
上级
02c7d3d9
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
9 addition
and
86 deletion
+9
-86
examples/files.js
examples/files.js
+1
-1
examples/webgl_materials_modified.html
examples/webgl_materials_modified.html
+8
-85
未找到文件。
examples/files.js
浏览文件 @
e3e90dd5
...
...
@@ -144,9 +144,9 @@ var files = {
"
webgl_materials_envmaps_hdr
"
,
"
webgl_materials_grass
"
,
"
webgl_materials_lightmap
"
,
"
webgl_materials_modified
"
,
"
webgl_materials_nodes
"
,
"
webgl_materials_normalmap
"
,
"
webgl_materials_normalmap_modified
"
,
"
webgl_materials_parallaxmap
"
,
"
webgl_materials_reflectivity
"
,
"
webgl_materials_shaders_fresnel
"
,
...
...
examples/webgl_materials_
normalmap_
modified.html
→
examples/webgl_materials_modified.html
浏览文件 @
e3e90dd5
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<title>
three.js webgl - materials -
normal map [Lee Perry-Smith]
</title>
<title>
three.js webgl - materials -
modified
</title>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
>
<style>
...
...
@@ -34,22 +34,13 @@
color
:
#fff
;
}
#vt
{
display
:
none
}
#vt
,
#vt
a
{
color
:
orange
;
}
.code
{
}
</style>
</head>
<body>
<div
id=
"info"
>
<a
href=
"http://threejs.org"
target=
"_blank"
rel=
"noopener"
>
three.js
</a>
- webgl normalmap demo
.
<a
href=
"http://threejs.org"
target=
"_blank"
rel=
"noopener"
>
three.js
</a>
wegbl - modified material
.
<a
href=
"http://graphics.cs.williams.edu/data/meshes.xml#14"
target=
"_blank"
rel=
"noopener"
>
Lee Perry-Smith
</a>
head.
<div
id=
"vt"
>
displacement mapping needs vertex textures (GPU with Shader Model 3.0)
<br/>
on Windows use
<span
class=
"code"
>
Chrome --use-gl=desktop
</span>
or Firefox 4
<br/>
please star this
<a
href=
"http://code.google.com/p/chromium/issues/detail?id=52497"
>
Chrome issue
</a>
to get ANGLE support
</div>
</div>
<script
src=
"../build/three.js"
></script>
...
...
@@ -77,8 +68,6 @@
var
mesh
;
var
directionalLight
,
pointLight
,
ambientLight
;
var
mouseX
=
0
;
var
mouseY
=
0
;
...
...
@@ -88,8 +77,6 @@
var
windowHalfX
=
window
.
innerWidth
/
2
;
var
windowHalfY
=
window
.
innerHeight
/
2
;
var
composer
,
effectFXAA
;
init
();
animate
();
...
...
@@ -103,48 +90,21 @@
scene
=
new
THREE
.
Scene
();
// LIGHTS
ambientLight
=
new
THREE
.
AmbientLight
(
0x444444
);
scene
.
add
(
ambientLight
);
pointLight
=
new
THREE
.
PointLight
(
0xffffff
,
1.25
,
1000
);
pointLight
.
position
.
set
(
0
,
0
,
600
);
scene
.
add
(
pointLight
);
directionalLight
=
new
THREE
.
DirectionalLight
(
0xffffff
);
directionalLight
.
position
.
set
(
1
,
-
0.5
,
-
1
);
scene
.
add
(
directionalLight
);
var
textureLoader
=
new
THREE
.
TextureLoader
();
var
material
=
new
THREE
.
MeshPhongMaterial
(
{
color
:
0xdddddd
,
specular
:
0x222222
,
shininess
:
35
,
map
:
textureLoader
.
load
(
"
obj/leeperrysmith/Map-COL.jpg
"
),
specularMap
:
textureLoader
.
load
(
"
obj/leeperrysmith/Map-SPEC.jpg
"
),
normalMap
:
textureLoader
.
load
(
"
obj/leeperrysmith/Infinite-Level_02_Tangent_SmoothUV.jpg
"
),
normalScale
:
new
THREE
.
Vector2
(
0.8
,
0.8
)
}
);
var
material
=
new
THREE
.
MeshNormalMaterial
();
material
.
onBeforeCompile
=
function
()
{
var
shader
=
this
.
__webglShader
;
// console.log( shader );
shader
.
uniforms
.
time
=
{
value
:
0
};
shader
.
vertexShader
=
'
uniform float time;
\n
'
+
shader
.
vertexShader
;
shader
.
vertexShader
=
shader
.
vertexShader
.
replace
(
'
#include <begin_vertex>
'
,
'
vec3 transformed = vec3( position.x + sin( time + position.y ) / 2.0, position.y, position.z );
'
);
shader
.
vertexShader
=
shader
.
vertexShader
.
replace
(
'
#include <common>
'
,
'
#include <common>
\n
uniform float time;
'
);
};
loader
=
new
THREE
.
JSONLoader
();
...
...
@@ -158,49 +118,15 @@
}
);
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
false
}
);
renderer
.
set
ClearColor
(
0x111111
);
renderer
.
set
PixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
//
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
//
stats
=
new
Stats
();
container
.
appendChild
(
stats
.
dom
);
// COMPOSER
renderer
.
autoClear
=
false
;
var
renderModel
=
new
THREE
.
RenderPass
(
scene
,
camera
);
var
effectBleach
=
new
THREE
.
ShaderPass
(
THREE
.
BleachBypassShader
);
var
effectColor
=
new
THREE
.
ShaderPass
(
THREE
.
ColorCorrectionShader
);
effectFXAA
=
new
THREE
.
ShaderPass
(
THREE
.
FXAAShader
);
var
canvas
=
renderer
.
context
.
canvas
;
effectFXAA
.
uniforms
[
'
resolution
'
].
value
.
set
(
1
/
window
.
innerWidth
,
1
/
window
.
innerHeight
);
effectBleach
.
uniforms
[
'
opacity
'
].
value
=
0.4
;
effectColor
.
uniforms
[
'
powRGB
'
].
value
.
set
(
1.4
,
1.45
,
1.45
);
effectColor
.
uniforms
[
'
mulRGB
'
].
value
.
set
(
1.1
,
1.1
,
1.1
);
effectColor
.
renderToScreen
=
true
;
composer
=
new
THREE
.
EffectComposer
(
renderer
);
composer
.
addPass
(
renderModel
);
composer
.
addPass
(
effectFXAA
);
composer
.
addPass
(
effectBleach
);
composer
.
addPass
(
effectColor
);
// EVENTS
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
...
...
@@ -219,9 +145,6 @@
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
width
,
height
);
composer
.
setSize
(
width
,
height
);
effectFXAA
.
uniforms
[
'
resolution
'
].
value
.
set
(
1
/
width
,
1
/
height
);
}
...
...
@@ -262,7 +185,7 @@
}
composer
.
render
(
);
renderer
.
render
(
scene
,
camera
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录