Same shader for multiple textures


(Machine for to kill) #1

I’m sure this has been asked before but I’m not sure exactly what to search for. I’m also pretty sure it’s not doable but I’ll ask anyway

The basic idea is to have a shader template. For example write a shader for wood textures but without a particular texture applied to it so that when you make your map you can just say to the texture use these shader definitions. I know that I can just copy and paste shaders into my shader file, but I’m looking for something even easier. For example if I could write a generic alpha texture template, then I wouldn’t have to go into my shader file and write directories and so on and so forth, and then have to restart radiant since that flush and reload never works, and so on blah blah… :moo: :moo:

Ah what am I talking about I know this can’t be done, if it could I would’ve found out about it by now. But maybe ydnar can do something about it in his next q3map2 build…eh? eh? :bored:

templates people templates…reuse reuse reuse


(SCDS_reyalP) #2

q3map_baseshader
:smiley:
Not exactly what you want (since you do still need to write a minimal shader for each texture) but it should save you some typing.


(Machine for to kill) #3

Yeah I hadn’t thought of that. That does work. But what i really want is to not create a shader at all for each individual texture. I think what I really am after is applying two textures to the same surface, but unlike the baseshader principle the second texture would not need to be cataloged at all in a shader file. So basically you would apply a shader to the surface with no image associated with it, that contains just the surface parameters you want. And then you would apply the image texture to it which would give it the look. This cannot be done though unfortunately.

But to avoid looking like an idiot and asking questions to which I know the answer, I will switch the purpose of this thread.

Can someone write a plugin that takes certain predefined shader definitions and you put in your texture and it writes the rest in your shader file. Or maybe like a general shader handling plugin.

So the plugin takes this (maybe by you selecting the shader file and then it listing you the shaders in it for you to chose. The plugin then determines the part of the shader that is generic and takes that only)

textures/shaderfile/______
{
//parameter
//parameter
//parameter
{
map textures/______________
}
}

and you then you just specify textures to it like /textures/directory/ultimatetexture.tga

and then it outputs

textures/shaderfile/ultimatetexture.tga
{
//parameter
//parameter
//parameter
{
map textures/directory/ultimatetexture.tga
}
}

right into your shader file. Now I’ve prgrammed a good deal and I know that with the proper knowledge this plugin could be done within a day. However i don’t have the proper radiant knowledge so…i think the unreal editor has something similar.


(SCDS_reyalP) #4

It could be done. However, unless you have a LOT of shaders to write, making a shader generating plugin would be far more work than just copy/pasting the shaders. Unless you are already intimate with the radiant code, you would need to spend at least a few days just digging through it just to get a general idea of what you need to do. Then you would spend another few days realizing that the assumptions of the radiant API don’t match exactly what you want to do in your plugin. :banghead:

With suitable organization and naming conventions, you could also generate your shaders using an external (perl, python, lua, whatever) script. That is probably the approach I would take if manual shader copy/paste seemed like too much work.


(Machine for to kill) #5

I might try to make it after I finish my map. I’m thinking of a general shader plugin. It opens a shader file for you and lists the shaders inside of it. It allows you to go through them (combo list) and make changes if you need to. Duplicate them…etc. Options to make your life easier and more productive.

You are right that none of the custom maps have that long a shader file, that you would need another executable to help you sort through it. Even the official shaders aren’t that big. And yes copying and pasting takes a few fractions of a second.

I still think it would be something nice to have. Not to mention the street credit it would give to whoever makes it.


(SCDS_reyalP) #6

There are also a number of shader editing tools and plugins in various states of abandonment. Look for q3ase and the curry plugin.


(Machine for to kill) #7

That q3ase is exactly what I was looking for. Looks pretty outdated though.