# Clay Viewer
3D model viewer with high quality rendering based on [ClayGL](https://github.com/pissang/claygl) and [glTF2.0/GLB](https://github.com/KhronosGroup/glTF) export.
## App
[Download App](https://github.com/pissang/clay-viewer/releases/) on Windows and macOS with FBX/DAE/OBj import and glTF2.0/GLB export. Use it as a common model preview tool!
## Editor
<a href="https://pissang.github.io/clay-viewer/editor/">
<img src="./screenshots/editor.jpg" width="600px" />
</a>
<a href="https://pissang.github.io/clay-viewer/editor/">
<img src="./screenshots/editor2.jpg" width="600px" />
</a>
## Loader
```js
var viewer = new ClayViewer(document.getElementById('main'), {
// Full config at
// https://github.com/pissang/clay-viewer/blob/master/src/defaultSceneConfig.js
devicePixelRatio: 1,
// Enable shadow
shadow: true,
shadowQuality: 'high',
// Environment panorama texture url.
environment: 'env.jpg',
mainLight: {
intensity: 2.0
},
ambientCubemapLight: {
exposure: 1,
diffuseIntensity: 0.2,
texture: 'asset/texture/example1.jpg'
},
postEffect: {
// Enable post effect
enable: true,
bloom: {
// Enable bloom
enable: true
},
screenSpaceAmbientOcculusion: {
// Enable screen space ambient occulusion
enable: true
}
}
});
// Load a glTF model
// Model will be fit in 10x10x10 automatically after load.
// Return an eventful object.
viewer.loadModel('asset/xiniu/xiniu_walk_as.gltf', {
// Shading mode. 'standard'|'lambert'
shader: 'standard'
})
// Model loaded. not include textures.
.on('loadmodel', function (modelStat) {
// Set camera options.
viewer.setCameraControl({
// Alpha is rotation from bottom to up.
alpha: 10,
// Beta is rotation from left to right.
beta: 30,
distance: 20,
// Min distance of zoom.
minDistance: 1,
// Max distance of zoom.
maxDistance: 100,
// Center of target.
center: [0, 0, 0],
// If auto rotate.
autoRotate: false,
// Degree per second.
autoRotateSpeed: 60,
// Direction of autoRotate. cw or ccw when looking top down.
autoRotateDirection: 'cw',
// Start auto rotating after still for the given time
autoRotateAfterStill: 30
});
// Set main light options.
viewer.setMainLight({
// Main light intensity
intensity: 1,
// Main light color string
color: '#fff',
// Alpha is rotation from bottom to up.
alpha: 45,
// Beta is rotation from left to right.
beta: 45
});
// Set ambient light options
viewer.setAmbientLight({
// Ambient light intensity
intensity: 0.8
});
viewer.start();
// Load extra animation glTF
viewer.loadAnimation('asset/xiniu/xiniu_stand_as.gltf')
.on('success', function () {
console.log('Changed animation')
});
// Animation pause and start
viewer.pauseAnimation();
viewer.resumeAnimation();
// Print model stat.
console.log('Model loaded:');
console.log('三角面:', modelStat.triangleCount);
console.log('顶点:', modelStat.vertexCount);
console.log('场景节点:', modelStat.nodeCount);
console.log('Mesh:', modelStat.meshCount);
console.log('材质:', modelStat.materialCount);
console.log('纹理:', modelStat.textureCount);
})
.on('ready', function () {
console.log('All loaded inlcuding textures.');
})
.on('error', function () {
console.log('Model load error');
});
```
[Here](https://github.com/pissang/clay-viewer/blob/master/src/defaultSceneConfig.js) is the full graphic configuration
## Converter
ClayGL provide a python tool for converting FBX to glTF 2.0.
https://github.com/pissang/claygl/blob/master/tools/fbx2gltf.py
Needs [python3.3](https://www.python.org/download/releases/3.3.0/) and [FBX SDK 2018.1.1](http://usa.autodesk.com/adsk/servlet/pc/item?siteID=123112&id=26416130)
```
usage: fbx2gltf.py [-h] [-e EXCLUDE] [-t TIMERANGE] [-o OUTPUT]
[-f FRAMERATE] [-p POSE] [-q] [-b]
file
FBX to glTF converter
positional arguments:
file
optional arguments:
-h, --help show this help message and exit
-e EXCLUDE, --exclude EXCLUDE
Data excluded. Can be: scene,animation
-t TIMERANGE, --timerange TIMERANGE
Export animation time, in format
'startSecond,endSecond'
-o OUTPUT, --output OUTPUT
Ouput glTF file path
-f FRAMERATE, --framerate FRAMERATE
Animation frame per second
-p POSE, --pose POSE Start pose time
-q, --quantize Quantize accessors with WEB3D_quantized_attributes
extension
-b, --binary Export glTF-binary
--beautify Beautify json output.
--noflipv If not flip v in texcoord.
```
## Seperate scene and animation
Export scene
```bash
# exclude animation
fbx2gltf2.py -e animation -p 0 xxx.fbx
```
Export animation
```bash
# exclude scene, 0 to 20 second, 20 framerate.
fbx2gltf2.py -e scene -t 0,20 -f 20 -o xxx_ani.gltf xxx.fbx
```
Load scene and animation asynchronously
```js
viewer.loadModel('asset/xiniu/xiniu.gltf')
// Model loaded. not include textures.
.on('loadmodel', function (modelStat) {
viewer.start();
// Load extra animation glTF
viewer.loadAnimation('asset/xiniu/xiniu_ani.gltf');
});
```
## Build
```bash
npm install
# Build loader
npm run build
# Build editor
webpack --config editor/webpack.config.js
```
没有合适的资源?快使用搜索试试~ 我知道了~
3D-clay-viewer.zip
共120个文件
js:61个
css:10个
jpg:9个
需积分: 15 15 下载量 193 浏览量
2019-09-17
10:23:30
上传
评论
收藏 7.78MB ZIP 举报
温馨提示
3D-clay-viewer.zip,三维模型查看器,具有高质量渲染和glt2.0/glb导出,3D建模使用专门的软件来创建物理对象的数字模型。它是3D计算机图形的一个方面,用于视频游戏,3D打印和VR,以及其他应用程序。
资源推荐
资源详情
资源评论
收起资源包目录
3D-clay-viewer.zip (120个子文件)
DamagedHelmet.bin 539KB
controlKit.css 112KB
main.css 9KB
normalize.css 8KB
ion.rangeSlider.css 3KB
iconfont.css 3KB
ion.rangeSlider.skinHTML5.css 3KB
ion.rangeSlider.skinModern.css 2KB
ion.rangeSlider.skinFlat.css 2KB
ion.rangeSlider.skinSimple.css 2KB
ion.rangeSlider.skinNice.css 2KB
iconfont.eot 3KB
loading.gif 37KB
.gitignore 330B
SSR.glsl 14KB
SSAO.glsl 5KB
DOF.glsl 5KB
ground.glsl 3KB
lines3d.glsl 2KB
edge.glsl 2KB
edge.glsl 1KB
DamagedHelmet.gltf 4KB
Factory_Catwalk.hdr 443KB
Ice_Lake.hdr 442KB
Old_Industrial_Hall.hdr 411KB
Grand_Canyon_C.hdr 378KB
Barce_Rooftop_C.hdr 364KB
pisa.hdr 356KB
pisa.hdr 356KB
Hall.hdr 254KB
index.html 4KB
view.html 3KB
index-electron.html 3KB
icon.icns 80KB
icon.ico 361KB
Default_metalRoughness.jpg 1.24MB
Default_albedo.jpg 914KB
Default_normal.jpg 506KB
bg.jpg 438KB
Default_AO.jpg 353KB
editor2.jpg 185KB
Default_emissive.jpg 95KB
editor.jpg 71KB
chessboard.jpg 2KB
clay-viewer.js 1.01MB
controlKit.js 963KB
bundle.js 583KB
clay-viewer.min.js 423KB
browserfs.min.js 244KB
dat.gui.js 181KB
FileAPI.js 104KB
jszip.min.js 100KB
jquery.min.js 85KB
ion.rangeSlider.js 83KB
sweetalert.min.js 38KB
Viewer.js 31KB
idb.filesystem.js 29KB
main.js 23KB
project.js 18KB
composite.js 18KB
EffectCompositor.js 15KB
compositeMobile.js 14KB
glTFHelper.js 14KB
RenderMain.js 14KB
Lines3DGeometry.js 13KB
pace.min.js 12KB
SSR.glsl.js 10KB
helper.js 10KB
filer.min.js 9KB
SceneHelper.js 8KB
SSRPass.js 8KB
SSAOPass.js 6KB
FileSaver.js 6KB
getDefaultSceneConfig.js 5KB
TemporalSuperSampling.js 5KB
SSAO.glsl.js 5KB
defaultSceneConfig.js 4KB
timeline.js 4KB
DOF.glsl.js 4KB
HotspotManager.js 3KB
ground.glsl.js 3KB
GestureMgr.js 2KB
Texture.js 2KB
lines3d.glsl.js 2KB
convert.js 2KB
getBoundingBoxWithSkinning.js 2KB
BoundingBoxGizmo.js 2KB
EdgePass.js 2KB
edge.glsl.js 1KB
renderOutline.js 1KB
poissonKernel.js 1KB
edge.glsl.js 1KB
electron.js 1KB
getDefaultMaterialConfig.js 950B
glsl2js.js 630B
webpack.config.js 613B
download.js 432B
rollup.config.js 384B
halton.js 340B
env.js 147B
共 120 条
- 1
- 2
资源评论
weixin_38744270
- 粉丝: 327
- 资源: 2万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- C语言基础-C语言编程基础之Leetcode编程题解之第39题组合总和.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第38题外观数列.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第37题解数独.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第36题有效的数独.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第35题搜索插入位置.zip
- index.wxml
- C语言基础-C语言编程基础之Leetcode编程题解之第33题搜索旋转排序数组.zip
- 基于Python实现的手写数字识别系统源码.zip
- 从网页提取禁止转载的文字
- C语言基础-C语言编程基础之Leetcode编程题解之第32题最长有效括号.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功