Darkplaces transparent tga skin reverses draw order?
Moderator: InsideQC Admins
18 posts
• Page 1 of 2 • 1, 2
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
-

lth - Posts: 144
- Joined: Thu Nov 11, 2004 1:15 pm
Re: Darkplaces transparent tga skin reverses draw order?
What are you using to save the .tga file?
-

Feared - Posts: 95
- Joined: Fri Jun 11, 2010 11:58 pm
- Location: Wylie, TX
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.
- Sajt
- Posts: 1215
- Joined: Sat Oct 16, 2004 3:39 am
I'm using the GIMP for my tgas, and yes, Sajt, I have translucent spots on them; in fact, it's only when there are translucent spots that this problem manifests.
Alternatively, is there any other way to get a translucent skin on my model that'll work in Darkplaces?
Alternatively, is there any other way to get a translucent skin on my model that'll work in Darkplaces?
-

lth - Posts: 144
- Joined: Thu Nov 11, 2004 1:15 pm
So has anyone seen translucent TGAs working in Darkplaces at all before? Citation? Then I can compare what they're doing and see what I'm doing wrong. Anyone recommend an app that will save targas that's not the GIMP? (And free!)
-

lth - Posts: 144
- Joined: Thu Nov 11, 2004 1:15 pm
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
-

revelator - Posts: 2567
- Joined: Thu Jan 24, 2008 12:04 pm
- Location: inside tha debugger
I'm 100% sure the image itself is fine, it's just that depth writes are disabled for translucent textures. I poked LordHavoc but he seems to be dormant.
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.
- Sajt
- Posts: 1215
- Joined: Sat Oct 16, 2004 3:39 am
Darkplaces seems to have a codepath for handling transparent skins, i.e. R_ProcessTransparentTextureSurfaceList() and R_MeshQueue_RenderTransparent().
But who knows what is really wrong, I certainly can't follow LordHavoc's code very well
But who knows what is really wrong, I certainly can't follow LordHavoc's code very well
- andrewj
- Posts: 133
- Joined: Mon Aug 30, 2010 3:29 pm
- Location: Australia
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.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
I got no further - tried a few different things including having only 0 or 1 for alpha values of parts of the skin, tried a few different dp rendering flags (like additive) but no joy.
-

lth - Posts: 144
- Joined: Thu Nov 11, 2004 1:15 pm
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
}
}
"progs/bones.mdl_0" is the skin name (minus the .tga extension).
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.
- Sajt
- Posts: 1215
- Joined: Sat Oct 16, 2004 3:39 am
18 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 1 guest