Jump to content

Double sided (cull disable) + transparency shader, possible?


Go to solution Solved by Tempust85,

Recommended Posts

Posted

Problem:

One plane mesh +texture and alpha channel applied. It works fine when no culling is added (aka default cull), the plane has holes in it where they should be except i'd want it double sided.

When the cull disable function is added to the shader, it adds transparency to meshes behind it. So there's a bunch of (almost random?) holes where there should be none, sort of what you get in modview when you preview alpha. I'm thinking the shader treats the black color of the diffuse as alpha but i have yet to play with color to see if it makes any difference. Any ideas?

 

I'm looking at Tavion_new's feathers/hairs and it seems to work... well nope, doesn't work in-game, can only be seen from the front and no shaders present for that, except glow.
 

Posted

I need to break it again before i can post screenshots..

The basic version without double siding:

models/players/MrFancyPants/cloth_a
{
    {
        map models/players/MrFancyPants/cloth_a
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
        rgbGen lightingDiffuse
    }
}

The broken version:

models/players/MrFancyPants/cloth_a
{
  cull disable
    {
        map models/players/MrFancyPants/cloth_a
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
        rgbGen lightingDiffuse
    }
}

Quake III shader manual says double sided planes and assign the alpha texture on one side and the other side a non-drawing texture???

3.2.3 cull disable, cull none
Neither side of the polygon is removed. Both sides are drawn in the game. Very useful for making panels or barriers that have no depth, such as grates, screens, metal wire fences and so on and for liquid volumes that the player can see from within. Also used for energy fields, sprites, and weapon effects (e.g. plasma).
Design Notes: For things like grates and screens, put the texture with the cull none property on one face only. On the other faces, use a non-drawing texture.

 

 

The heck is a non-drawing texture? Surface flag no draw?

  • Solution
Posted

The design notes is mapping-specific. Here's a transparent + 2 sided shader for a map texture if that is of any help:

textures/factory/T2_Wedge_floorgrate
{
	qer_editorimage	textures/imperial/floorgrate
	cull	twosided
    {
        map textures/imperial/floorgrate
        alphaFunc GE128
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
        depthWrite
        rgbGen identity
    }
    {
        map $lightmap
        alphaFunc GE128
        blendFunc GL_DST_COLOR GL_SRC_COLOR
    }
}
Psyk0Sith likes this
Posted (edited)

Almost! the same code makes the texture too bright and there's some kind of glass/translucent area where it should be fully transparent. I'll take out some portions to see if that can be removed completely.

I took out the lightmap stage and it works :)

Edited by Psyk0Sith
Tempust85 likes this
Posted

Remove the blendfunc of DTs shader.

It creates soft edges, but they dont work well in some cases. the alphafunc already produces an alpha :)

Posted

Remove the blendfunc of DTs shader.

It creates soft edges, but they dont work well in some cases. the alphafunc already produces an alpha :)

 

I'll check that too, thanks. Also, forgot to say...thanks DT :winkthumb:

Tempust85 likes this

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...