Do shaders have to be in their file/folder type?

Discussion for Level editing, modeling, programming, or any of the other technical aspects of Quake
Post Reply
Magnus
Posts: 529
Joined: Wed Feb 16, 2005 6:38 pm

Do shaders have to be in their file/folder type?

Post by Magnus »

This is what got in trouble long ago and now I am left fixing the mess.

I created a shader and placed the shader for the map and the corresponding textures in a file and folder for that map and it would not work.

I made a map called tribute.
I created a sky called blackskymm and blackskymm2 for the map.
I created a file called tribute.shader and placed the scripts for those skies in the tribute.shader file. (here are the scripts)

textures/tribute/blackskymm
{
surfaceparm noimpact
surfaceparm nolightmap
q3map_surfacelight 150
q3map_lightsubdivide 512
q3map_sun 1 1 1 32 45 90
{
map gfx/colors/black.tga
}
}

textures/tribute/blackskymm2
{
surfaceparm noimpact
surfaceparm nolightmap
q3map_surfacelight 125
q3map_lightsubdivide 512
q3map_sun 1 1 1 32 45 90
{
map gfx/colors/black.tga
}
}

I placed the tribute.shader into the shaders folder.
I then created the texture for the sky called blackskymm and blackskymm2. (just solid black squares)
I placed the textures in the textures folder in a sub folder called tribute.
I then went into Radiant and when I opened the tribute set of textures the blackskymm and blackskymm2 textures were there, but they were not shaders(no white line around them), but I compiled it anyway useing the textures from the tribute file and went into the map and they did not work.

I went over the shader again and again and it looked as if it should work.
Finally I messed around and tried placeing the blackskymm and blackskymm2 textures into the textures/skies folder and added the scripts I created to the shaders/sky.shader file with file locations changed(here are the scripts with changed file locations)

textures/skies/blackskymm
{
surfaceparm noimpact
surfaceparm nolightmap
q3map_surfacelight 150
q3map_lightsubdivide 512
q3map_sun 1 1 1 32 45 90
{
map gfx/colors/black.tga
}
}

textures/skies/blackskymm2
{
surfaceparm noimpact
surfaceparm nolightmap
q3map_surfacelight 125
q3map_lightsubdivide 512
q3map_sun 1 1 1 32 45 90
{
map gfx/colors/black.tga
}
}

I then went into Radiant and when I opened the skies set of textures the blackskymm and blackskymm2 textures were there and they were shaders(white line around them) so I compiled it useing the textures from the skies file and went into the map and they worked!

As you can see both scripts and textures are exactly the same other than where they are placed.

This happened with any shaders I tried to create. I had to place them into either the gfx, liquids, sfx or skies .shader files and textures folders to get them to work.

Now I want to release many of the maps I made, but I am stuck trying to once again get my shaders to work from a .shader file and texture folder that would go with the map.

I am sure I was doing it right the first time because I have seen too many maps that came with like one shader file called "mapname".shader with all kinds of different shader scripts for skies, teleproters, waters, lavas and other liquids, fires/flames, and many other kinds of things in that .shader file

What is wrong with my stuff here?

Any help finally fixing this issue would be VERY appreciated.

Thanks
Uh, well....good luck with that. :shrug:

[img]http://i57.photobucket.com/albums/g228/Magnus3204/forumheader.jpg[/img]
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Post by obsidian »

Probably unrelated, but...

Code: Select all

textures/skies/blackskymm
{
	surfaceparm noimpact
	surfaceparm nolightmap
	q3map_surfacelight 150
	q3map_lightsubdivide 512
	q3map_sun 1 1 1 32 45 90
	{
		map gfx/colors/black.tga	// :(
	}
}
shouldn't that be:
map textures/tribute/blackskymm.tga

Nothing in your shader is using your custom textures.



Standard practice is this:

Radiant and Q3Map2 looks in shaderlist.txt to see a list of all shader text files. For organizational reasons, we usually keep shaders of a certain type in one .shader file (shaders that function as liquids in a liquids.shader file). Shaderlist.txt will have a list of something like:

common
skies
liquids
tribute

Each of which refers to the physical .shader file:

Q3/baseq3/scripts/common.shader
Q3/baseq3/scripts/skies.shader
Q3/baseq3/scripts/liquids.shader
Q3/baseq3/scripts/tribute.shader

