OBJ files are used by Wavefront's Advanced Visualizer application to define and store the geometric objects. Backward and forward transmission of geometric data is made possible through OBJ files. Both polygonal geometry like points, lines, texture vertices, faces and free-form geometry (curves and surfaces) are supported by OBJ format. It deals with files in OBJ format, which typically describe a 3D model built with various CAD software, such as 3ds Max, SketchUp or DAZ Studio. The program was designed to cover small to medium.
WARNING: THIS REPO IS NO LONGER MAINTANING, MAYBE NOT SUPPORT NEWERST CESIUM.
Node command line tool and module convert obj model file to 3D Tiles, based on obj2gltf.
NOTE: Only support .b3dm
and .i3dm
for now!
Please use Cesium after v1.37, cause this 3d tile use glTF2.0.
Getting Start
Make sure you have Node installed, and then
Basic Usage
- Convert
.obj
to.gltf
- Convert
.obj
to.glb
NOTE: More detial to convert .gltf
and .glb
can find at obj2gltf.
NOTE: If your model have tarnsparency texture please add --checkTransparency
parameter.
NOTE: If your model using blinn-phong material, and use occlusion when convert to PBR material, the model will looks darker.The useOcclusion
default is false, remember adding --useOcclusion
if your model using PBR material. Here are some showcase about it.
- Convert
.obj
to.b3dm
with default BatchTable, which havebatchId
andname
property, andname
is model’s name.
- Convert
.obj
to.b3dm
with default BatchTable and export default BatchTable (a JSON file). Maybe get information for custom BatchTable.
- Convert
.obj
to.b3dm
with custom BatchTable.
- Convert
.obj
to.i3dm
width FeatureTable.
- Convert
.obj
to.i3dm
with FeatureTable and BatchTable.
FeatureTable support following parameters : position
, orientation
, scale
.
Create Tileset
- Create a single tileset with
.b3dm
tile.
- Create a single tileset with
.b3dm
tile and custom tileset options, custom BatchTable.
- Create a single tileset with
.i3dm
tile.
- Create a single tileset with
.i3dm
tile and custom tileset options, custom BatchTable.
The customTilesetOptions.json
can have options bellow, and these are fake values, please only add properties you need, other value will be auto calculate through .obj
file.
NOTE: If you are not specify the transHeight
option, your model will be place at earth ground surface, which means no matter what the height your models are,the lowerest point of your models will be place at height = 0.0
on the earth. But if you want keep origin heigth you just need specify transHeight = 0.0
.
Here are different bounding volumes.
Combine tilesets
You can combine tilesets into one tileset.json
as external tileset.
Using as node module
If you want to use this tool in node or debug, check out how to use as node module.
Adobe Reader For Mac
Test
Navigate to this project folder and run
Troubleshooting
First, make sure your .obj
file is complete, normally include .obj
, .mtl
and textures like .jpg
or .png
.You can preview your .obj
model via “Mixed Reality Viewer” if you are in windows 10.Otherwise you can use this online viewer.
Second, export .glb
and check if it display correctly. You can useCesium or Three.js gltf viewer.
In the end, just export .b3dm
or tileset and load in Cesium.
Sample Data
Sample data under the .binbarrel
folder.
Resources
- Online glTF viewer, make sure your glTF is correct. Cesium, Three.js.
Credits
Great thanks to Sean Lilley(@lilleyse) for helping and advising.
Thanks AnalyticalGraphicsInc provide a lot of open source project (like Cesium and 3D Tiles) and creat a great GIS environment.
License
G.Viewer - Online 3D Model Viewer
G.Viewer is an Online 3D Model Viewer developed by MASC, which supports both OBJ and OFF format. It's also a 2D polygon viewer which support POLY format. See demos here.Try G.Viewer
Drag & Drop your model file on the canvasSupported Format
2d: POLY3d: OBJ, OFF, JSON (triangular mesh only)
Usage
drop file onto canvas to load modeldrag model to rotate
mouse wheel or '[' ']' key to zoom in/out
'w' to toggle wireframe mode
arrows keys to move the model
'c' change to random colors
space to toggle rotation
Wiki Syntax
{{objviewer url='http://masc.cs.gmu.edu/wiki/uploads/ObjViewer/beethoven.obj' width='480' height='320' dropable='true'}}.obj Modeling File Reader For Mac Brown Austin Peay
{{objviewer url='http://masc.cs.gmu.edu/wiki/uploads/ObjViewer/303.off' width='480' height='320' dropable='true'}}{{objviewer url='http://masc.cs.gmu.edu/wiki/uploads/ObjViewer/neuron.poly' width='600' height='480' dropable='true'}}
Notice: an absolute url is preferred here, or using '/wiki/uploads/...'
if dropable is set to true, you can drop any local obj file onto canvas