Shaders on a model

Discussion for Level editing, modeling, programming, or any of the other technical aspects of Quake
Post Reply
Jabberwock
Posts: 12
Joined: Sun May 17, 2009 1:54 am

Shaders on a model

Post 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.
User avatar
Hipshot
Posts: 1547
Joined: Sun Jan 20, 2002 8:00 am

Re: Shaders on a model

Post 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 "/"
Q3Map2 2516 -> http://www.zfight.com/misc/files/q3/q3map_2.5.16_win32_x86.zip
Q3Map2 FS_20g -> http://www.zfight.com/misc/files/q3/q3map2_fs_20g.rar
GtkRadiant 140 -> http://www.zfight.com/misc/files/q3/GtkRadiantSetup-1.4.0-Q3RTCWET.exe
Jabberwock
Posts: 12
Joined: Sun May 17, 2009 1:54 am

Re: Shaders on a model

Post 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.
$NulL
Posts: 100
Joined: Wed Mar 27, 2002 8:00 am

Re: Shaders on a model

Post 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.
Captain a13n
Posts: 51
Joined: Thu Mar 19, 2009 12:02 am

Re: Shaders on a model

Post by Captain a13n »

Radiant and q3map2 do not recognize submaterials applied in 3dsmax.
Jabberwock
Posts: 12
Joined: Sun May 17, 2009 1:54 am

Re: Shaders on a model

Post 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.
g0th-
Posts: 262
Joined: Sat May 19, 2007 7:57 pm

Re: Shaders on a model

Post by g0th- »

you could try to export a lwo file from modo and see if thats easier
[url]http://www.g0th.se[/url]
Kat
Posts: 952
Joined: Tue Nov 14, 2000 8:00 am

Re: Shaders on a model

Post 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.
[url=https://www.katsbits.com/tutorials#q3w]Tutorials, tools and resources[/url]
Jabberwock
Posts: 12
Joined: Sun May 17, 2009 1:54 am

Re: Shaders on a model

Post 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?
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Shaders on a model

Post 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
		}
	}
}
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
Jabberwock
Posts: 12
Joined: Sun May 17, 2009 1:54 am

Re: Shaders on a model

Post 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.
Jabberwock
Posts: 12
Joined: Sun May 17, 2009 1:54 am

Re: Shaders on a model

Post by Jabberwock »

...unless what you meant was that I could link the model to my .shader textures with that code.
Jabberwock
Posts: 12
Joined: Sun May 17, 2009 1:54 am

Re: Shaders on a model

Post 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!
Post Reply