Compiling a model:ko

From Valve Developer Community
Jump to: navigation, search
English (en)Français (fr)Русский (ru)中文 (zh)한국어 (ko)
... Icon-Important.png
Info content.png
This page needs to be translated.

This page either contains information that is only partially or incorrectly translated, or there isn't a translation yet.
If this page cannot be translated for some reason, or is left untranslated for an extended period of time after this notice is posted, the page should be requested to be deleted.

Also, please make sure the article tries to comply with the alternate languages guide.

모델은 StudioMDL 등을 통해 컴파일 작업을 거쳐야 겡미에서 사용이 가능합니다. 이 컴파일 작업에는 3가지 요소들이 쓰이게 됩니다.

  • 모델 소스 파일들 (SMD, DMX, VTA) 모델의 정점값등을 담고 있으며 애니메이션에서도 쓰이는 파일들입니다. FBX 또한 쓰이지만 CS:GO 1.34.8.4 이후 소스엔진들만 지워하고 있고 SMD로 작업을 하여도 무리가 없기에 대부분 SMD Reference 형태의 모델과 시퀀스 모델로 작업이 이루어지고 있습니다.
  • QC 파일은 벨브 모델 생성을 위한 컴파일러 프로그램인 StudioMDL로 해독 가능한 명령어들을 텍스트 파일 형태로 담고 있는 파일입니다.
  1. 작성된 모델 파일 SMD 아니면 DMX 아니면 FBX 파일을 만들고 추가 동작이 필요하면 시퀀스 SMD 파일등을 만들어 주고 얼굴 표정 변화가 필요하다면 VTA 버텍스 애니메이션 정보를 담고 있는 파일을 작성합니다.
  2. 이 위키를 참고하여 상황에 맞는 QC 명령어들을 텍스트 파일로 정렬합니다. (완전히 프로그래밍 스크립팅입니다.)
  3. VMT 파일 작성을 하고 텍스쳐를 벨브 텍스쳐 파일 VTF로 변화을 해줍니다. - $cdmaterial 명령어로 위치 지정이 가능합니다.
  4. 용도에 맞게 가공된 파일들 (SMD, VTA, DMX 및 블블라라라) 같은 디렉토리에 두고 QC 파일을 컴파일러인 Studiomdl에 던져주면 컴파일 된 모델 MDL을 벹어냅니다.
  • 에러가 나면 컴파일이 중단되면서 에러원인을 출력하게 됩니다.

사전준비 작업

일단 3D 모델링 작업은 성공적으로 마친것으로 간주하기로 하고 캄파일 작업을 위해서 VPROJECT 환경변수를 등록해주는게 편합니다. 이 변수는 studiomdl이 모델 파일을 어떤 게임의 서브폴더에 모델작성을 하는지를 결정하게 되는 환경변수입니다.

  • 스팀 게임런쳐인 스팀을 실행하면 도구란에 있는 소스SDK를 설치후 실행하면 나오는 게임 설정을 바꾸어 주면 VPROJECT 환경 변수가 바뀌게 됩니다.
  • Studiomdl만을 실행해서 모델을 컴파일 원한다면 자신이 만들기 원하는 모드에 맞는 gameinfo.txt를 만든뒤에 해당 파일을 게임이 위치한 디텍토리에 넣어준 뒤에 gameinfo.txt가 존재하는 폴더에 넣어주고 StudioMDL을 실행시에 -game과 게임이 위치한 디렉토리 이름을 써준뒤에 컴파일 하고자 하는 QC 파일을 이름을 넣어주면 QC 파일이 컴파일됩니다.
    Tip.pngTip: 대부분의 소스SDK 도구들은 -game 명령어가 들어 먹습니다.

명령 구문 강조 기능 활용

QC 파일 편집에 명령 구문 강조 기능이 들어가게 되면 그냥 읽는것보다 에러 발견이 더 쉬워집니다.

QC 파일 작성

QC 파일은 StudioMDL이 읽어들여서 컴파일 작업 수행을 지시하기 위해 텍스트 파일으로 만들어낸 일종의 스크립트 안내서입니다. QC 명령어들 페이지를 보면 컴파일 작업시 작성된 모델 파일의 위치, 애니메이션 순서, 컴파일 완료된 모델 파일을 어떤 게임의 서브폴더로 사용 출력을 하게 될것인가와 VMT 재질 파일 적용 외에도 여러가지 모델 컴파일을 위한 다양한 명령어가 있다는것을 QC 명령러를 참조하여 보면 알 수 있습니다.

실제 예제들

작업에 쓰이는 파일들의 폴더 위치 QC 파일안에 SMD, VTF 등의 파일의 위치를 지정하게 된다면 StduilMDL은 대부분 컴파일러 실행하는 위치를 기준으로 파일들을 차게 되는것 같습니다. VPROJECT 혹은 -game 을 넣어주면 FIXIT:later

  • 폴더 절대 위치 좌표 표시 예) c:\modelsrc\my_model\
  • 폴더 연관 좌표 표시 예).\subfolder 혹은 ..\
  • $pushd $popd 둘을 이용한 작업.

여기 가장 기본적 형태의 QC 파일을 예제로서 선정해 보았습니다. $modelname "props\myfistmodel.mdl" $body mybody "myfirstmodel-ref.smd" $surfaceprop combine_metal $cdmaterials "models\props"

$sequence idle "myfisrtmodel-ref.smd"

$collisionmodel "myfirstmodel-phys.smd" { $concave}

Here is a very simple QC file for a solid model without any animation or special properties (click on each command for details):

