Custom shaders don't load image.


(Pande) #1

:frowning: Well, let me first start off by saying these shaders worked just fine in both JKA and Nexuiz, but as soon as I moved em to Wolfenstein, I got problems.

Basically, I have tried an env mapped water shader, a sun_ext’ed sky shader, a stain glass window and a translucent version of the stainglass window for the light to shine through, with the entity command surfaceparm lightfilter to make the light coloured.

But on every compile, I get the black and orange grid of death, and a slew of nonsense error messages.

I’ll post the shaders, with their error message:

textures/ctt/ctt
{

qer_editorimage textures/ctt/ctt_ft
q3map_lightRGB 0.923568 0.959106 1.000000
q3map_skylight 200 5
surfaceparm nomarks
surfaceparm sky
surfaceparm noimpact
surfaceparm nodlight
q3map_lightmapFilterRadius 0 8
q3map_sunExt 1.000000 0.997119 0.857641 350 180 58 1 2
notc
nopicmip
nomipmaps
q3map_nolightmap
skyParms textures/ctt/ctt 1024 -
}

 

Shader textures/ctt/ctt has a stage with no image

textures/walls/whitelight
{
qer_editorimage textures/mp/ylight.jpg
q3map_surfacelight 8000
q3map_backSplash 0.4 6
q3map_nolightmap
q3map_lightRGB 1 1 1
{
map $whiteimage
blendFunc GL_DST_COLOR GL_ZERO
rgbGen const ( 1.00 1.00 1.00 ) 
}
{

map $whiteimage
blendFunc GL_ONE GL_ONE

rgbGen const ( 1.00 1.00 1.00 )
glow
}
}

WARNING: unknown general shader parameter ‘glow’ in ‘textures/walls/whitelight’

