Jump to content

Home

Loading shaders in GTK


JeeMonkey

Recommended Posts

A question about shaders in general.

Right now I am able to create a shader such that, after I compile my map I can see the shader as it is supposed to be seen. But when I open GTK and load the shader, all I get is a black and red checkered texture that is very very small. Had I made the shader correctly, or imported it correctly, it would load as a white box saying "sky" on it... or it would load as a 2D image of that shader (such as when you load the shader file for water shader that moves like waves).

 

When a shader file loads as the black and red checkered texture, what did I do wrong and how do I fix it?

Link to comment
Share on other sites

The basic principle of shaders is the preference of replacement. By that I mean they will replace a basic texture of the same name. This works as well for the textures of models or effects. This means that if your shader entry is named exactly the same as a physical texture in the textures folder, the shader will replace the basic texture, and the basic texture won't exist anymore, in a sense.

 

If the shader entry is a novel name, then it will be effectively a new texture, and it requires an editorimage attribute in the shader code for it to properly be shown in Radiant, as a physical texture by that name doesn't exist. However, the editorimage won't be necessary for the game itself. Furthermore, nothing prevents from giving a physical texture name entry (replacement shader) a "conflicting" editorimage, although it's not necessary, but sometimes convenient.

 

If you fail to provide an editorimage for a novel shader entry name, or enter a nonexisting editorimage, Radiant won't be able to locate any image for the shader to be displayed in the editor. This will result in that shader not found error texture. For example some Raven editorimages are missing, I think.

Link to comment
Share on other sites

textures/[color=darkorange][b]atlantis/ocean[/b][/color] [color=red]***[/color]
{
qer_editorimage	textures/[color=darkorange][b]atlantis/ocean[/b][/color]
surfaceparm	nomarks
surfaceparm	nonsolid
surfaceparm	nonopaque
surfaceparm	water
surfaceparm	trans
q3map_material	Water
q3map_onlyvertexlighting
deformvertexes	wave	100 sin 1 2 2 0.6
   {
       map $lightmap
       blendFunc GL_DST_COLOR GL_ZERO
   }
   {
       map textures/[color=darkorange][b]atlantis/ocean[/b][/color] [color=green]***[/color]
       blendFunc GL_DST_COLOR GL_ZERO
       tcMod turb 0.01 0.03 5 0.1
       tcMod stretch noise 1 0.01 1 1
   }
   {
       map textures/[color=darkorange][b]atlantis/ocean[/b][/color] [color=green]***[/color]
       blendFunc GL_ONE GL_ONE
       tcMod turb 0.02 -0.06 0 0.1
       tcMod stretch noise 4 1 0 0.01
   }
}

 

*** - This change makes the shader appear properly as "ocean" under the "atlantis" texture set. What you had before just replaces "water_1" in the "common" texture set, and might have caused problems.

*** - This change makes the water look like your image atlantis/ocean instead of the previous common/water_1.

Link to comment
Share on other sites

SHOOT! I'm sorry, my last post was inccorect, so I deleted it. This is what I meant to say:

 

Ok I changed what I think you asked me to, and it didn't work. plus, now the red and black checkered square wont load anymore.

 

 

Here is what I started with...

textures/[u]atlantis/ocean[/u]
{
qer_editorimage	textures/common/water_1
surfaceparm	nomarks
surfaceparm	nonsolid
surfaceparm	nonopaque
surfaceparm	water
surfaceparm	trans
q3map_material	Water
q3map_onlyvertexlighting
deformvertexes	wave	100 sin 1 2 2 0.6
   {
       map $lightmap
       blendFunc GL_DST_COLOR GL_ZERO
   }
   {
       map textures/common/water_1
       blendFunc GL_DST_COLOR GL_ZERO
       tcMod turb 0.01 0.03 5 0.1
       tcMod stretch noise 1 0.01 1 1
   }
   {
       map textures/common/water_1
       blendFunc GL_ONE GL_ONE
       tcMod turb 0.02 -0.06 0 0.1
       tcMod stretch noise 4 1 0 0.01
   }
}

Here is what I thought you asked me to change...

 

textures/[u]atlantis/ocean[/u]
{
qer_editorimage	textures/[color=darkorange][b]atlantis/ocean[/b][/color]
surfaceparm	nomarks
surfaceparm	nonsolid
surfaceparm	nonopaque
surfaceparm	water
surfaceparm	trans
q3map_material	Water
q3map_onlyvertexlighting
deformvertexes	wave	100 sin 1 2 2 0.6
   {
       map $lightmap
       blendFunc GL_DST_COLOR GL_ZERO
   }
   {
       map textures/common/water_1
       blendFunc GL_DST_COLOR GL_ZERO
       tcMod turb 0.01 0.03 5 0.1
       tcMod stretch noise 1 0.01 1 1
   }
   {
       map textures/common/water_1
       blendFunc GL_ONE GL_ONE
       tcMod turb 0.02 -0.06 0 0.1
       tcMod stretch noise 4 1 0 0.01
   }
}

What am I missing, or what did I do wrong?

There is no textures/atlantis/ocean

That is just what I chose to call this shader.

Link to comment
Share on other sites

If there is no "textures/atlantis/ocean" physical texture, then you obviously cannot enter that as an editorimage. Otherwise the shader you started with looks just fine. If it doesn't work, it's either because you haven't entered your shader file's name in the shaderlist or your Radiant and/or game installation is screwed.

 

Might be the latter case, because you certainly are having far more problems with basic shaders than anybody I have seen before.

Link to comment
Share on other sites

when i use the shader i started with, and take a copy of textures/common/water_1 and rename it and move it to textures/atlantis/ocean, then when i load gtk the shader appears as water rather than a red and black checkered square. but it seems silly thet that is what I have to do to view an altered shader in radiant.

Link to comment
Share on other sites

Well, you don't. There's no reason to have duplicate textures. Only when you photoshop an altered version of an old Raven texture, you should need to do that.

 

When you say you copy the texture with a new name, are you sure you still get a shader in Radiant, and not just the basic texture?

Link to comment
Share on other sites

When you mention textures/whatever/whatever INSIDE the shader code (inside the outermost set of { }'s), then you are referring to an image file. It must exist on your hard drive or in a pk3 as a jpg, tga, or png file. The heading at the top of the shader file is the name of the SHADER, all other textures/... references are image stages.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...