Implementing LOD using 3DWS or any other .dif making program
by John Spivey · in Game Design and Creative Issues · 03/30/2007 (11:29 pm) · 0 replies
Level of detail using 3D World Studio
In order to export .dif models with level of detail assigned to them you will need to get into the .map files and alter some of the code put in there.
First off (refresher from the Quark reference)
When making your level of detail models they must be named in a particular sequence. For example;
uberModel_0.map
uberModel_1.map
uberModel_2.map
uberModel_3.map
This will be the configuration you MUST follow in order to get map2dif to compile your uberModel.dif (that contains the LOD data you need). (uberModel is generic for what ever you name your model)
LOD set up is based on how many pixels HIGH the model is on screen. Meaning that if you are far away from your model the most basic build of that model will be presented in the game engine. Optimizing performance.
The model with the 0.map suffix will be your closest and most detailed model and the last one in the list is the least detailed. (uberModel_3.map) in this case.
OK. So now we know how to set it up. Now comes the work part. Build your model. Then build your corresponding models with lesser detail. Up to you how you want to go about doing this. **When testing this I like to make shapes that are totally different just to ensure that its working. After you save your work on each model export them to .map format. REMEMBER---HIGHEST DETAIL IS _0.map AND THE HIGHEST NUMBER IS YOUR LOWEST DETAIL. They all must be named the same thing. **Suggestion-have your map2dif.exe in a folder all by itself. I personally keep one folder for this on my desktop. Then all you have to do is set up your exporter to export to that directory.
Now for the fun part. Open your .map file with your favorite text editor. Notepad works just fine. You will see something like this at the top of your .map file before all the numbers and geometry stuff;
{
"classname" "worldspawn"
"mapversion" "220"
"wad" "halflife.wad"
{
There are two lines you will need to add to each .map file. They are;
"detail_number" "#"
"min_pixels" "#"
The # represents a numeric value based on which model you are working on. If this is uberModel_0.map then your initial section should look something like this;
{
"classname" "worldspawn"
"mapversion" "220"
"detail_number" "0"
"min_pixels" "300"
"wad" "halflife.wad"
{
detail_number tells the map2dif.exe which model in the sequence this model is.
min_pixels tells the map2dif.exe what pixel HEIGHT the model should be before it switches to the higher or lower model unless of course it is at the highest or lowest model.
So uberModel_1.map (the next one in the sequence) will look like this;
{
"classname" "worldspawn"
"mapversion" "220"
"detail_number" "1"
"min_pixels" "200"
"wad" "halflife.wad"
{
The pixel size will decrease because you want the model to get lower in detail the further away you get.
Ok the final step. After you have made your alterations to the .map files you will need to ensure that they are all in the same folder with the map2dif.exe. Also be sure to include all textures associated with the .map file.
All you need to do at this point is drag the .map file with the _0.map suffix over the map2dif.exe and THERE YOU GO.
Load up your .dif file into the directory you use for that sort of thing and load it up.
It doesn't do anything????? Well thats just too bad.... heh kidding.
Most likely you will have to get in there a jigger around with the min_pixel settings to get the desired effect. Eventually you will get the hang of it.
Now I believe that if you wanted to you could get rid of the "wad" "halflife.wad" line. It does refer to the .wad files containing textures that half life uses. I just leave it there. No biggie either way.
Hope this helps. BTW, Quark has this built in so it does not apply to Quark.
Tutorial by: John Spivey with help from Ashtara (mydreamrpg.com)
In order to export .dif models with level of detail assigned to them you will need to get into the .map files and alter some of the code put in there.
First off (refresher from the Quark reference)
When making your level of detail models they must be named in a particular sequence. For example;
uberModel_0.map
uberModel_1.map
uberModel_2.map
uberModel_3.map
This will be the configuration you MUST follow in order to get map2dif to compile your uberModel.dif (that contains the LOD data you need). (uberModel is generic for what ever you name your model)
LOD set up is based on how many pixels HIGH the model is on screen. Meaning that if you are far away from your model the most basic build of that model will be presented in the game engine. Optimizing performance.
The model with the 0.map suffix will be your closest and most detailed model and the last one in the list is the least detailed. (uberModel_3.map) in this case.
OK. So now we know how to set it up. Now comes the work part. Build your model. Then build your corresponding models with lesser detail. Up to you how you want to go about doing this. **When testing this I like to make shapes that are totally different just to ensure that its working. After you save your work on each model export them to .map format. REMEMBER---HIGHEST DETAIL IS _0.map AND THE HIGHEST NUMBER IS YOUR LOWEST DETAIL. They all must be named the same thing. **Suggestion-have your map2dif.exe in a folder all by itself. I personally keep one folder for this on my desktop. Then all you have to do is set up your exporter to export to that directory.
Now for the fun part. Open your .map file with your favorite text editor. Notepad works just fine. You will see something like this at the top of your .map file before all the numbers and geometry stuff;
{
"classname" "worldspawn"
"mapversion" "220"
"wad" "halflife.wad"
{
There are two lines you will need to add to each .map file. They are;
"detail_number" "#"
"min_pixels" "#"
The # represents a numeric value based on which model you are working on. If this is uberModel_0.map then your initial section should look something like this;
{
"classname" "worldspawn"
"mapversion" "220"
"detail_number" "0"
"min_pixels" "300"
"wad" "halflife.wad"
{
detail_number tells the map2dif.exe which model in the sequence this model is.
min_pixels tells the map2dif.exe what pixel HEIGHT the model should be before it switches to the higher or lower model unless of course it is at the highest or lowest model.
So uberModel_1.map (the next one in the sequence) will look like this;
{
"classname" "worldspawn"
"mapversion" "220"
"detail_number" "1"
"min_pixels" "200"
"wad" "halflife.wad"
{
The pixel size will decrease because you want the model to get lower in detail the further away you get.
Ok the final step. After you have made your alterations to the .map files you will need to ensure that they are all in the same folder with the map2dif.exe. Also be sure to include all textures associated with the .map file.
All you need to do at this point is drag the .map file with the _0.map suffix over the map2dif.exe and THERE YOU GO.
Load up your .dif file into the directory you use for that sort of thing and load it up.
It doesn't do anything????? Well thats just too bad.... heh kidding.
Most likely you will have to get in there a jigger around with the min_pixel settings to get the desired effect. Eventually you will get the hang of it.
Now I believe that if you wanted to you could get rid of the "wad" "halflife.wad" line. It does refer to the .wad files containing textures that half life uses. I just leave it there. No biggie either way.
Hope this helps. BTW, Quark has this built in so it does not apply to Quark.
Tutorial by: John Spivey with help from Ashtara (mydreamrpg.com)