나만의 공부 노트
Tutorial - Chapter 2 정리 본문
.obj
http://paulbourke.net/dataformats/obj/
Object Files (.obj)
Object Files (.obj) Minimal example: box.obj Minimal textured example Vertex colour in OBJ files Object files define the geometry and other properties for objects in Wavefront's Advanced Visualizer. Object files can also be used to transfer geometric data
paulbourke.net
s : smoothing group = 엔진? 마다 지원 여부가 다름
- Smoothing Groups are a term for Max. Maya doesn't refer to them this way 라고 함..
.mtl
http://paulbourke.net/dataformats/mtl/
MTL OBJ materials file
MTL material format (Lightwave, OBJ) Excerpt from FILE FORMATS, Version 4.2 October 1995 Documentation created by: Diane Ramey, Linda Rose, and Lisa Tyerman Copyright 1995 Alias|Wavefront, Inc. All rights reserved 5. Material Library File (.mtl) Material l
paulbourke.net
MDLAsset
- The top level of a scene in Model I/O
- You can add child objects such as meshes, cameras and lights
- Scene & Actor 구조를 갖는듯?(light나 camera 같은게 들어가면 obj 파일로 변환 안될 거 같다)
실험) MDLAsset에 add를 여러 번 해도 obj로 잘 만들어질까? -> Osubmesh가 2개 이상인 MDLMesh들을 여러번 add 했더니 다음과 같이 네이밍 되어 저장되고 있다.MDLMesh 1개 & subMesh 6개-> Material 이름 앞에 0번이면 "_", 1번 ~ 이면 "_X_" 붙음MDLMesh 2개 & subMesh 6개-> 뒤에 "_1"이 붙음.. 규칙이 뭐지
MTLVertexDescriptor
let vertexDescriptor = MTLVertexDescriptor()
vertexDescriptor.attributes[0].format = .float3
vertexDescriptor.attributes[0].offset = 0
vertexDescriptor.attributes[0].bufferIndex = 0
- An MTLVertexDescriptor has an array of 31 attributes
- When you send your vertex data to the GPU via the render encoder, you send it in an MTLBuffer and identify the buffer by an index. There are 31 buffers available and Metal keeps track of them in a buffer argument table.
vertexDescriptor.layouts[0].stride = MemoryLayout<SIMD3<Float>>.stride
let meshDescriptor = MTKModelIOVertexDescriptorFromMetal(vertexDescriptor)
(meshDescriptor.attributes[0] as! MDLVertexAttribute).name = MDLVertexAttributePosition
- layouts의 인덱스는 bufferindex를 가르킴
- MDLVertexAttributePosition 외에도 normal, uv 등 도 있음
Winding order
메탈은 반시계 방향!
'Graphics > Metal' 카테고리의 다른 글
| Tutorial - Chapter 3 정리 (0) | 2023.03.31 |
|---|---|
| Tutorial - Chapter 1 정리 (0) | 2023.03.29 |