Page 1 of 1

Shaders on a model

Posted: Sun May 17, 2009 2:15 am
by Jabberwock
Hello. I'm currently making a map for Quake 3 using GTK radiant 1.5, but I've ran into a problem trying to texture my models with custom shaders. What I do is I model in MODO, export as .obj and import into MAX and then export as .ase and finally import into gtk 1.5. That has worked so far, albeit with minor adjustments to the .ase file after export. But now I don't know what to do. I want to texture a subgroup of my model with this shader specifically:
textures/egyptsoc_sfx/jpblue_floor1a
{
qer_editorimage textures/egyptsoc_floor/jumppad1ab.tga
q3map_lightimage textures/egyptsoc_floor/jumppad1b.blend.tga
q3map_surfacelight 400
{
map textures/ctf/blue_telep.tga
tcmod rotate 180
tcMod stretch sin .8 0.1 0 .5
}
{
clampmap textures/ctf/jumppadsmall_b.tga
blendfunc ADD
tcMod stretch sin 0.95 .7 0 1.25
rgbGen wave square .5 .5 .25 1.25
rgbgen identity
}
{
map textures/egyptsoc_floor/jumppad1ab.tga
blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
rgbgen identity
}
{
map $lightmap
blendFunc GL_DST_COLOR GL_ONE_MINUS_DST_ALPHA
rgbGen identity
}
{
map textures/egyptsoc_floor/jumppad1b.blend.tga
blendfunc ADD
rgbgen wave sin .8 .2 0 1
}
}
On this model (or rather an excerpt from the .ase file):
*MATERIAL_LIST {
*MATERIAL_COUNT 1
*MATERIAL 0 {
*MATERIAL_NAME "Default_mso"
*MATERIAL_CLASS "Multi/Sub-Object"
*MATERIAL_AMBIENT 1.0000 1.0000 1.0000
*MATERIAL_DIFFUSE 1.0000 1.0000 1.0000
*MATERIAL_SPECULAR 1.0000 1.0000 1.0000
*MATERIAL_SHINE 1.0000
*MATERIAL_SHINESTRENGTH 1.0000
*MATERIAL_TRANSPARENCY 0.0000
*MATERIAL_WIRESIZE 1.0000
*NUMSUBMTLS 11
*SUBMATERIAL 0 {
*MATERIAL_NAME "\textures\egyptsoc_sfx\jpblue_floor1a"
*MATERIAL_CLASS "Standard"
*MATERIAL_AMBIENT 0.0000 0.0000 0.0000
*MATERIAL_DIFFUSE 1.0000 1.0000 1.0000
*MATERIAL_SPECULAR 1.0000 1.0000 1.0000
*MATERIAL_SHINE 2.5600
*MATERIAL_SHINESTRENGTH 1.0000
*MATERIAL_TRANSPARENCY 0.0000
*MATERIAL_WIRESIZE 1.0000
*MATERIAL_SHADING Blinn
*MATERIAL_XP_FALLOFF 0.0000
*MATERIAL_SELFILLUM 0.0000
*MATERIAL_FALLOFF In
*MATERIAL_XP_TYPE Filter
*MAP_DIFFUSE {
*MAP_NAME "Map #1"
*MAP_CLASS "Bitmap"
*MAP_SUBNO 1
*MAP_AMOUNT 1.0000
*BITMAP "\textures\egyptsoc_sfx\jpblue_floor1a"
*MAP_TYPE Screen
*UVW_U_OFFSET 0.0000
*UVW_V_OFFSET 0.0000
*UVW_U_TILING 1.0000
*UVW_V_TILING 1.0000
*UVW_ANGLE 0.0000
*UVW_BLUR 1.0000
*UVW_BLUR_OFFSET 0.0000
*UVW_NOUSE_AMT 1.0000
*UVW_NOISE_SIZE 1.0000
*UVW_NOISE_LEVEL 1
*UVW_NOISE_PHASE 0.0000
*BITMAP_FILTER Pyramidal
}
}
I'm completely new here by the way. Thanks in advance for any help.

Re: Shaders on a model

Posted: Sun May 17, 2009 8:33 am
by Hipshot
Don't really know how modo works, but when I model for Q3 in max and I need to have two different shaders on a object, I just create two normal materials and apply them to different faces (I don't use any strange material properties like sub/multi material or something else). Sometimes, I need to remove the bitmap data from the ase after it has been exported, if I don't q3 thinks that is the shader, not the material name.

GTK can import OBJ directly too, however, I don't know how to set up materials for it, same with 3DS, seems the "textures/folder/shader" thing only works with ase. Seems other formats strips the "/"

Re: Shaders on a model

Posted: Sun May 17, 2009 7:48 pm
by Jabberwock
Which format did you use for your models? If you used .ASE could you please post a snippet of the code of some model or perhaps the whole file altogether? So that I might compare. Thanks.

Re: Shaders on a model

Posted: Sun May 17, 2009 8:06 pm
by $NulL
*MATERIAL_NAME "\textures\egyptsoc_sfx\jpblue_floor1a"

This looks fishy to me, all my ASE models reference their textures this way: "textures/egyptsoc_sfx/jpblue_floor1a" . With forward slashes and no leading slash.

Re: Shaders on a model

Posted: Sun May 17, 2009 10:22 pm
by Captain a13n
Radiant and q3map2 do not recognize submaterials applied in 3dsmax.

Re: Shaders on a model

Posted: Sun May 17, 2009 10:51 pm
by Jabberwock
$NulL wrote:*MATERIAL_NAME "\textures\egyptsoc_sfx\jpblue_floor1a"

This looks fishy to me, all my ASE models reference their textures this way: "textures/egyptsoc_sfx/jpblue_floor1a" . With forward slashes and no leading slash.
I use forward slashes and a leading slash on all my references, and they work. The problem is getting custom shaders to work. I really want to be able to just apply the shader specified in the .shader file and not have to recreate it in modo.
Captain a13n wrote:Radiant and q3map2 do not recognize submaterials applied in 3dsmax.
These were applied in modo, although I don't think that matters since max recognized them as sub materials and it's from max that I exported my model.

Regardless; they do work. All my models use sub materials and they show up both in the editor and ingame. There is some tinkering with the .ase file involved however.

Re: Shaders on a model

Posted: Sun May 17, 2009 11:13 pm
by g0th-
you could try to export a lwo file from modo and see if thats easier

Re: Shaders on a model

Posted: Sun May 17, 2009 11:28 pm
by Kat
Games have trouble with ASE materials if they're set up as multi-materials, so Max being able to read the model isn't helping narrow the problem down. To get multiple (different) materials working correctly you need to have each material assigned to a separate Geometric object... so looking at the file it'll show a number of separate objects listed in the gubbings of it.

Re: Shaders on a model

Posted: Mon May 18, 2009 12:03 am
by Jabberwock
Kat wrote:Games have trouble with ASE materials if they're set up as multi-materials, so Max being able to read the model isn't helping narrow the problem down. To get multiple (different) materials working correctly you need to have each material assigned to a separate Geometric object... so looking at the file it'll show a number of separate objects listed in the gubbings of it.
Thanks, but I'm not exactly sure how this helps me. Maybe I haven't been specific enough.

I want to be able to have my model refer to a .shader file, or more precisely a specific shader within that .shader file. Purely theoretically I think it should work since the .ase file is read inside the editor and should therefore be able to successfully refer to the shader. But that's all just guesswork.

In any case. If I had instead separated the model into several objects or simply just had a single object, how would i texture that model with a custom shader?

Re: Shaders on a model

Posted: Mon May 18, 2009 1:29 am
by obsidian
Scroll down about half way until you see my post with all the screenshots. Also be sure to check out ydnar's comment just below my mini-tutorial. (lol... I was still on a 56K modem back when I posted that)

http://www.quake3world.com/ubb/Archives ... 26044.html?



The problem Kat is referring to is this:
Jabberwock wrote:*SUBMATERIAL 0 {
*MATERIAL_NAME "\textures\egyptsoc_sfx\jpblue_floor1a"
When you have submaterials like that, it can often lead to unpredictable behaviour in certain games depending on how the ASE file is being read. Q3Map2 doesn't like submaterials, so you're better off splitting models that requires 2 or more shaders on certain faces off into entirely different meshes.

Here's a sample of what a properly set up model should look like:

Code: Select all

*MATERIAL_LIST {
	*MATERIAL_COUNT 1
	*MATERIAL 0 {
		*MATERIAL_NAME "textures/sockter/ter_dirtmud"
		*MATERIAL_CLASS "Standard"
		*MATERIAL_AMBIENT 0.5882	0.5882	0.5882
		*MATERIAL_DIFFUSE 0.5882	0.5882	0.5882
		*MATERIAL_SPECULAR 0.9000	0.9000	0.9000
		*MATERIAL_SHINE 0.1000
		*MATERIAL_SHINESTRENGTH 0.0000
		*MATERIAL_TRANSPARENCY 0.0000
		*MATERIAL_WIRESIZE 1.0000
		*MATERIAL_SHADING Blinn
		*MATERIAL_XP_FALLOFF 0.0000
		*MATERIAL_SELFILLUM 0.0000
		*MATERIAL_FALLOFF In
		*MATERIAL_XP_TYPE Filter
		*MAP_DIFFUSE {
			*MAP_NAME "textures/sockter/ter_dirtmud"
			*MAP_CLASS "Bitmap"
			*MAP_SUBNO 1
			*MAP_AMOUNT 1.0000
			*BITMAP "textures/sockter/ter_dirtmud"
			*MAP_TYPE Screen
			*UVW_U_OFFSET 0.0000
			*UVW_V_OFFSET 0.0000
			*UVW_U_TILING 1.0000
			*UVW_V_TILING 1.0000
			*UVW_ANGLE 0.0000
			*UVW_BLUR 1.0000
			*UVW_BLUR_OFFSET 0.0000
			*UVW_NOUSE_AMT 1.0000
			*UVW_NOISE_SIZE 1.0000
			*UVW_NOISE_LEVEL 1
			*UVW_NOISE_PHASE 0.0000
			*BITMAP_FILTER Pyramidal
		}
	}
}

Re: Shaders on a model

Posted: Mon May 18, 2009 3:24 pm
by Jabberwock
Alright, thanks. I guess I'll go back and rework my models.

That still doesn't solve my real problem however. I think i'll just have to recreate the shaders manually.

Re: Shaders on a model

Posted: Mon May 18, 2009 8:20 pm
by Jabberwock
...unless what you meant was that I could link the model to my .shader textures with that code.

Re: Shaders on a model

Posted: Mon May 18, 2009 11:15 pm
by Jabberwock
You were right, of course. After dividing my models into several meshes, which wasn't easy because it made exporting the model quite a struggle, I managed to texture it probably. All thanks to you guys. Cheers!