textures/water/water
{
qer_editorimage textures/water/water
qer_trans 0.7
sort banner
surfaceparm water
surfaceparm nonsolid
surfaceparm nomarks
surfaceparm trans
q3map_material water
q3map_tessSize 512
deformvertexes normal 0.1 0.1
deformvertexes wave 128 sin 0 0.5 0.2 1
{
map textures/water/water
blendfunc blend
tcMod turb 0.25 0.2 1 0.2
}
{
map textures/water/env_Water
tcGen environment
blendFunc GL_DST_COLOR GL_ZERO
blendfunc GL_ONE GL_ONE
}
{
map textures/water/water
blendFunc GL_DST_COLOR GL_ZERO
}
{

WARNING: R_FindImageFile could not find ‘textures/water/water’ in shader ‘textures/water/water’

textures/stainglass/window1
{
map textures/stainglass/window1
q3map_surfacelight 9000
q3map_backSplash 0.4 6
q3map_nolightmap
q3map_lightRGB 1 1 1
{
map textures/stainglass/window1
blendFunc GL_ONE GL_ONE
glow
rgbGen identity
}
}

textures/stainglass/window2
{
map textures/stainglass/window
q3map_surfacelight 9000
q3map_backSplash 0.4 6
q3map_nolightmap
q3map_lightRGB 1 1 1
{
map textures/stainglass/window2
blendFunc GL_ONE GL_ONE
glow
rgbGen identity
}
}

textures/stainglass/window1trans
{
map textures/stainglass/window1trans
q3map_nolightmap
surfaceparm trans
surfaceparm lightfilter
surfaceparm alphashadow
{
map textures/stainglass/window1trans
alphaFunc GE128
blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
depthWrite
}
{
map $lightmap
rgbGen identity
blendFunc GL_DST_COLOR GL_ZERO
depthFunc equal
}
}

textures/stainglass/window2trans
{
map textures/stainglass/window2trans
q3map_nolightmap
surfaceparm trans
surfaceparm lightfilter
surfaceparm alphashadow
{
map textures/stainglass/window2trans
alphaFunc GE128
blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
depthWrite
}
{
map $lightmap
rgbGen identity
blendFunc GL_DST_COLOR GL_ZERO
depthFunc equal
}
}

WARNING: unknown general shader parameter ‘map’ in… (all 4 shaders in that file)

Only one of them references a missing image… and all of them are missing their images. All env map images are missing as well on the water. However, I know the shader works because my sky emits light and my water makes ripples and acts just like water does. My stain glass windows emit light fine also.

Any ideas? Thanks for your help,
Pande


(kamikazee) #2

Generally, your shaders are not compatible because some of them use shader directives which simply do not exist in W:ET (E.g. “glow” or “map” as general directives).

The “image not found” could be caused by the fact you did not specify a “.tga” extension (even if the source is a jpeg).

The first shader is the most disturbing - it really has no stage or implicitMap statement, so what defines what image files it should use?!?


(Pande) #3

Its a sky shader… this defines it:

skyParms textures/ctt/ctt 1024 -
where textures/ctt/ctt is the sky folder, which calls on ctt_ft, _bk, _lf, etc.

Why doesn’t ‘map’ exist? it is the parameter used to define a texture for an image stage (eg map textures/blah/blah)

And about .tga… I cannot use.jpgs? Only one image needs to be transparent in my shaders, and that is the water. I am usiing a blendfunc for that.

Is there any shader tutorials specifically designed for W:ET? Obviously this game’s shader parameters are different and I need to learn 'em.

If no tutorials, can someone point me to an example sky shader and an example water shader, with env maps?


(kamikazee) #4

Your best bet for a shader reference is Ydnar and Obisidian’s Q3Map2 Shader manual. I found a mirror at pumpkin.game-server.cc, though Googling should yield other mirrors.

[QUOTE=Pande;182215]Its a sky shader… this defines it:

skyParms textures/ctt/ctt 1024 -
where textures/ctt/ctt is the sky folder, which calls on ctt_ft, _bk, _lf, etc. [/quote]Ok, taken a look in the reference and skyParms does do that. However, it seems that most W:ET sky shaders have a stage, for example wezelkrozum’s sky shader. Skybox-only shaders could be a JKA thing.

[QUOTE=Pande;182215]Why doesn’t ‘map’ exist? it is the parameter used to define a texture for an image stage (eg map textures/blah/blah)[/quote]Sure, map exists, but you put it in as a general directive. See your shader below: (in the future, please make sure to post with proper outlining)

textures/stainglass/window1
{
    map textures/stainglass/window1
    q3map_surfacelight 9000
    q3map_backSplash 0.4 6
    q3map_nolightmap
    q3map_lightRGB 1 1 1
    {
        map textures/stainglass/window1
        blendFunc GL_ONE GL_ONE
        glow
        rgbGen identity
    }
}

The first line of the shader is a map statement, which does not work in W:ET.

If you want to write a shader with a given map but are too lazy to write a stage, look at implicitMap. If you open the shaders bundled with W:ET, you’ll see it often.

[QUOTE=Pande;182215]And about .tga… I cannot use.jpgs? Only one image needs to be transparent in my shaders, and that is the water. I am usiing a blendfunc for that.[/quote]I didn’t say you couldn’t use JPEGs.

The thing is: in your shader, you need to specify the path to a .TGA, but the game is actually smart enough to pick a JPEG if that TGA does not exist. It sounds confusing, but it makes sense once you see it work.

[QUOTE=Pande;182215]If no tutorials, can someone point me to an example sky shader and an example water shader, with env maps?[/QUOTE]I’m afraid there’s not really a catch-all tutorial. You could try to Google for info, but I guess it’s mostly just small stuff.

The Q3Map2 shader manual is a good reference though, it should list most if not all stuff you need.


(Pande) #5

Thanks that is very helpful :slight_smile:

So my shader should look like this?

textures/stainglass/window1
{
q3map_surfacelight 6000
// got rid of the first map statement that wasn’t in a W:ET shader stage.
q3map_backSplash 0.4 6
q3map_nolightmap
q3map_lightRGB 1 1 1
{
map textures/stainglass/window1.tga
// add a fake extension like so?
blendFunc GL_ONE GL_ONE
rgbGen identity
}
}

Edit: I have that shader manual memorized since day 1 :smiley: I read it before I had even made a shader :smiley:
Edit2: I have now gotten the water shader to work by adding .tga to everything but the qer_editorimage.

THANKS!