THREE.jsにはさまざまな3Dグラフィック形式からのインポーターがあることを私は知っています。
3dStudioMaxで作成されたモデルを表示するのに適したインポーターはありますか?また、存在しない場合は、3dStudioMaxモデルをTHREE.jsにインポートできるものに変換する方法はありますか?
2つのオプションがあります。
1)ThreeJSExporter.msを使用しますが、管理されなくなったものを考慮に入れてください。
https://github.com/mrdoob/three.js/tree/master/utils/exporters/max
2)(推奨) 3DSMaxでOBJエクスポーターオプションを使用します。次に、ここで利用可能なconvert_obj_three.pyスクリプトを使用します。
https://github.com/mrdoob/three.js/blob/master/utils/converters/obj/convert_obj_three.py
Three.jsのGithubに関する私の号の詳細情報:
以下は、選択したオブジェクトのメッシュをJSONに変換するMAXScriptスクリプトです。この投稿の時点で、Googleコードホスティングの3dsMax開発者コミュニティの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
私はしばらくthree.jsを使用していませんが、3dsmaxが簡単にエクスポートできるOBJをインポートし、.objをthree.js.jsonメッシュに変換するpythonスクリプトがあることを知っています。
最新のリビジョンには、json形式に直接対応するMaxScriptエクスポーターがあることに気づいたので、それから始めます。選択したメッシュに基づいて.jsファイルを生成する必要がありますが、現時点ではPCにアクセスしてテストすることはできません。
3dsファイル形式を使用して最大ファイルを保存できます。A3dsViewerで3dsモデルを開きます。ツールバーの[HTML5にエクスポート]をクリックすると、ブラウザーでモデルをプレビューできるようになります。
2018年には、glTFと3ds maxの非常に優れたエクスポーターがあり、バビロンコミュニティによって開発され、積極的に保守されています。
説明とインストール方法は、ここで詳しく説明されています。
https://doc.babylonjs.com/resources/3dsmax_to_gltf
その後、gltfモデルをthree.jsで簡単に使用できます。いくつかの例を参照してください。
https://threejs.org/examples/webgl_loader_gltf.html
https://threejs.org/examples/#misc_exporter_gltf
楽しみ!