Problem on Material with Alpha Channel

I was trying to import some models on Urho3D editor, but Im getting some problems with textures that have alpha channel…

Look the pictures:

(Urho3D editor)

(3Ds Max)

I dont know why, but material its translucent… Im already using DiffAlpha.xml technique. The texture its a TGA using Alpha Channel.

Texture Alpha Channel:


Check the value of the MatDiffColor parameter in your material XML file. If it isn’t there then add it as:

<parameter name="MatDiffColor" value="1 1 1 1" />

The MatDiffColor gets multiplied with the input from your texture. So if it’s something like 1, 1, 1, 0.5 then you end up with your texture alpha cut in half. Lets you do fades and tints.

Nothing is changed :frowning:

Copy and paste your material XML so we can see it.

I assume you haven’t changed any shaders/techniques from their originals.


<technique name="Techniques/DiffAlpha.xml" />
<texture unit="diffuse" name="Textures/ricarten_Texture42.tga" />
<parameter name="MatDiffColor" value="1 1 1 1" />
<parameter name="MatSpecColor" value="0 0 0 2" />
<parameter name="MatEmissiveColor" value="0 0 0 1" />

May i ask which exporter did you use in max? Also try png instead of tga

Im exporting to fbx on 3ds max 2012.
Samething with png…

Hmmm. Alpha is working overhere.

Have you checked the bit-depth of the images (are they 8 or 16 bits-per-pixel)?

Try the 08_Decals sample and see if it gives you similar issues. It uses alpha on the decals. Might be worth comparing that material with yours if it doesn’t have issues.

1 Like

It seems like a sorting issue.I assume you export that alpha balcony thing as one mesh ? if that’s the case welcome to Alpha sorting nightmare club.Since Alpha sorting is done per mesh level if you export a complex mesh as one transparent object the result will be completely unpredictable.(Faces are not distance-sorted) Try exporting each transparent element as one mesh or use DiffAlphaMask technique

1 Like

Copy below block and save it as DiffAlphaMask.xml and use that technique instead. It renders just like diff material, just discards alpha mask.


<technique vs="LitSolid" ps="LitSolid" psdefines="DIFFMAP ALPHAMASK">
    <pass name="base" />
    <pass name="litbase" psdefines="AMBIENT" />
    <pass name="light" depthtest="equal" depthwrite="false" blend="add" />
    <pass name="prepass" psdefines="PREPASS" />
    <pass name="material" psdefines="MATERIAL" depthtest="equal" depthwrite="false" />
    <pass name="deferred" psdefines="DEFERRED" />
    <pass name="depth" vs="Depth" ps="Depth" />
    <pass name="shadow" vs="Shadow" ps="Shadow" />

edit: it’s a technique, not mat.


This solved my problem. Thanks for ur help! :smiley:

Not have another way to mask be smoother?

The pass in DiffAdd.xml technique:
<pass name="alpha" depthwrite="false" blend="add" />
results in smoother outcome but uses Unlit shader. There might be a way to add this to the regular Diff.xml but I haven’t experimented with it.