$modelname	"props\myfirstmodel.mdl"
$body mybody	"myfirstmodel-ref.smd"
$staticprop
$surfaceprop	combine_metal
$cdmaterials	"models\props"

$sequence idle	"myfirstmodel-ref.smd"

$collisionmodel	"myfirstmodel-phys.smd" { $concave }

이 형식을 이용해서 가장 기본적인 모델을 위한 컴파일 작업 수행해 봅시다. 여기서 기존 모델을 자신이 작성을 한 모델 (SMD, DMX, FBX등등)으로 바꾸어 보고 여러 QC 명령어를 시험해 보면서 어떤 일을 일어나는지를 살펴 보면서 컴파일 작업을 능숙하게 익혀 봅시다.

Note.pngNote:모든 모델들은 애니메이션이 전혀 없더라도 적어도 하나의 $sequence 명령어가 들어가야만 합니다.

Tutorials

컴파일 작업

가장 익숙한 형태 - IDE 혹은 텍스트 에디터를 이용한 컴파일 작업

가장 쉽게 QC 컴파일 작업을 수행하는것은 바로 버튼 하나로 QC 컴파일이 가능한 몇몇 개선된 기능의 텍스트 에디터를 사용을 하는것입니다.

도스 배치 화일 활용.

위에 추천한 데이터들이 싫다면 직접 배치 파일을 만들어도 됩니다.

"%sourcesdk%/bin/orangebox/bin/studiomdl" -nop4 %1
pause

대부분은 이런 식으로 구성이 됩니다. 중간에 -game을 작업을 원하는 프로젝트에 맞게 넣어 주어도 됩니다.

cmd, bat 중에 하나의 확장자를 골라서 저장을 하면 되겠습니다.

배치 다 만들었다면:

  1. 해당 파일 아이콘에서 오른쪽 마우스 클릭
  2. 등록정보(Properties) 를 눌러서 등록정보 윈도우를 출력.
  3. 아이콘 변경을 찾아서 아이콘 변경.

이렇게 한뒤에 QC 파일을 배치파일에 끌어다가 떨구면 설정에 따라서 컴파일된 모델(확장자 MDL)을 벹어 냅니다.


GUI 컴파일링툴을 이용한다면

핫한 크로우바를 이용한다면 윈도우 기존 보다 친숙한 환경에서 작업을 할수 있습니다. 자세한것은 구글 검색등을 통해서 찾아보세요.

Common errors

  • Error opening <model>! (Check for write enable)
Studiomdl won't create folders that don't exist; you must manually create a path to your .mdl before compiling.
If you receive EXCEPTION_ACCESS_VIOLATION without an error code, try compiling with HLMV running.
  • WARNING: Bad collision model, check your smoothing groups!!!
If you created the collision model with XSI then you need to turn off Geometry Approximation's Automatic Discontinuity (Explorer -> Your Mesh -> Geometry Approximation -> Polygon Mesh -> Discontinuity -> Untick Automatic) for the smoothing groups to be exported properly.
Note.pngNote:If disabling automatic discontinuity doesn't work, try making your collision model simpler.
  • WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
This will happen if one, or more, face isn't in the same smoothing group as the rest of the collision model. To fix this simply assign all faces of your mesh to the smoothing goup 1 (since you can only use 1 smoothing group). Many thanks to Vaenyc for this thread
This also happens if there literally is too thin geometry in a collision model. This might be related to scaling down a model with $scale, especially if the intent was to recompile a full-sized model for skybox usage. (In that case, replacing the collision model by an empty one might be adequate as skybox content usually won't need collisions.)
  • Bounding box out of range
The compile error "bounding box out of range" followed by a string of coordinates means that the collision model for your mesh is larger than the maximum allowed size which seems to be hard coded at 16384 units in any direction. This often happens when you either scale up a model too much forcing the collision outside the range, or if your animation causes your collisionjoints to move outside this range.
Tip.pngTip:A solution might be to divide the model into several smaller pieces if possible.
In the case where your model isn't going to be colliding with other objects in the world, it seems that you can also ignore this error if need be as it doesn't seem to impact performance.

SDK samples

SDK에는 많은 예제가 포함이 되어 있습니다. sourcesdk_content\<game>\modelsrc\ 폴더를 찾아보세요. The SDK has numerous sample models, including several fully-articulated characters and players. They can be found at sourcesdk_content\<game>\modelsrc\.

Note.pngNote:Left 4 Dead and Left 4 Dead 2 sample models can be found at <game>\sdk_content\modelsrc\
sdk
Complete SMD source for both player models in Day of Defeat: Source.
tf
Complete, but outdated, DMX source for all TF2 classes. Rigged reference meshes are also available as SMD and Maya.
generic
A tweaked ValveBiped rig (no meshes)
cstrike
"Urban CT" player model
Several static props
hl2
Airboat and Buggy
Antlion Guard
Male citizen (old version with only a few animations)
Some CS stuff that is probably a duplicate of \cstrike's content
Viewmodels for all HL2 weapons
hl2mp
All with multiplayer animations only:
Combine soldier
Metrocop
Male rebel
Left 4 Dead Left 4 Dead
Common infected Models, Bodygroups, and commands necessary for Dynamic Skins
Breakable Woodrail prop example
Explosive Weapon examples for red gas cans and propane tanks
Left 4 Dead 2 Left 4 Dead 2
Breakable Woodrail prop example different from the one found in Left 4 Dead 1
Crumbling Ceiling dynamic prop example

그외 다른 참고사항