Jump to content
Sign in to follow this  
Panda-PL-

Tutorial for starters

Recommended Posts

This is a step-by-step tutorial on how to import a 3ds model.

It is intended for people who have no idea and weren't around in the OFP times, so that they can make their first addon (I suggest a rifle, and I supply an RVmat I used for weapon).

This is a TIP (Tutorial In Progress). I will add some pictures, example textures etc. in the future. I also encourage contribiutions.

NOTE this concerns my private view on the subject and how I do things my way. wink_o.gif I do not claim I am perfect.

I assume the reader has some basic knowledge on modelling and rendering, otherwise he has to get these elsewhere.

I intended it to be a simple "what do I push?" walktrough and I do not include detailed explenations of WHY I do things in such a way... You can find the informations on BIS Wiki etc. if you want to get more "advanced".

The information on how to use TV2 is supplied for BIS, information on how to use XNormal are on author's website etc - I do not repeat them.

Pointers for modelling:

- all your hard edges should form closed loops (otherwise they will simply be turned into smooth edges)

- when unwrapping try to avoid cutting along soft edges (will save you some fixing later, see below)

- model has to be tesslated into quads and tris (If you have multiple vertices along one straight edge do it manually - otherwise algorythm can create a zero-surface face out of these vertices positioned in line).

When impoting the model gest cut along hard edges and along the edges where texture mapping is not connecting (places that were cut when unwrapping).

In other words you get this.

Note I was unwrapping outside of O2, this happened upon importing a mesh with UV coordinates and smoothness set in a correct way.

Pointers for texturing:

- no shading or illumination effect

- add lighter color to the edges - effects of wear

- add dirt and scratches etc. Remember you might need scratches for your specular amp later on, so use a separate layer

- you can add Ambient Occlusion with low % of alpha in overlay mode, it will make it look less flat when displayed in low settings. But don't overdo it. Later on about it.

Pointers for Import:

- use 3ds format best

- the alignment ingame is in most cases decided by alignment in O2. Open an BIS M16 sample model and just place the rifle where it is to have it appear in propper position in the game.

- if error is reported the file has to have fake KFData section (whatever it is). Opening it and saving with Deep Exploration or using one of the following: Anim8tor, 3ds Max5 or Unwrap 3d will fix this by creating an empty KFData section.

- use the following settings (picture):

importnx7.jpg

Squarize means merging tris into quads, can screw up edge hardness

Merge merges back the edges divided upon importing, again an easy way to mess up edge hardness

Models do not get imported with textures anyway, you need to do that manually (see below)

- DO NOT bother to merge (or "fix") model manually afterwards. The binarisation will cut it apart once more anyway, save your time. Just pay attention when selecting not to leave any floating geometry... floating.

Adding textures:

- select faces (usually whole model)

- press E

- fill up the "texture" box with your texture path. The texture should be in P:\myaddonname\ or subfolder.

- you can bring up also vertex properties. The "Normals" box is interesting, you have to judge which method of the first two looks better (I really cannot tell)

Fixing edges that shouldn't be hard:

- Examine any smooth edges you have cut durring the unwrapping in 3D application - now they appear hard in viewer! Select with a box each verticle of each of these edges and use "SHIFT+E" to view vertex properties. There are probably two verticles. Press Shift+D to merge them. After dooing the same for other vertices along the edge you can select them all (carefull not to select extra ones) and press I - to turn the edge they create into a soft one. You might have to select the model and hit F5 (recalculate normals) to see results.

Adding selections, LODs etc:

these are specific for your class of object. I won't go into this, you need to open an existing, NONBINARIZED model and see what's the correct layout.

- While examining a model remember to turn on the "named properties window" - CTRL+1 - this contains some information about current LOD that you might also need.

RVMAT file:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">ambient[]={0.750000,0.750000,0.750000,1.000000};

diffuse[]={0.750000,0.750000,0.750000,1.000000};

forcedDiffuse[]={0.250000,0.250000,0.250000,1.000000};

emmisive[]={0.000000,0.000000,0.000000,1.000000};

specular[]={0.268000,0.270000,0.270000,1.000000};

specularPower=35.000000;

PixelShaderID="NormalMapMacroASSpecularDIMap";

VertexShaderID="NormalMapAS";

class Stage1

{

texture="SIX_Weaponpack\t\M203_NOHQ.paa";

uvSource="tex";

class uvTransform

{

aside[]={1.000000,0.000000,0.000000};

up[]={0.000000,1.000000,0.000000};

dir[]={0.000000,0.000000,0.000000};

pos[]={0.000000,0.000000,0.000000};

};

};

class Stage2

{

texture="#(argb,8,8,3)color(0,0,0,0)";

uvSource="tex";

class uvTransform

{

aside[]={1.000000,0.000000,0.000000};

up[]={0.000000,1.000000,0.000000};

dir[]={0.000000,0.000000,0.000000};

pos[]={0.000000,0.000000,0.000000};

};

};

class Stage3

