Page 1 of 1

Q3 using shader for skin

Posted: Fri Oct 18, 2013 1:19 pm
by Spiney
Hey guys, long time lurker, I've registered though since I thought you guys will know this for sure.

I've just started dipping into using .md3.
I'm a bit confused though how I'm supposed to add a shader effect to a skin.
For example in Q3 a lot of player skins have shader effects on them, but I do not see any references to .shader files in the .skin so I'm a bit lost on how I'm supposed to do it.

Re: Q3 using shader for skin

Posted: Fri Oct 18, 2013 2:19 pm
by CZghost
@Spiney: As far I know how it works, you need to specify the texture declared in shader instead of shader file. Open up scripts/models.shader from your pak0.pk3 and if your text pad allows it you, filter all shaders but the ones beggining with models/players/ > This will show you the code for shader effects used in player models. See the part of shader on very beggining (the line before first bracket). This is shader name and it's the ones you will need to specify. If you have your own (usualy with the models/players/modelname/texture format), copy shader name and place it in the definition. Add .tga just after the name. You need to specify name of shader in right place, or you will get odd results and when using more than 10 textures (on models with high number of meshes), it gets hard to find errors... This is all I can tell you.

Re: Q3 using shader for skin

Posted: Fri Oct 18, 2013 3:18 pm
by obsidian
Inside the .skin file you should see something like,

Code: Select all

h_head,models/players/modelname/mymodel.TGA
It points to a texture in "models/players/modelname/mymodel.tga"

Shaders use the same naming scheme, if you create your shader with the same name as the file path (without the extension), it will automatically be attributed to your skin. Your shader will looks something like this:

Code: Select all

models/players/modelname/mymodel
{
	//global parameters here
	{
		map models/players/modelname/mymodel.tga
		//stage parameters here
	}
}

Link to the shader manual is in my signature.

Re: Q3 using shader for skin

Posted: Fri Oct 18, 2013 4:13 pm
by Spiney
Thanks, this is exactly what I needed to know! :D

Re: Q3 using shader for skin

Posted: Fri Oct 18, 2013 7:50 pm
by Spiney
Some more issues... This is actually for an explosion shell effect.
Problem is I can't even get a static skin to load for some reason. The model geometry shows up fine in game.

The files are:

Code: Select all

root/models/fx/explosion/sphere.md3                - inside is a tag_origin which is at 0,0,0, I'm not actually sure this is necessary?
root/models/fx/explosion/sphere.skin               - tag_origin,models/fx/explosion/fire01.tga
root/models/fx/explosion/fire01.tga ~ fire08.tga   - idea is to have animmap shader.
Some more questions:
Do tags require "tag_" prefix?
MD3PATH metadata inside model is required or not?

Re: Q3 using shader for skin

Posted: Sat Oct 19, 2013 9:55 am
by CZghost
I do not know much about fire explosion models, but if you include a tag mesh, you need to name it with "tag_" prefix (without quotes). I think explosion models do not require tags as game uses model's origin as point instead of tag mesh.

You are working on a mod with custom assets you need to know how to make fire explosion models?

Re: Q3 using shader for skin

Posted: Sat Oct 19, 2013 11:53 am
by Spiney
You are working on a mod with custom assets you need to know how to make fire explosion models?
Yes.

Actually it's for use in Tremulous. I'm trying to improve all the default particle effects, among other things. I'm calling the model from it's particle system, the model loads and the particle system scales it over time. The model shows up correctly, but it has the missing-texture-texture on it.

Re: Q3 using shader for skin

Posted: Sat Oct 19, 2013 4:21 pm
by CZghost
Read the doumentation for source code if exists and see if particle models have tag mesh attached to define origin. If not, then game defines origin as it's the model's one and you don't need to define a tag mesh. Adding a tag mesh in model possibly won't affect the model's origin in game, I think. When you need to repair missing texture problem, see what texture it is using by opening md3 file in a textpad. You will see random chars and some strings inside. You will see something like that:

Code: Select all

IDP3*   models/mapobjects/spawn_n.md3                                                     l   ¤   ¤   <   @íÁ `ďÁ     €ĺA `ďA  A            'óAMilkShape 3D    IDP3Cone01                                                                       *   °   l   ¨     ˜  models/mapobjects/spawn/spawn3_n.tga                                                                                                                                                              	   	         	      
   
         
                                          
   
         
                                                                                                                                                                           Á9s? ŇŹ>   ?   ?;ß?   ?wľO?¬>×=Á9s?đ8?wľO?+e?šw?í
~?šw?€	ů;ËÇ>€	ů;$A>¬>×=đcL= ŇŹ> :   ?đcL=đ8?$A>+e?ËÇ>í
~?˘üľ  Qâ˙  X  â˙{  ?úŞ  d ľ  -»Ş  ,Ş  	–řŞ  v–řVţ  ŠúVű  ś˘üBů  Żâ˙…ř  Á Bů  Ó»Vű  ĺ,Vţ  ÷
IDP3 is magic number, asterisk is version, models/mapobjects/spawn_n.md3 is model path&name (it's modified TA rune pad), MilkShape 3D is generator, IDP3Cone01 is name of mesh, models/mapobjects/spawn/spawn3_n.tga is reference to shader name. As you can see, MD3 file is quite empty from a bits look... Every string with .tga at end are textures and this is what you are looking for...