Inside each .shader file, you have the actual shaders themselves. The name of the shader script (the first line) can actually be anything you want (even something wacky), but for organizational reasons, it's usually a directory format that points to the location of the main texture or shader location:

textures/common/caulk
textures/skies/bluesky
textures/liquids/water
textures/tribute/blackskymm

Quake3 itself doesn't care which .shader files you actually stick the shader scripts themselves. You could have the script, "textures/liquids/water" inside your skies.shader file. Wouldn't make any sense logically to us (and you'll probably won't be able to find your shader), but Q3 doesn't care. It just reads each .shader file and processes each shader script individually.

In your case, both shaders are valid, but the first one makes more sense organizationally speaking. You want your custom shaders to appear in Radiant under your own shader directory as opposed to getting mixed up with the stock Q3 skies. You should never have to put your shaders scripts inside stock Q3 .shader files since this causes version overwriting problems for other people and probably punkbuster issues since your shaders aren't "pure".

That's the theory of it all just FYI, but I'm guessing that the main problem you have here is that you forgot to add your custom .shader files to shaderlist.txt.
Magnus
Posts: 529
Joined: Wed Feb 16, 2005 6:38 pm

Post by Magnus »

WOOT!!

Funny that I never read or learned that anywhere. I guess I would have if I knew to be looking for it. :dork:

I just went into my baseq3/shaders/shaderlist.txt and added tribute to the bottom of the list and every shader I ever made suddenly works perfectly. :icon25:

Now question is that all i need to do now? I mean do I need to add a copy of a shaderlist.txt to my .pk3 for each map? I have never seen a shaderlist.txt in a .pk3 for a map so I assume the answer is no, but I want to be sure.
Uh, well....good luck with that. :shrug:

[img]http://i57.photobucket.com/albums/g228/Magnus3204/forumheader.jpg[/img]
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Post by obsidian »

No you don't need it in your pk3, shaderlist.txt is used by Radiant only.
Magnus
Posts: 529
Joined: Wed Feb 16, 2005 6:38 pm

Post by Magnus »

Got it. Cool. Thanks once again!
Uh, well....good luck with that. :shrug:

[img]http://i57.photobucket.com/albums/g228/Magnus3204/forumheader.jpg[/img]
Magnus
Posts: 529
Joined: Wed Feb 16, 2005 6:38 pm

Post by Magnus »

OK, I am rebuilding my textures and shaders files and folders and I am testing them as I go and I am having screwy problems again.

I copied much of my shader script text from the Q3A scripts like in the sfx/liquids/skies files and added them to my own tribute.shader file and then just changed the name of the immages being used and locations of those immages to match the ones I am using from my tribute texture folder.

By the way the shader I am creating is for the most part the same as the spawn_floord2c texture and shader just with color changes. In mine the spawn_floord2c.tga is dark gray and the diamind plate around it is blue, the blocks18cgeomtrn2.tga is also dark gray and the proto_zzztblu is a bit ...erm... bluer.

e.g.

Taken from the sfx shader file:

textures/sfx/spawn_floord2c
{

{
map textures/sfx/proto_zzztblu.tga
tcmod scroll 0 1
tcMod turb 0 .25 0 5.6
tcmod scale 2 2
blendFunc GL_ONE GL_ZERO
rgbGen identity
}
{
clampmap textures/gothic_block/blocks18cgeomtrn2.tga
blendFunc blend
tcmod rotate 130
tcMod stretch sin .8 0.2 0 .2
rgbGen identity
}
{
clampmap textures/gothic_block/blocks18cgeomtrn2.tga
blendFunc blend
tcmod rotate 80
tcMod stretch sin .8 0.2 0 .1
rgbGen identity
}
{
map textures/sfx/spawn_floord2c.tga
blendFunc blend
rgbGen identity
}
{
map $lightmap
blendFunc GL_DST_COLOR GL_ONE_MINUS_DST_ALPHA
rgbGen identity
}
}


Added to my tribute shader file and immages used changed:


textures/tribute/spawn_floor_diamond_blue
{

{
map textures/tribute/telep_elecclouds_blue.tga
tcmod scroll 0 1
tcMod turb 0 .25 0 5.6
tcmod scale 2 2
blendFunc GL_ONE GL_ZERO
rgbGen identity
}
{
clampmap textures/tribute/spawn_floor_center.tga
blendFunc blend
tcmod rotate 130
tcMod stretch sin .8 0.2 0 .2
rgbGen identity
}
{
clampmap textures/tribute/spawn_floor_center.tga
blendFunc blend
tcmod rotate 80
tcMod stretch sin .8 0.2 0 .1
rgbGen identity
}
{
map textures/tribute/spawn_floor_diamond_blue.tga
blendFunc blend
rgbGen identity
}
{
map $lightmap
blendFunc GL_DST_COLOR GL_ONE_MINUS_DST_ALPHA
rgbGen identity
}
}

So what is the difference in these that the version in my tribute .shader is not working?
I have the proper alpha set in all of my immages I am using. Heck I even copied all of the textures I am useing for this shader from the sxf texture folder and just modified the hue to make things a bit more blue.

In Radiant my shader has a white outline indicating that is seen as a shader and when I load the map ingame there are no warnings and no failures to load anything, but the shader just looks like the spawn_floor_diamond_blue.tga texture with black in the middle where the transparent alpha area is supposed to be.

I still have my tribute.shader added to the shaderlist.txt.
I am useing a nearly identical version of a working shader script from the sfx shaders.
I am useing nearly identical versions of proper immages from the sfx texture folder.
The immage window in Radiant tells me it is a working shader.
The console ingame tells me that there is nothing wrong.
Yet it is not working.
I am lost at this point.

Anyone see anything wrong?
Uh, well....good luck with that. :shrug:

[img]http://i57.photobucket.com/albums/g228/Magnus3204/forumheader.jpg[/img]
Shallow
Posts: 167
Joined: Wed Feb 09, 2005 1:58 pm

Post by Shallow »

When you resaved your textures you probably didn't preserve the alpha channel.
Magnus
Posts: 529
Joined: Wed Feb 16, 2005 6:38 pm

Post by Magnus »

No. After compairing my shader script against the one I copied and finding nothing wrong that I could see the next thing I checked was the alpha for each immage that I copied and changed. Each immage I am useing has the proper alpha.

Thanks though :)
Uh, well....good luck with that. :shrug:

[img]http://i57.photobucket.com/albums/g228/Magnus3204/forumheader.jpg[/img]
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Post by obsidian »

Looks alright to me. Check to see if you have other shader syntax errors like an extra or missing bracket. These may exist in this shader file or in other shader files.
dnky
Posts: 188
Joined: Thu Nov 24, 2005 3:49 pm

Post by dnky »

Obvious but often made error, you dont have a previous version of the script in a pk3 somewhere do you?
Whatever....
Magnus
Posts: 529
Joined: Wed Feb 16, 2005 6:38 pm

Post by Magnus »

Well I was hoping that was it, but I checked and no I don't seem to.

Thanks anyway dnky. :)

This is getting strange.

I even simply copied a shader text from the sfx file and pasted it into my tribute file and changed where it says /sfx/ to /tribute/ and then copied the textures used and placed them in my tribute textures folder.

So everything is exactly as it is in the sfx shader and it is still doing the same thing.
The sfx version is working just fine, but the exact same version only from my tribute files and folders.