{

texture="SIX_Weaponpack\t\M203_AS.paa";

uvSource="tex";

class uvTransform

{

aside[]={1.000000,0.000000,0.000000};

up[]={0.000000,1.000000,0.000000};

dir[]={0.000000,0.000000,0.000000};

pos[]={0.000000,0.000000,0.000000};

};

};

class Stage4

{

texture="SIX_Weaponpack\t\M203_SM.paa";

uvSource="tex";

class uvTransform

{

aside[]={1.000000,0.000000,0.000000};

up[]={0.000000,1.000000,0.000000};

dir[]={0.000000,0.000000,0.000000};

pos[]={0.000000,0.000000,0.000000};

};

};

This is example of file I use for my weapon. It uses specular, normal and AS maps to add more detail.

- you can edit it with material editor or just notepad

- _SMDI etc sufixes are telling the converter (TEX VIEW 2) how to process the file.

How do I make Normal Map:

- either with Heightmap->normal map tool or from lowpoly and hipoly models. Try Xnormal for example.

- the Y axis (GREEN channel) is allways reversed! In XNormal switch it to Green = -Y, in other programs tick propper "reverse" window when asked.

Here is how settings look in XNormal:

settingsjj1.jpg

- it's a wide subject, there are 3D graphics forums for that...

- Save as *_NOHQ.paa

Trick with normal map (if you get "rainbow triangles"):

- when using the hi/low poly method you can get artifacts due to non matching normals of models, even if area should be flat. Just extract Height Map instead and use HM->normal map tool.

nohqintv2ie8.th.jpg

How do i make specular map:

in case of _SMDI map!

- Green channel is specular - IE the brightness of reflected light

- Blue channel is Specular Power - IE the multiplier of the base "specular power" from RVMAT file (with value of 0-1, 0 being no blue, 1 being full blue).

- add scratches to green channel, add also some grase stains (we know how oiled steel looks like) - with much less agressive values of color.

- Red and alpha will be erased upon conversion, they do nothing afaik.

- it's best to copy over the values of Green into the Blue channel, but get rid of black (it will look like complete matt, like frost or snow). Adding 0.2 or 0.3 to values does the trick (Ie making the channel a bit brihter). This way the places that shine will also be less matt and more "polished", which seems logical.

- example of how my specular map looks like:

smdiintv2sn6.th.jpg

How do I make _AS map?

- render propper Ambient Occlusion map (once again, XNormal if you don't have any other program, but many other can do the same)

You should have nice and smooth grayscale shades...

- save as _AS.paa

- that's it! The channels will get cleared where needed.

- here is how an _AS.paa looks like:

asintv2xk5.th.jpg

Effects of using AS map, normal map and Specular map:

compaino2wq8.th.jpg

Normal map is not used because settings are at very low.

NOTICE however the fact that AS and SMDI are still used (in reduced resolution). They are less resource-consumming, this is why they are so usefull.

Avoiding performance problems

Number of sections (or draw calls?) is the most important factor. Each group of faces  using different material or texture file is an additional section.

Use only one rvmat per model if you can. Use specular map to make different materials look different (plastic, steel, wood...).

Share this post


Link to post
Share on other sites

very nice. hopefully tuts will make its way into the BIKI too. smile_o.gif

Share this post


Link to post
Share on other sites
Quote[/b] ]a program called Animator can fix that.

it's called Anim8or

you can also use 3dsmax5 or Unwrap3d

Share this post


Link to post
Share on other sites

Great stuff Panda, thanks for all this info. I'll have a couple of questions but i'll let you advance with this tutoria, so you don't need to interrupt.

Share this post


Link to post
Share on other sites

Panda, can you please tell me which channels represent which tangent vectors in a bis normal map?

Conventionally it's rgb -> xyz (left to right, bottom to top, far to near). Since most of the normals face into the camera, most normal maps are then blue. Are you saying that the normal maps should be primarily green?

Share this post


Link to post
Share on other sites
Conventionally it's rgb -> xyz (left to right, bottom to top, far to near).  Since most of the normals face into the camera, most normal maps are then blue.

Aye. Of course I've made a mistake. I'm correcting right away and adding a screenshot.

Thanks for pointing out.

Quote[/b] ]it's called Anim8or

you can also use 3dsmax5 or Unwrap3d

Also added. Thanks.
Quote[/b] ]I'll have a couple of questions but i'll let you advance with this tutoria, so you don't need to interrupt.
Well putting it on forums and not in a PDF file or something has the advantage that people can correct me or ask extra questions. If it's something concerning this tutorial then feel free to ask here or - if you're not certain - via PM.

Also added promissed illustrations.

Share this post


Link to post
Share on other sites
I believe this is important documentation connected to this subject (No config, no nothing I guess): http://community.bistudio.com/wiki/Model_Config

(however maybe not complete)

Well, we have config writters to handle this.

Now seriously - that's the ide behind the next planned tutorial - weapon animations. Or rather I will just give example files that will fit 99% of existing weapon systems. Will be more simple than making a real tutorial, since animation system is one big mess... whistle.gif

