OBJ 내보낼 때 MTL 파일 지원
Contents
[
Hide
]OBJ 내보낼 때 MTL 파일 지원하는 방법
문제: OBJ 내보낼 때 MTL 파일을 어떻게 지원할 수 있나요?
팁: 이렇게 하려면 OBJ 형식으로 내보낼 때 자료 파일을 사용할 수 있습니다. 아래는 예시입니다. 첨부된 결과 파일(ColorImage.obj 및 ColorImage.mtl)과 소스 파일(ColorImage.dwf)이 있습니다.
예시:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string fileName = "ColorImage"; | |
string file = string.Format("{0}.dwf", fileName); | |
string outFile = string.Format("{0}.obj", fileName); | |
string mtlFileName = string.Format("{0}.mtl", fileName); | |
using (FileStream inStream = new FileStream(file, FileMode.Open)) | |
using (Image image = Image.Load(inStream)) | |
using (FileStream stream = new FileStream(outFile, FileMode.Create)) | |
using (var mtlStream = new FileStream(mtlFileName, FileMode.Create)) | |
{ | |
ObjOptions options = new ObjOptions(); | |
options.MtlFileName = mtlFileName; | |
options.MtlFileStream = mtlStream; | |
options.VectorRasterizationOptions = new CadRasterizationOptions { DrawType = CadDrawTypeMode.UseObjectColor }; | |
image.Save(stream, options); | |
} |