CLEAN SHADER FILES & TEXTURE KIT FOR Q3RADIANT

by Eutectic 23 Jan 2000

COPYRIGHT NOTICE: The shader scripts are copyright 1999 Id Software, Inc. They are derived from the shader scripts in the original release of of Quake III Arena. Use of this material is subject to the same conditions set forth in the End User License Agreement accompanying Quake III Arena. 


INTRODUCTION

Anyone of you map designers who have tried to apply shaders to your brushes or patches
in Q3Radiant and unexplicably ended up with that black and white grid "noshader" texture
in the game know what this is all about. This problem was due to the fact that the shader
files included in Quake III Arena's pak0.pk3 file contain a lot of "broken" shaders.

Those broken shaders don't cause problems to the maps that come with the game because
none of those "broken" shaders are used in any of Id's original Arena maps. But they can
and do cause problems for Q3Radiant and the amateur map designer.


THE EXTENT OF THE PROBLEM

Surely you have noticed all those shaders in Q3Radiant's texture window that show up as
red/black squares outlined in white. When this happens, it means that Q3Radiant is unable
to find the TGA file that would normally be used to represent this shader. But...

** It doesn't necessarily mean that the shader is broken!!**

It could be a shader that works fine but for which the image specified in the shader's
global parameters:

qer_editorimage path/image_name.tga ...

...does not exist!

An example of this situation is the shader "liquids/clear_poollight".

Inversely, there are shaders which show up as a normal image in Q3Radiant's texture window
but when applied to a brush and compiled, they turn up as a "B&W grid" in the game. The
reason for this is, again, due to the "qer_editorimage" parameter. It points to an existing
image but the texture map stages of the shader point to inexistent images, thus the result.

The third main problem was that some perfectly good and very useful shaders didn't even
show up in the texture window (!!).

The extent of these problems, on top of causing confusion, were virtually forcing the
designer to verify the validity of nearly every shader he was unfamiliar with in the shader
files. A big pain. Personally, I didn't find working in these conditions to be very productive.

Another thing which doesn't affect functionality but bugged the hell out of me was that many
shaders were in the wrong files (eg textures/sfx shaders in the common.shader file,
textures/gothic_light shaders in the gothic_block.shader file, etc..).


THE SOLUTION

I decided to fix all the shader files to rid them of these problems. I tested every single
shader in all the shader files in a test map and determined which ones work and which ones
don't. I then sorted all the shaders in the affected shader files in alphabetical order and
commented out all the shaders that are broken. So that part takes care of preventing the bad
shaders from showing up in Q3Radiant's texture window. I also moved the misplaced shaders to
their proper file and created 3 new shader files for this purpose:

- base_door.shader
- gothic_button.shader
- gothic_door.shader

In order for Q3Radiant to read those new shader files, I had to add their names in the
shaderlist.txt file and included it with this package.

To solve the problem of good shaders not showing up in the texture window, I often had to
create custom TGA and JPG images to solve this dreaded "texture robbing" problem: it occurs
when a shader has the same name as the TGA file it uses AND another shader is also using it
for its own editorimage. The "sourcename" shader gets "robbed" of its default editorimage
and thus can't show up in the texture window. Here's an example:

The "textures/liquids/lavahell" shader wasn't showing up in the texture window when the
liquids folder was loaded in Q3Radiant. This is because textures/liquids/lavahell ABSOLUTELY
wants to use lavahell.tga as its editorimage, it won't take anything else even if you specify
a "qer_editorimage" other than lavahell.tga simply because lavahell.tga EXISTS.

Now since many OTHER lava type shaders in that folder SPECIFY lavahell.tga as their
"qer_editorimage", the "sourcename" shader "textures/liquids/lavahell" was getting
"robbed" of its editorimage by ALL these other shaders. So I had no choice but to extract
lavahell.tga from the pak0.pk3 file and rename that copy to something else (lavahell_qer.tga).
Then I had to change the "qer_editorimage" parameter of all the lava shaders other than
lavahell to point to lavahell_qer.tga instead of lavahell.tga. Once ALL the texture "thieves"
have been modified, then and ONLY then can the shader "textures/liquids/lavahell" show up
in Q3Radiant's texture window.

