OpenArena Message Boards

OpenArena Contributions => Maps => Topic started by: Peter Silie on June 06, 2010, 03:52:39 AM



Title: Shader "tlight" and "tlightr"
Post by: Peter Silie on June 06, 2010, 03:52:39 AM
Hello,

maybe not the right place to drop my question, but i know, that some awsome developers are reading also ;)
I try to make a new map for oa and in the darker passages of this level, i would like to make some hints for the right way.
The texture package "dsi" includes a red and a blue arrow, which would fit my needs with one annoying point: the background of this arrows are not invisible. They look like a plate with an arrow on it. And the plates texture doesn´t fit my requirements.
So i thought, that it would be much better, if the plate is invisible, so the arrows could be used on all other textures.

I tried to modify the shader file (new one based on the original) but unsuccessful :(
Here is the corresponding shader from pak0.pk3/scripts/oalite.shader:

Code:
textures/dsi/tlight
{
qer_editorimage textures/dsi/tlight.tga
q3map_lightimage textures/dsi/tlight.blend.tga
surfaceparm nomarks
q3map_lightsubdivide 32
q3map_surfacelight 1000
{
map textures/dsi/tlight.tga
rgbGen identity
}
{
map $lightmap
blendfunc filter
tcGen lightmap
}
{
map textures/dsi/tlight.blend.tga
blendfunc add
}
}

textures/dsi/tlightr
{
qer_editorimage textures/dsi/tlightr.tga
q3map_lightimage textures/dsi/tlightr.blend.tga
surfaceparm nomarks
q3map_lightsubdivide 32
q3map_surfacelight 1000
{
map textures/dsi/tlightr.tga
rgbGen identity
}
{
map $lightmap
blendfunc filter
tcGen lightmap
}
{
map textures/dsi/tlightr.blend.tga
blendfunc add
}
}

I had the idea, to make a forth shader stage, where i mask all the unused pixels, but my attempts failed (blendfunc GT0 etc.) ???
Any ideas?


Title: Re: Shader "tlight" and "tlightr"
Post by: andrewj on June 06, 2010, 04:55:00 AM
Is the arrow on a solid wall or a mid-air mostly-transparent brush?

For the transparent brush case, I think the shader logic would be:
1. draw the mask, depthWrite
2. draw the arrow, blendFunc filter, depthFunc equal
3. apply the lightmap as normal, depthFunc equal

But it can be a lot easier to simply make a new texture!


Title: Re: Shader "tlight" and "tlightr"
Post by: Peter Silie on June 06, 2010, 04:58:58 AM
The arrow is on a solid wall.
I thought, making just a new shader would be easier (and with less filesize) than creating new textures...


Title: Re: Shader "tlight" and "tlightr"
Post by: andrewj on June 06, 2010, 07:08:29 AM
Well I can't think of a way to do what you're trying to do, and I suspect it is simply not possible (though I could be wrong).

I also think that the tlight.blend images may not be suitable as a mask, since they are meant to be a glow and this glow is larger than the actual arrow shape, extending into the plate area.


Title: Re: Shader "tlight" and "tlightr"
Post by: Peter Silie on June 06, 2010, 09:32:20 AM
Simple fix:
i just made a triangle instead of a square.


Title: Re: Shader "tlight" and "tlightr"
Post by: andrewj on June 06, 2010, 09:53:46 PM
Heh, that works too.