It tells me it is a shader in Radiant due to the white outline (though this dosen't mean it is going to work right) and it doesn't give me any warnings, errors, trying or couldn't find a texture or any other error in the console when I load the map I have the shader in, but the shader still is not working. :icon23:


I added tribute to the shaderlist.txt, there are no syntax errors in my .shader file that I can find, my shader texts are written properly and they are all pointing to the proper textures and spelled correctly, all my textures that should have an alpha channel do and are saved in the right .tga format.
So are there any other reason my shaders would fail to work?
Uh, well....good luck with that. :shrug:

[img]http://i57.photobucket.com/albums/g228/Magnus3204/forumheader.jpg[/img]
Magnus
Posts: 529
Joined: Wed Feb 16, 2005 6:38 pm

Post by Magnus »

I found a .pk3 of a map I made and packed up and it had a version of one of my shaders for a jumppad. The name of the shader and the names of the textures used are different, but other than that it is exactly the same and it is working just fine.
Same textures used just named differently and same script text and format just name of shader and name of texteures called out different.
So the one in my .pk3 works but not the ones in my baseq3/shaders/tribute, baseq3/textures/tribute. :confused:

Also my jumppad shaders are casting the light they are scripted to cast. Just the various layers of the shader are not showing. It just looks like the jumppad texture. :dork:

This give any helpfull clues to what the problem is?

Perhaps I need to go back a look for syntax errors in my tribute.shader again?
Last edited by Magnus on Wed Jul 25, 2007 4:49 pm, edited 1 time in total.
Uh, well....good luck with that. :shrug:

[img]http://i57.photobucket.com/albums/g228/Magnus3204/forumheader.jpg[/img]
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Post by obsidian »

Temporarily remove all other custom content from your Q3 install directories. Just to make sure it's not some sort of conflict.
Magnus
Posts: 529
Joined: Wed Feb 16, 2005 6:38 pm

Post by Magnus »

OK, this is getting REALLY messed up. :dork:

I removed all custom content including my own as you said.

I went to go ingame to see if it fixed anything and suddenly I am getting that problem where none of the shaders are working in the entire game. You know the one where when you open Q3A and it gets past the intro "id" animation instead of having a black background and animated title at the top there is just a gray background with a white outline and the menu listings.

Anyway I kept putting things back that I removed untill that problem went away. It turned out that it was that q3mmdm3.pk3 that I made. When I added it back to the baseq3 everything went back to normal.
I removed it again and the problem returned. So I got the idea to go in to see if my shaders were working without that .pk3 being in there. They were! Great so it is something about that q3mmdm.pk3 that was causeing my shaders to not work, but removing that .pk3 causes that huge shader problem in the entire game. Gerrrrrr!

It was giving me this error over and over in the console while that q3mmdm3.pk3 was removed and the shader issue was going on.

RE_AddPollyToScene: NULL polly shader
Uh, well....good luck with that. :shrug:

[img]http://i57.photobucket.com/albums/g228/Magnus3204/forumheader.jpg[/img]
dichtfux
Posts: 571
Joined: Thu Feb 02, 2006 10:51 pm

Post by dichtfux »

Magnus wrote: I went to go ingame to see if it fixed anything and suddenly I am getting that problem where none of the shaders are working in the entire game. You know the one where when you open Q3A and it gets past the intro "id" animation instead of having a black background and animated title at the top there is just a gray background with a white outline and the menu listings.
A friend of mine recently had that problem. I fixed it by removing some pk3-file that (according to its name) contained some alternate weapon models. Really strange that this problem occurs if you don't have any custom content (or even after removing a pk3).

Try removing all custom content, then drop ONLY that pk3 into baseq3. Does this still fix the error?

Pk3s are used in alphabetical order, so your pk3 may simply be fixing the things another broken one is causing, leaving you with the impression that it fixes a quake3 problem.
[color=#FFFFFF][url=http://maps.rcmd.org]my FPS maps[/url][/color]
dnky
Posts: 188
Joined: Thu Nov 24, 2005 3:49 pm

Post by dnky »

That sounds like a classic match token problem....a simple missing } in a shader
Whatever....
Magnus
Posts: 529
Joined: Wed Feb 16, 2005 6:38 pm

Post by Magnus »

dichtfux wrote:Try removing all custom content, then drop ONLY that pk3 into baseq3. Does this still fix the error?
Yes it does. I removed all custom content and then started to put it all back to see what one fixed it. When I got to my q3mmdm3.pk3 the problem went away. I took out all of the custom content again and the problem returned. I put back only my q3mmdm3.pk3 and it again fixed the problem.

I am tying to look stuff about this up as well as check in here to see if anyone has an idea that will solve this, but yea. Having this problem due to removing a .pk3 is kinda messed up. :dork:
Uh, well....good luck with that. :shrug:

[img]http://i57.photobucket.com/albums/g228/Magnus3204/forumheader.jpg[/img]
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Post by obsidian »

So it doesn't work when removing ALL custom content?

That sounds like you probably messed up one of the default Q3 shaders when you were moving stuff in and out.
Magnus
Posts: 529
Joined: Wed Feb 16, 2005 6:38 pm

Post by Magnus »

obsidian wrote:So it doesn't work when removing ALL custom content?
Not sure what way you mean, but yea all of my custom content is OK. Only when I take that one q3mmdm3.pk3 in or out of my baseq3 is there a problem.
When I take it out my shaders that I made start to work, but the rest of the shaders in the game get messed up or seem missing.
When I put it in my shaders stop working, but the rest of the shaders and such in the game are fine.

This would make sense if it were all the other way around. The it would be a matter of a scripting syntax error on my part in my .pk3.
That sounds like you probably messed up one of the default Q3 shaders when you were moving stuff in and out.
Very possible. Just opened my baseq3 to start going through any .shaders I ever messed with to see if there is a problem.

I been through the q3mmdm3.pk3 several times and I can't see what it could be patching up when I put it in my baseq3.

I'm just gonna keep at trying to track down any syntax errors I can find there and if I can't find the problem I may end up removing my custom content for re-install later and re-install Q3A/Q3:TA and the 1.32 point release to make sure everything is pure.

I'll check back here before I do to see if anyone thinks this is a bad idea and why.

I would really just like to be able to get back to our CTFPTM. :icon26:
Uh, well....good luck with that. :shrug:

[img]http://i57.photobucket.com/albums/g228/Magnus3204/forumheader.jpg[/img]
Shallow
Posts: 167
Joined: Wed Feb 09, 2005 1:58 pm

Post by Shallow »

When you see missing shaders, are you running Q3 with \sv_pure 0 or 1?

If with all custom pk3s removed it is bad on 0 but OK on 1 then you have bad shaders in the scripts folder: If it's bad on 1 as well then you've managed to hose one of the shaders in the game's base pk3s somehow, or there's a pk3 you think is vanilla but isn't.

Also, this sort of thing is why we slap people who aren't building their maps in a clean install of Q3 ;)
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Post by obsidian »

I have 2 copies of Q3 installed on my computer, a "clean" one for playing on, and a second development copy.

When working on maps, I usually work on them in a mod directory (not baseq3).

This works well for me, but everyone's mileage map vary.
Magnus
Posts: 529
Joined: Wed Feb 16, 2005 6:38 pm

Post by Magnus »

OK, guys. I need some serious help here. I had obviosly as was feared screwed my Q3A shaders and such from messing with them to learn about how it all works in my only (sorry. I know now) install of the game.

I uninstalled Q3:TA and Q3A and re-installed them. I reinstalled the 1.32 points release. I then went ingame to make sure everything was OK and it was just fine. My shaders were working and the rest of the game was just fine as well.

I went to open Radiant and it gave me some warnings and would not open. I fixed the problems and when it opened it couldn't find any of the common textures or anything. I looked in my baseq3 and all of my related files were gone. textures, shaders, mapobjects, maps, sound, models, demos, env, levelshots, screenshots all of them.

I did save a copy of most of these before I done anything. So I placed them back into my baseq3 and Radiant still could not find it's radiant or common textures.
So I figured Radiant must install those files when it is installed. So I uninstalled GTKRadiant 1.4.0 and went to look for it online to re-install it and I can't find it anywhere!
All I could find was 1.5. I tried to install it and it did not replace the missing files and textures in my baseq3.
I checked and the site is saying it is no longer reasonable to support Radiant.

I found a copy of 1.4.0-Raven that ydnar put out(and a few others I think), but it does not support Q3A.

I am lost here. It has been so long since I installed Q3A/Q3:TA and Radiant that I forgot how those folders and files got into my baseq3 in the first place. :dork:

Any help? Please. :icon25:
Uh, well....good luck with that. :shrug:

[img]http://i57.photobucket.com/albums/g228/Magnus3204/forumheader.jpg[/img]
dichtfux
Posts: 571
Joined: Thu Feb 02, 2006 10:51 pm

Post by dichtfux »

Sounds like you need the radiant example maps. I've got a mirror here:

http://www.airrocket.net/mirror/mapping ... -12-06.zip

They can also be found on the id ftp server.

Also, make sure to (re-)adapt the shaders.txt file to your need.
[color=#FFFFFF][url=http://maps.rcmd.org]my FPS maps[/url][/color]
Magnus
Posts: 529
Joined: Wed Feb 16, 2005 6:38 pm

Post by Magnus »

WOOT!

Thanks a bunch man!

Looks like everything is fine now. Whew! :icon25:
Uh, well....good luck with that. :shrug:

[img]http://i57.photobucket.com/albums/g228/Magnus3204/forumheader.jpg[/img]
Post Reply