LucasForums

LucasForums (http://www.lucasforums.com/index.php)
-   JA Mapping (http://www.lucasforums.com/forumdisplay.php?f=540)
-   -   Loading shaders in GTK (http://www.lucasforums.com/showthread.php?t=152170)

JeeMonkey 09-10-2005 04:44 PM

Loading shaders in GTK
 
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?

lassev 09-10-2005 07:08 PM

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.

wedge2211 09-14-2005 07:39 PM

Code:

textures/atlantis/ocean ***
{
        qer_editorimage        textures/atlantis/ocean
        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/atlantis/ocean ***
        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/atlantis/ocean ***
        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.

JeeMonkey 09-15-2005 12:02 PM

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

Quote:

Originally Posted by JeeMonkey
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...
Code:

textures/atlantis/ocean
{
        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...

Code:

textures/atlantis/ocean
{
        qer_editorimage        textures/atlantis/ocean
        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.

lassev 09-15-2005 04:45 PM

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.

JeeMonkey 09-15-2005 05:31 PM

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.

lassev 09-15-2005 06:17 PM

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?

wedge2211 09-15-2005 07:22 PM

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.


All times are GMT -4. The time now is 05:21 PM.

Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
LFNetwork, LLC ©2002-2011 - All rights reserved.