Darkplaces transparent tga skin reverses draw order?
Darkplaces transparent tga skin reverses draw order?
Hello,
I'm pretty sure I encountered this issue a couple of years ago but can't remember (or successfully search for) the answer. Basically, if I create a .mdl and add a .tga skinfile for it that has an alpha channel, Darkplaces draws the model in reverse order.
Does anyone know a way to stop this happening?
Cheers!
LTH
I'm pretty sure I encountered this issue a couple of years ago but can't remember (or successfully search for) the answer. Basically, if I create a .mdl and add a .tga skinfile for it that has an alpha channel, Darkplaces draws the model in reverse order.
Does anyone know a way to stop this happening?
Cheers!
LTH
Re: Darkplaces transparent tga skin reverses draw order?
What are you using to save the .tga file?
It sounds like DP is disabling depth writes for models with alpha textures. So the skin is drawing in the order the triangles were given in the model (not exactly reverse order, more like effectively undefined).
If possible you could use a shader with alphatest. But if your texture includes translucent spots (not just opaque/transparent), that won't help.
If possible you could use a shader with alphatest. But if your texture includes translucent spots (not just opaque/transparent), that won't help.
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
hmm can use xnview allbeit not as powerfull as the gimp it does support allmost any imageformat.
http://www.xnview.com/en/index.html
dont skip the gimp completely just export the image to another format
then use xnview to convert it to whatever you need
http://www.xnview.com/en/index.html
dont skip the gimp completely just export the image to another format
then use xnview to convert it to whatever you need
-
- Posts: 4
- Joined: Tue Mar 16, 2010 9:49 am
when a model is drawn, the entire mesh is drawn at once.
If you want to ensure that certain polys are drawn after others, you can use a multi-surface model format. anything that supports more than one texture. Use the second texture for any such transparent polys.
Some modeling programs may provide some feature to reorder such polys within the original mesh, but certain engines may attempt to optimise your model into triangle fans/strips still, which would pseudorandomize the order again.
Or use a shader and set up alpha testing instead of alpha blending.
If you want to ensure that certain polys are drawn after others, you can use a multi-surface model format. anything that supports more than one texture. Use the second texture for any such transparent polys.
Some modeling programs may provide some feature to reorder such polys within the original mesh, but certain engines may attempt to optimise your model into triangle fans/strips still, which would pseudorandomize the order again.
Or use a shader and set up alpha testing instead of alpha blending.
Well you have to explicitly enable alphatesting, which involves using a q3-style shader. I had to do this once, I just did what LH told me to. I don't know anything about these shaders.
scripts/filename_doesnt_matter.shader:
"progs/bones.mdl_0" is the skin name (minus the .tga extension).
Hope this works for you.
scripts/filename_doesnt_matter.shader:
Code: Select all
progs/bones.mdl_0
{
cull disable
{
map progs/bones.tga
alphafunc GE128
rgbGen vertex
}
}
Hope this works for you.
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.