The Beautiful Future
OBJ 포멧 MTL 포멧 간단정리 본문
WaveFont 사에서 개발했으나 널리 퍼저서 확실히 정해진 포멧이 없다.
@@ OBJ 파일
@ comment 는 #을 이용한다
# this is a comment
@ vertices
v x y z [w]
v 0.1 0.2 0.3
w는 옵션, 프로그램에 따라 뒤에 0~1사이 값으로 RGB 을 넣어주기도한다.
@ texture coodinates
vt u v [w]
@ parameter space vertices
vp u [v] [w]
곡선, 곡면과 같이 파라미터화 되는 공간에서 위치를 결정한다.
u: 곡선의 한 점
u, v: 곡선의 한점, v는 곡선의 컨트롤 값
u, v: 곡면의 한 점
u, v, w: 곡면의 한점, w는 곡면의 컨트롤 값
@ polygonal face element
f 1 2 3
f 3/1 4/2 5/3
f 6/4/1 3/5/3 7/6/5
f 7//1 8//2 9//3
버텍스 인덱스로 면을 정의, vertex/texture/normal 의 인덱스, 1부터 시작
꼭 3개가 아니라 n개의 버텍스 지정가능
@ line element
l 5 8 1 2 4 9
poly line을 만든다.
@ other geometry format
애니메이션이나 변화는 지원하지 않는다.
테일러 나 B-spline은 지원한다.
@ Referencing materials
mtllib [external .mtl file name]
폴리곤의 비주얼적인 것은 외부 mtl파일에 저장되어있다.
하나 이상의 mtl파일이 obj파일로 부터 참조 될 수 있다.
하나의 mtl파일은 하나 이상의 물질정의를 포함하고 있다.
usemtl [material name]
이 태그(usemtl) 이후에 나오는 요소에 대해서 물질이름을 정의한다.
o [object name]
....
g [group name]
....
물체와 폴리곤 그룹을 지정 할 수 있다.
s 1
셰이딩 스무딩을 지정할 수 있다.
s off
셰이딩를 오프 할 수 있다.
@@Material template library(MTL)
http://paulbourke.net/dataformats/mtl/
물체의 surface shading(material) 성질을 표현한다.
표면에 나타나는 조명의 반사 성질을 기술한다.
newmtl Colored
물질이름 'Colored'를 정의한다.
Ka 1.0 1.0 1.0
물질의 ambient 컬러를 정의한다.
Kd 1.0 1.0 1.0
물질의 diffuse 컬러를 정의한다.
Ks 0.0 0.0 0.0
specular 컬러를 정의한다.
Ns 10.0
specular exponent를 정의한다.
d 0.9
Tr 0.1
물체의 투명도를 설정한다. 프로그램에 따라 d(dissolved) 또는 Tr를 사용한다.
d: 녹지않는 정도, Tr: 투명도
illum mode(0~10)
여러 조명 모드를 사용할 수 있다. 예) ambient만 사용 ambient + sepcular 사용 등 설정 가능. 이게 되나?
0: ambient 끔
1: ambient 켬
2: 하이라이트 켬
3: 반사 레이 트레이스 켬
4: 투명: 유리 켬, 반사 레이 트레이스 켬
5: 반사: Fresnel 켬, 레이 트레이스 켬
6: 투명: Refraction 켬, 반사: Fresnel 끔, 레이 트레이스 켬
7: 투명: Refraction 켬, 반사: Fresnel 켬, 레이 트레이스 켬
8: 반사 켬, 레이트레이스 끔
9: 투명도: 글래스 켬, 반사: 레이트레이스 끔
10: Casts shadows onto invisible surfaces
@ Texture maps
mtl 파일에서 위와 같이 물질을 정의 할 수 있지만
좀 더 정밀한 물질맵을 정의 할 수 있다.
newmtl Textured
Ka 1.000 1.000 1.000
Kd 1.000 1.000 1.000
Ks 0.000 0.000 0.000
d 1.0
illum 2
map_Ka lemur.tga # the ambient texture map
map_Kd lemur.tga # the diffuse texture map (most of the time, it will be the same as the ambient texture map)
map_Ks lemur.tga # specular color texture map
map_Ns lemur_spec.tga # specular highlight component
map_d lemur_alpha.tga # the alpha texture map
map_bump lemur_bump.tga # some implementations use 'map_bump' instead of 'bump' below
bump lemur_bump.tga # bump map (which by default uses luminance channel of the image)
disp lemur_disp.tga # displacement map
decal lemur_stencil.tga # stencil decal texture (defaults to 'matte' channel of the image)
텍스쳐 맵은 옵션을 가질 수 있다.
map_Ka -o 1 1 1 ambient.tga # texture origin (1,1,1)
refl -type sphere clouds.tga # spherical reflection map
@ Texture options
-blendu on | off # set horizontal texture blending (default on)
-blendv on | off # set vertical texture blending (default on)
-boost float_value # boost mip-map sharpness
-mm base_value gain_value # modify texture map values (default 0 1)
# base_value = brightness, gain_value = contrast
-o u [v [w]] # Origin offset (default 0 0 0)
-s u [v [w]] # Scale (default 1 1 1)
-t u [v [w]] # Turbulence (default 0 0 0)
-texres resolution # texture resolution to create
-clamp on | off # only render texels in the clamped 0-1 range (default off)
# When unclamped, textures are repeated across a surface,
# when clamped, only texels which fall within the 0-1
# range are rendered.
-bm mult_value # bump multiplier (for bump maps only)
-imfchan r | g | b | m | l | z # specifies which channel of the file is used to
# create a scalar or bump texture. r:red, g:green,
# b:blue, m:matte, l:luminance, z:z-depth..
# (the default for bump is 'l' and for decal is 'm')
bump -imfchan r bumpmap.tga # says to use the red channel of bumpmap.tga as the bumpmap
반사 맵을 위한 옵션
-type sphere # specifies a sphere for a "refl" reflection map
-type cube_top | cube_bottom | # when using a cube map, the texture file for each
cube_front | cube_back | # side of the cube is specified separately
cube_left | cube_right
@ Vender에 따라 다른 점
Vender 에 따라 특별히 정의된 정의가 있을 수 있다.
스펙에 따르면 텍스쳐 옵션은 파일 이름 앞에 있어야 하지만 뒤에 오는 경우도 있다.
bump texbump.tga -bm 0.2 # bump multiplier of 0.2
@ 물리기반 렌더링
온라인 3D 편집 툴 등에서 확장된 mtl 포멧을 제안
Pr/map_Pr # roughness
Pm/map_Pm # metallic
Ps/map_Ps # sheen
Pc # clearcoat thickness
Pcr # clearcoat roughness
Ke/map_Ke # emissive
aniso # anisotropy
anisor # anisotropy rotation
norm # normal map, same format as "bump" parameter
'Graphics' 카테고리의 다른 글
mtl format (0) | 2018.12.27 |
---|---|
obj format (0) | 2018.12.27 |
조명 (0) | 2018.11.19 |