Jump to content

Alpha on saber?


Go to solution Solved by Azatha,

Recommended Posts

I am trying to alpha out a piece of a hilt I do not want to see (its not a separate model piece) but all the shaders for making something invisible that I know do not seem to be working. The piece just shows as white instead. What is a shader I could use to achieve this?

Link to comment

Sitting in Uni I have no access to actual shaders for reference, but off the top off my head:

  • You could take a look at Chewie's fur
  • If you're going to use it on map objects as well: q3map2_nolightmap and q3map2_onlyvertexlighting or whatever they're called. A saber is never going to be processed by Q3Map2 though, so a simple omission of the $lightmap stage will suffice. (Models are not lightmapped, after all.)
  • A single stage for the texture
    • blendFunc GL_ONE GL_ZERO so it overwrites anything previously rendered (in detail: multiply new pixel color (source) by 1, previous (destination) by 0, add results)
    • alphaFunc GE128 so alpha values greater or equal to 128 will be drawn, values below will not. (Alpha tests should (usually) be all-or-nothing to avoid problems)
    • depthWrite so that written pixels also get written to the Depth Buffer (so stuff behind it will not be drawn in front)
    • rgbGen vertex to use vertex colour (i.e. per-vertex-lighting) for colouring
So something like this:
path/to/shader
{
{
map path/to/texture
blendFunc GL_ONE GL_ZERO
alphaFunc GE128
rgbGen vertex
depthWrite
}
}
Link to comment
  • Solution

Thanks mrwonko, you set me in the right direction. What ended up working was:

 

 

models/weapons2/saber_dee/tyrant
{
    q3map_nolightmap
    {
        map models/weapons2/saber_dee/tyrant
        blendFunc GL_ONE GL_ZERO
        alphaFunc GE128
        depthWrite
        rgbGen lightingDiffuse
    }
rgbGen vertex made it flicker oddly, but otherwise spot on!
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...