Mysteriosity in transparent materials?

jwatte

18-04-2007 07:22:24

I have a mesh that consists of part transparency, and part opaqueness. I'm using 3ds Max 9 with the 1/26/07 release of oFusion.

The material is a multi/sub with two child materials. The first child is a regular material with a diffuse map. The second child is a regular material with a diffuse map, and that same map instanced as opacity map. The map in question has "image alpha" set as "mono channel output" which is how you get the alpha to render inside Max. I have also un-checked the pre-multiplied alpha checkbox (because, well, it isn't pre-multiplied :-)

The transparent parts are given material ID 2, and the opaque parts material ID 1.

I have two problems with this mesh:

1) In the oFusion viewport, the alpha material is drawn alpha-tested instead of properly blended. I find this surprising, as alpha test is almost never what you actually want these days (it reduces the effectiveness of early Z, MIP mapping is a real drag, etc). Is there a way to make the material render with blending instead?

2) When I export this mesh, and load it into Ogre (using movable object), using the default "near terrain" scene manager, and add a scene node with this mesh, it is drawn using additive mode -- the entire mesh, not just the transparent parts.

I'm using Ogre 1.4 rc 1.

Here's the material file that gets exported. Note the mysterious "Material_#46" name, which isnt' actually found anywhere in my material!



material Material_#46/ogre_axis_tex
{
technique
{
pass
{
ambient 0 0 0 1
specular 0.3 0.3 0.3 1 20
alpha_rejection greater 128

texture_unit
{
texture_alias 0
texture axis_tex.dds
}
}

}

}

material Material_#46/ogre_axis_tex_alpha
{
technique
{
pass
{
ambient 0 0 0 1
specular 0.3 0.3 0.3 1 20
alpha_rejection greater 128

texture_unit
{
texture_alias 0
texture axis_tex.dds
}
}

}

}

Lioric

18-04-2007 17:07:55

If you want full control over the blend modes (and all of the material features) convert your materials to oFusion Materials, in there you can define the blend mode

The material name is created with the name of the Multi/Sub-Object material name plus the name of the child material, this will be made optional in the next release

For details on updating your materials, see this tutorial, this contains information on automatically upgrading and working with materials:

http://www.ofusiontechnologies.com/support/1299/support_1299_00.html

jwatte

18-04-2007 18:41:55

Thanks for the link!

The material name is created with the name of the Multi/Sub-Object material name

That's what I assume. The problem here is that my multi/sub material is not called Material #46 any longer -- but that's still the material I get when exporting.

However, your link helped me realize that I had already updated the materials, but were looking at the old (Max) material -- not the corresponding oFusion material.

Now to figure out how to set blend modes in the oFusion material :-) (I'm assuming it goes in the technique)

jwatte

18-04-2007 18:57:21

Some progress -- I dug through the technique and pass options and configured them the way I want them. Now the mesh renders correctly in the oFusion viewport, and the material I export looks better.

However, Ogre still renders it in additive blend mode. I'm loading this mesh using createMovableObject(meshPath, meshName). Is that enough, or is there something else I need to do?



material axes/opaque_axis
{
technique
{
pass
{
ambient 0 0 0 1
specular 0.3 0.3 0.3 1 20
alpha_rejection always_pass 128
shading phong

texture_unit
{
texture_alias 0
texture axis_tex.dds
}
}

}

}

material axes/alpha_axis
{
technique
{
pass
{
ambient 0 0 0 1
specular 0.3 0.3 0.3 1 20
scene_blend alpha_blend
alpha_rejection always_pass 128
depth_write off
shading phong

texture_unit
{
texture_alias 0
texture axis_tex.dds
}
}

}

}

jwatte

18-04-2007 19:48:24

Ha! Problem solved. I was picking up an Ogre mesh that had the same name, but draws transparently. It looked enough like mine to be confusing me :-)