Share this post


Link to post
Share on other sites

As you suggested i'll ask a couple of questions about a subject that still bugs me. Its the hard edges thing...

Quote[/b] ]Pointers for modelling:

- all your hard edges should form closed loops

- when unwrapping try to avoid cutting along soft edges

- model has to be tesslated into quads and tris.

When impoting the model gest cut along hard edges and along the edges where texture mapping is not connecting (places that were cut when unwrapping).

Could you please just give a little extra info on this? Maybe with a screenshot of a good example...i got confused.

So if i have an hard edge line that separates for example the side profile of a vehicle, from the top profile, this edge line should be hard edges right? if not, the ilumination will make it smooth, and wont look right.

Can you clarify me about the uv's of that same edge line? from what i've (short) experienced, i do the top view of the vehicle in one big seam of uv's , then another big seam to the side profile. So the edges line will be doubled in the uv map right? one line of edges in each top/side polygon islands.

Is this way right? OR should i make both side/top islands of uv's, welded by the hard edge line?

I hope you got what i mean, and i know i can go check this same question in the bis hmmv, but i'm really short of time to mess with o2. icon_rolleyes.gif

Share this post


Link to post
Share on other sites
@ Feb. 07 2008,20:34)]As you suggested i'll ask a couple of questions about a subject that still bugs me. Its the hard edges thing...

It's hard to explain because there is no terminology.

OK.

You cut along a smooth line to unwrap. The model is intact. The cut is only on UV map.

You import.

Now there is a cut on the model - the faces are not connected along this line. Their edges are mating but it is no longer a common edge - the faces are separated.

And since there is no continuity the edge appears hard (this is not a single edge, the faces just arent connected).

You can fix it by merging the overlaping vertices that constitute these "edges" so that you ahve a single edge and then setting this edge to smooth (I). What I'm saying is that it is easier if you cut along smooth edges in the sense that you don't need to fix anything afterwards.

I've added this picture showing what the problem is to the tutorial.

edgesbl4.th.jpg

Share this post


Link to post
Share on other sites

Great stuff! But one question:

Whats the advantage of keeping the AS map separate and bringing it in through the RVMAT over just overlaying the AO on the texture? and having Normal and Spec. map only in the rvmat?

I can't really see a difference...and you have an extra texture being called up, creating another section, right?

Share this post


Link to post
Share on other sites
1) Whats the advantage of keeping the AS map separate and bringing it in through the RVMAT over just overlaying the AO on the texture? and having Normal and Spec. map only in the rvmat?

1) I can't really see a difference...and you have an extra texture being called up, creating another section, right?

1) the AS map is only displayed on faces in shade, and not on directly illuminated ones. This is more realistic looking.

2) no, that's not correct. Open resources window and check.

Section is faces using the same method of rendering, not one texture file.

Share this post


Link to post
Share on other sites
@ Feb. 08 2008,17:27)]1) the AS map is only displayed on faces in shade, and not on directly illuminated ones. This is more realistic looking.

Hmm, interesting. I'll have to try this out. I'll post a before/after pic here smile_o.gif

Share this post


Link to post
Share on other sites

It looks like you're not getting the most out of your maps and that you have some calibration to do.

Share this post


Link to post
Share on other sites
It looks like you're not getting the most out of your maps and that you have some calibration to do.

Yup, if with and without AS map the model looks the same you probably got the Diffuse and forced diffuse wrong...

You need some forced diffuse.

Plus the point is to simmulate the lightning effects on faces that are not directly illuminated. You should better sheck the other side of model (or change enviroment settings).

Share this post


Link to post
Share on other sites

Alright, after playing around more with this technique, I'm officially reversing my position smile_o.gif

Using just the BIS textures and generating an AO map from the new BI sample models that were released, and making a new .rvmat file, I was able to significantly improve the way they look when rendered.

This definitely pops small details better than just a normal map and you're right about the shadow stuff.

Share this post


Link to post
Share on other sites

I would love to see screenshots, even trough it can be a bit offtopic. Just out of curiosity.

You were playing with diffuse and forcedDiffuse values allready?

If you lower diffuse the AS is more visible on illuminated faces, if you higher forceddiffuse it is more visible on shaded faces (but the shade in general is less sharp, kinda hard to explain).

Share this post


Link to post
Share on other sites

Hello.

I wasn't sure where to post it, but i didn't want to open new thread so im asking here:

I finished my very first addon- a pistol. Everythink works fine but have one problem which i cant find solution by now: Pistol has animated slide and magazine. Only this two parts are animated. Unfortunatly when im leaving a gun on the ground this parts disapear and are viewable spread out when i go back few meters. I know it might be connected to Positions settings but i set autocenter= 0 in all LODS (according to some previous guns i looked into) and i put two Geometry boxes (one on slide and another on magazine) and then -> find elements (so got Component01 and component02). I dont know whats wrong in it..i checked lot of guns and mine seems fine. Any sugestions? I read on wiki that it might be something wih mass settings connected but have no clue

confused_o.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×