2011-10-28 11 views
12

THREE.jsにはさまざまな3Dグラフィックス形式のインポータがあります。3dStudioMaxからTHREE.jsにインポートするモデル

3dStudioMaxで作成したモデルを表示するのに適したインポータがありますか?それがない場合、THREE.jsでインポートできるもので3dStudioMaxモデルを変換する方法がありますか?

+0

ところで、これは、http://area51.stackexchange.com/proposals/5022/3d-graphics-modeling-applicationsで提案されている3d stackexchangeの優れた疑問です。 – cdiggins

答えて

6

以下は、選択したオブジェクトのメッシュをJSONに変換するMAXScriptスクリプトです。この投稿の時点では、Googleコードホスティングの3ds Max developer communityのSVNで利用できました。

tmesh = snapshotAsMesh selection[1] 
out_file = createfile "$scripts\\output.json 

num_faces = tmesh.numfaces 
num_verts = tmesh.numverts 

fn PrintPoint pt = (
format "%, %, %, " pt.x pt.y pt.z to:out_file 
) 

fn PrintPointUV pt = (
format "%, %, " pt.x pt.y to:out_file 
) 

fn PrintPointInt pt = (
    x = int(pt.x) - 1 
    y = int(pt.y) - 1 
    z = int(pt.z) - 1 
    format "%, %, %, " x y z to:out_file 
) 

format "{\n" to:out_file 

-- Vertex Positions 
-- format " \"vertexPositions\" : [" to:out_file 
format " positions : [" to:out_file 
for i = 1 to num_verts do 
(
vert = getVert tmesh i 
PrintPoint vert 
) 
format "],\n" to:out_file 

-- Vertex Normals 
-- format " \"vertexNormals\" : [" to:out_file 
format " normals : [" to:out_file 
for i = 1 to num_verts do 
(
    vert = getNormal tmesh i 
    PrintPoint vert 
) 
format "],\n" to:out_file 

-- Vertex Texture Coordinates 
-- format " \"vertexTextureCoords\" : [" to:out_file 
format " uv : [" to:out_file 
for i = 1 to num_faces do 
(
    -- Iterate over faces 
    tvface = getTVFace tmesh i 
    for j = 1 to 3 do (
     -- Get a specific texture vertex 
     tvert = getTVert tmesh tvface[j]   
     PrintPointUV tvert 
    ) 
) 
format "],\n" to:out_file 

-- Face Indexes 
-- format " \"indices\" : [" to:out_file 
format " indices : [" to:out_file 
for f = 1 to num_faces do 
(
    face = getFace tmesh f 
    PrintPointInt face 
) 
format "],\n" to:out_file 

format "}" to:out_file 

close out_file 
delete tmesh 
edit out_name 
2

私はしばらくのうちにthree.jsを使用しませんでしたが、3dsmaxが簡単にエクスポートできるOBJをインポートしていて、.objをthree.js .jsonメッシュに変換するPythonスクリプトがあります。

最新のリビジョンでは、がそのままjson形式になっていることに気付きました。選択したメッシュに基づいて.jsファイルを生成する必要がありますが、テストする時点でPCにアクセスすることはできません。

17

あなたは2つのオプションがあります。

1)を使用ThreeJSExporter.msが、もはやmantainedさを考慮に入れる:

https://github.com/mrdoob/three.js/tree/master/utils/exporters/max

2)(推奨)使用OBJ 3DS Maxの輸出業者オプション。 Three.jsのGithubの上で私の問題で

https://github.com/mrdoob/three.js/blob/master/utils/converters/obj/convert_obj_three.py

より詳細な情報:次に、ここで利用可能convert_obj_three.pyスクリプトを使用

https://github.com/mrdoob/three.js/issues/893

1

あなたは3DSファイル形式を使用して、最大ファイルを保存することができます。 3dsモデル をA3dsViewerで開きます。ツールバーのHTML5にエクスポートをクリックすると、 ブラウザでモデルをプレビューできます。

関連する問題