Game Development Community

Transparency problem with Blender exporter

by Walter Yoon · in Artist Corner · 06/03/2004 (2:15 pm) · 8 replies

I'm currently modeling a character in Blender and am having some problems getting transparencies to work correctly in Torque. Specifically, I'm using a PNG bitmap with alpha channel for hair; said bitmap can be found here.

This is what I get in Blender: click here
As you can see, only the bangs are translucent, which is what I want.

However, when I export it and view the model in the Torque -show tool, I end up with this: click here (EDIT: Redrew scalp texture to better illustrate problem)

Apparently the alpha map is being applied correctly to the bangs, but along with that the whole mass of hair becomes transparent too, something I definitely don't want.
(EDIT: Either that, or for some reason all other materials are rendered on top of the hair material.)

I've tried messing around with various options both in the exporter GUI and in the Blender materials settings, but to no avail.

#1
06/04/2004 (2:14 am)
Yoon,

Are you saying *all* of the hair becomes translucent?
I myself have not played about alot with the blending flags in the exporter - though i have rewritten the material import process for inclusion into the next release.
(Currently, the exporter doesn't look at the blender material options very much)

My guess is that your end result will be determined by 3 flags in the gui; Additive, Subtractive, and Translucent. Looking in the torque source, i *think* you only need to set Translucent.
#2
06/04/2004 (3:06 am)
Are you saying *all* of the hair becomes translucent?

Yes, it seems so; all other materials end up rendered on top the the hair material.

My guess is that your end result will be determined by 3 flags in the gui; Additive, Subtractive, and Translucent. Looking in the torque source, i *think* you only need to set Translucent.

Setting only Translucent gives me the problem as originally listed.

As for Additive and Subtractive, I've tried various selections of these options and I still end up with the same problem. Although if I turn on Subtractive and Translucent, the hair simply disappears entirely.
#3
06/04/2004 (3:26 am)
Walter,

It could be that the rest of your mesh is being rendered after your hair, which indicates a render order issue.

Could you possibly post the export output?
Ideally you need the exporter to put the hair mesh after everything else.
#4
06/04/2004 (3:32 am)
The export output is in the console window, right? This is what it says (right now I'm not exporting any sequences or armatures, so it's fairly short):
DTS Exporter 0.6
Exporting to:  g:\torque\example\starter.fps\data\shapes\AAAA\ShizukaAAAA.dts
Using blender, version 233
> Adding Armatures
   Armature : Root
> Adding Materials
   Material : BodyMaterial
   Material : ExpressionMaterial
   Material : EyeballMaterial
   Material : HairMaterial
   Material : HeadMaterial
   Material : MouthMaterial
> Adding Objects
   Object : FemmeBodyObject
     Type : Standard
     Import : FemmeBodyObject
> Adding 1 Detail Levels
> Adding Sequences...
> Finishing... Done.
Writing out DTS file...
Done.

How do I change the order the materials are rendered in? Judging from above, I guessed that it was done alphabetically, but renaming HairMaterial didn't change any of the problems I was having.

Would it help if I posted the exported DTS and CFG files?
#5
06/04/2004 (6:40 am)
Weird... O_o

Alright, how's this for strange: I replaced the original hair verticies with exact duplicates, and it ended up fixing the problem.
#6
06/07/2004 (2:49 pm)
Walter,

Perhaps the vertices+faces you duplicated were put onto the end of the list of vertices+faces in the mesh, thus making them render *last* in torque?
#7
06/07/2004 (5:48 pm)
Hm, that seems to be it. Creating new verticies from scratch also seems to have the same effect; so essentially I have to ensure that I build the models starting from the inside and then work outwards.
#8
06/10/2004 (1:11 am)
Walter,

Or you can make seperate meshes that are after the base mesh in the mesh list. Torque will still render the polygons in the seperate mesh after the base mesh.
There should also be code in the exporter to generate "Sorted meshes" - these special meshes contain a bsp tree which tells torque in what order to render the faces. However, the code currently does not work, and even if it did, you would only be able to use it on *rigid* meshes (ones attatched to only 1 bone).