Forum

Darkplaces transparent tga skin reverses draw order?

Discuss anything not covered by any of the other categories.

Moderator: InsideQC Admins

Darkplaces transparent tga skin reverses draw order?

Postby lth » Sun Dec 05, 2010 5:21 pm

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

Re: Darkplaces transparent tga skin reverses draw order?

Postby Feared » Sun Dec 05, 2010 5:29 pm

What are you using to save the .tga file?
User avatar
Feared
 
Posts: 95
Joined: Fri Jun 11, 2010 11:58 pm
Location: Wylie, TX

Postby Sajt » Sun Dec 05, 2010 5:37 pm

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

Postby lth » Sun Dec 05, 2010 6:21 pm

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

Postby revelator » Mon Dec 06, 2010 1:29 am

hmm the old topside down tga bug or something else ?

later was fixed in newer tga code atleast i havent seen it for a long time but it kinda stomps me to hear about it from dp Oo.
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Postby Sajt » Mon Dec 06, 2010 1:42 am

No, he's not talking about that... (though I've never heard of that problem in a Quake engine)
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

Postby revelator » Mon Dec 06, 2010 2:43 pm

ah on alpha masked textures sorry was quite late when i wrote :oops:

but aye newer seen that particular bug before.

hmm might be a bug with gimp.
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Postby lth » Tue Dec 07, 2010 10:31 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!)
User avatar
lth
 
Posts: 144
Joined: Thu Nov 11, 2004 1:15 pm

Postby revelator » Tue Dec 07, 2010 10:54 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 :)
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Postby Sajt » Tue Dec 07, 2010 11:18 pm

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

Postby andrewj » Wed Dec 08, 2010 1:46 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 :lol:
andrewj
 
Posts: 133
Joined: Mon Aug 30, 2010 3:29 pm
Location: Australia

Postby MichaelSteve » Tue Mar 29, 2011 12:04 pm

lth, did you have any luck with this issue? I'm currently encountering the same problem.
MichaelSteve
 
Posts: 4
Joined: Tue Mar 16, 2010 9:49 am

Postby Spike » Tue Mar 29, 2011 12:48 pm

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.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby lth » Thu Apr 07, 2011 10:13 pm

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

Postby Sajt » Sun Apr 24, 2011 4:58 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:

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

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest