Knowhow writing a custom shader - Don't have that.


(Loffy) #1

Hi!

Exposing my vast abyss of unknowledge, I toss out this question. It is of general value so I hope some mapper can elaborate on the issue.

Given: Lots of textures in the stock pk3. E.g. the texture light_m15.blend.tga inside the textures/lights-folder.
Problem: I want to write a custom shader, and use that image.
I don’t want it to be a fancy shader. Just a plain shader.

I THINK this is the correct way of doing it:
(I also THINK that there are many ways of doing it, and this is just one of those ways.)


textures/ge_textures/a_small_lighttexture // I call my shader this. (Can be anything).
{
	qer_editorimage textures/lights/light_m15.blend.tga // Texture in the editor.
	map textures/lights/light_m15.blend.tga // The actual texture in the map.
	surfaceparm metal // This gives the texture a metal-sound, if someone shoots at it.
	implicitMap - // This is an ET shader thing. Good to include (just in case, sort of).
}

N.B. The name of my shader MUST not be the original name. I mean, I cannot call my shader: “textures/lights/light_m15.blend”. If that shader already exist in the game, my new shader will cause trouble.

Main question: Am I close (to doing the right thing)? Or am I lost?

// Loffy


(MadJack) #2

textures/ge_textures/a_small_lighttexture
{ 
   qer_editorimage textures/lights/light_m15.blend.tga
   surfaceparm metalsteps 
   {
   map textures/lights/light_m15.blend.tga 
   implicitMap - 
   }
} 

That should work but it’s very generic and a basic shader. It doesn’t emit light or anything.

EDIT: it’s metasteps, not metal :smiley:


(Shaderman) #3

Don’t know exactly where to start. Maybe with this explanation from the Q3Map2 Shader Manual.

Shaders are short text scripts that define the properties of a surface as it appears and functions in a game world

So it’s nearly impossible to have “just a plain shader”. You define the difference to an ordinary texture (some kind of “intelligence”) by giving a shader special parameters (ie light effects, surface parameters, blah :smiley: ). I think the simpliest (valid) shader would look like this

textures/ge_textures/a_small_lighttexture
{ 
   map textures/lights/light_m15.blend.tga
}

and behave like the texture itself :eek2: . Now it’s up to you to give it those properties you want it to have.

If you don’t want to spend hours and hours on learning about shaders, you could play around with Q3ASE which shows your shader in a “preview window”. You can find a small tutorial on using Q3ASE here.

Hope it helps.


(Loffy) #4

Hi!
I appreciate your answers. Just the kind of stuff I wanted.
I’ll get back later, with some follow-up questions. Perhaps I can Pm you guys?
// Loffy


(Aikon) #5

Weird, I use:

textures/aikon/masamunehilt
{

 surfaceparm metalsteps
 implicitMap -

}

and it has the metal sounds?


(chavo_one) #6

It appears to be a typo.

I’m sure madjack meant to say “It’s metalsteps, not metal”.


(Aikon) #7

Aha, thx m8.


(Detoeni) #8

it should be writen as:

textures/my_shader/my_maplight
{
 qer_editorimage textures/lights/light_m15.blend.tga 
 surfaceparm metalsteps 
 implicitMap textures/lights/light_m15.blend.tga 
}

http://www.planetquake.com/simland/ldr1_1/implicitshaders.htm


(Loffy) #9

Ah, thanks!
// L.


(MadJack) #10

Yeah, sorry for the typo. Metalsteps :o