Shaders and transparency
#1
Posted 30 May 2014 - 10:47 AM
I made the background black but when I see examples in other forums, they have an alpha mask layer, which I haven't done. Is that it?
Also I'm a total noob when it comes to the shader writing and I have no idea what does what. :| Help.
#2
Posted 30 May 2014 - 12:50 PM
Yes alpha channel is the main component. Your black background is supposed to be in the alpha channel serving as a filter. It will block out everything except the grid itself.
Alpha channel controls opacity. Black means opacity 0%, white is opacity 100%.
#3
Posted 30 May 2014 - 01:39 PM
rayne2, on 30 May 2014 - 12:50 PM, said:
Yes alpha channel is the main component. Your black background is supposed to be in the alpha channel serving as a filter. It will block out everything except the grid itself.
Alpha channel controls opacity. Black means opacity 0%, white is opacity 100%.
I just noticed it. And to be honest, I'm not sure how to do it. I'll check some tutorials, but the hardest part for me is the shader. :P
#4
Posted 30 May 2014 - 02:08 PM
The alpha channel is even easier. Just create a selection of what you want to be masked out and hit the new channel button in the channels tab.
Whatever is selected will be white. So either you select parts you want to be visible and create a new channel or select parts you want invisible, create a new channel and then invert it.
#5
Posted 30 May 2014 - 03:10 PM
This is what I have:
{
map textures/folder1/texture1.tga
blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
alphaFunc GT128
depthWrite
rgbGen identity
}
I copied it from another shader, I also tried changing values but nothing happens. Or at least, nothing noticeable. :D
This post has been edited by Kolossus: 30 May 2014 - 03:12 PM
#6
Posted 30 May 2014 - 03:23 PM
Try this one
textures/vietnam_plants/monstera
{
qer_editorimage textures/vietnam_plants/monstera.tga
surfaceparm alphashadow
surfaceparm nolightmap
surfaceparm nonsolid
surfaceparm nomarks
cull none
//deformVertexes wave 150 sin 0 .3 0 .1
{
map textures/vietnam_plants/monstera.tga
blendFunc GL_ONE GL_ZERO
alphaFunc GE128
depthWrite
rgbGen identity
}
}
I think this one should work. I used it a long time ago for some plants.
This post has been edited by rayne2: 30 May 2014 - 03:26 PM
#7
Posted 30 May 2014 - 03:41 PM
textures/base_floor/pjgrate1
{
surfaceparm metalsteps
cull none
// A GRATE OR GRILL THAT CAN BE SEEN FROM BOTH SIDES
{
map textures/base_floor/pjgrate1.tga
blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
alphaFunc GT0
depthWrite
rgbGen identity
}
{
map $lightmap
rgbGen identity
blendFunc GL_DST_COLOR GL_ZERO
depthFunc equal
}
}
Changing the paths obviously.
#9
Posted 30 May 2014 - 08:28 PM
Kolossus, on 30 May 2014 - 04:20 PM, said:
Try qer_alphafunc, it only works in some versions of radiant though. See here:
http://q3map2.robotr...directives.html
#10
Posted 30 May 2014 - 08:36 PM
this is the shader that i use for transparency:
textures/arnoville/Various0712ext
{
qer_editorimage textures/arnoville/Various0712.tga
qer_alphafunc gequal .5
surfaceparm alphashadow
nomipmaps
nopicmip
polygonoffset
cull none
{
map textures/arnoville/Various0712.tga
alphafunc GE128
depthwrite
}
{
map $lightmap
blendfunc filter
depthfunc equal
rgbGen identity
}
}
ops mr.Null already answered XD