So let that be a lesson to you guys: If you intend on creating custom shaders, NEVER, NEVER,
NEVER name your shaders the SAME name as an existing TGA or JPG image in that texture folder.
If you do, you're creating an opportunity for future problems anytime you want to create
extra shaders using that same TGA as its editorimage. ALWAYS use variants of the TGA's name.
Typical examples of the above would be:

lavahell_1
lavahell_2

etc...

The shader name "lavahell" shoud NEVER have been used. But now, since it's there, it's too
late and we have to live with it. There are plenty of examples of this situation in Id's
choices of shader names. Please do us all a favor and do not repeat the same mistake.


THE GOODIES 

Most of the custom images I included were aimed at solving "texture robbing" problems. But
I also made a few to implement extra convenience for the map designer. Here are the main
highlights of these "convenience images".

In the textures/base_wall folder, I created:

- comp3_qer.jpg
- comp3b_qer.jpg
- comp3c_qer.jpg

These are not meant to be used as textures (although you can but don't forget to include
them with your map when you distribute it). They are "collages" of 2 or 3 existing textures
to give the map designer a better idea of what the shader will look like in the game.
These 3 images are used to represent the 3 computer screen shaders in that folder and
replace the previous images which all showed a blank screen. It was kinda hard to tell
which one is the one you want. Not anymore.

In the textures/gothic_light folder, in order to "salvage" 14 broken shaders,
I created 4 new textures:

- ironcrossltblue.jpg
- ironcrossltblue.blend.jpg
- ironcrossltred.jpg
- ironcrossltred.blend.jpg

These are simply red and blue versions of the ironcrosslt1.jpg (white) and ironcrosslt2.jpg
(yellow) cross textures used for lights. Again, if you use those shaders, don't forget to
include those JPG files in your custom maps's pk3 file for distribution.


In the textures/sfx folder, I created:

- 7 small TGA's which are simply colored squares with the word "FOG" on them.
  The color of the background represents the color of the fog for that shader.

In the textures/skies folder, I created:

- 5 custom images made from a combination or modification of the existing
  images in that folder. These were made to provide a more accurate visual
  representation of what the sky shader REALLY looks like in the game.


INSTALLATION

Hey, the shortest heading of this readme file :)

Just extract the zip file to the baseq3 folder with "paths enabled" in WinZip. This
will place the file qer_editorimages.pk3 (the new images) in the baseq3 folder and
extract all the updated shader files to the baseq3/scripts folder.

NOTE: It's very important that the new images be kept in the pk3 file and that
      the clean shader files reside in the external baseq3/scripts folder for
      everything to work properly in Q3Radiant.

In the process, overwrite any existing old shader files in the scripts folder if any.
I also included a new shaderlist.txt file so Q3Radiant will read the additional shader
files included in this package. If you have any custom shader files of your own, you
will have to edit shaderlist.txt to add their names again since your old shaderlist.txt
will be overwritten.

Launch Q3Radiant, load some texture folders and behold:

- No more red/black squares

- No more broken shaders - choose any one you want without
  a second thought. All the ones you see WORK.

- No more guessing

- Enjoy :)

NOTE: When you load the sfx textures folder in the editor, you will see 5
      blue/black squares with the names: letters1, letters2, etc.. Those
      are due to the 5 textures that reside in the textures/sfx/compscreen
      subfolder in pak0.pk3. Somehow, Q3Radiant sees those are being in the
      textures/sfx folder but can't actually load them because it resides in
      a folder under sfx. Nothig can be done about this so just ignore them.


DISCLAIMER

As always, you can distribute these files far and wide as much as you want
provided that you leave it UNMODIFIED and do it for free. Although I made every
effort I could to make this package as error-free as possible, I cannot assume
responsibility for any problems that might occur as a result of its use. If you
do spot errors or omissions, please email me and give me an accurate description
of the problem and I will fix it ASAP. Do NOT modify and/or redistribute any/all
modified version of the files in this package without my explicit permission.

Eutectic 23 Jan 2000

eutectic@ritualistic.com