2
$\begingroup$

I'm using MakeHuman and Blender for modelling, and I'm using Ogre to display my model. There is nothing wrong with the way I load into Ogre (make an entity from the .mesh file).

Most Recent Update:

I have solved the issues mentioned below with my model's eyelashes, hair, and eyebrows. I must keep all materials separate instead of combining the textures into one if I want the "further" pixels to show through the closer transparent ones. However, I am still having one issue.

Now that I am using separate materials for different parts of my mesh, my model's eyes are white or black (AGAIN) depending on the type of scene_blend I choose in the eye material's pass or the texture unit's colour_op.

I have figured out WHY it is doing this - there is a transparent layer being drawn over the eyes as white (or black) which is supposed to represent the cornea - but I don't know how to fix it.

I know I can unwrap the UV for the mesh before joining them in blender and correct it that way, but I'd have to do this for every model I make using MakeHuman. Besides, the eyes were showing up just fine when I was using the combined texture I made (look below at picture).

I'm assuming since the eyes showed fine before, there has to be a way for the blending to show them correctly. However, I have tried many scene_blend and colour_op combinations.

Does anybody else know what might be different with the material this time, causing the transparent part of the texture to do this?

--End Updated Question--

Here's what I have done so far:

  1. Create model in MakeHuman (v1.1.0) and export as .mhx2
  2. Import model in Blender (2.7) with defaults. It shows up as many meshes - each with their own material, UV map, and texture. I didn't want a bunch of materials and meshes when I export it - I just want one .mesh file for Ogre, so
  3. I used Gimp to combine all the textures into one, side by side. I then moved each mesh's UV map to correspond to the correct location on the new texture. UV Map Reassignment
  4. Just to be sure this worked, I linked every material to the same texture (the newly created one) and rendered. This worked fine.
  5. I joined all of the meshes into one to get one spread out UV map (before doing it this way I got an overlapped one, which is why I followed this procedure this time). This gave me multiple materials for the one mesh, and each material was linked to the same texture. The only differences between the different materials are their levels of ambience etc.
  6. I tried using each material for rendering(and deleting all the rest), and though some are more reflective than others, they look basically the same on rendering.

So at this point, I came to the conclusion that any material should work just fine. However, when I export to a .mesh, .material, and .skeleton file and load it into Ogre, the hair has gray streaks in the front and the eyes and eyebrows are gray. This happens no matter which material I keep and which ones I delete.

I don't know what could possibly be the problem, but all I can think is that it might be related to the way the different meshes were UV mapped.

Additional info that might help:

I also tried baking to auto-generate my texture for me. I actually tried this before just combining the textures in Gimp. When I created a new material and used texture baking(with or without UV unwrapping of different kinds), the same thing happened in Blender - the gray eyes etc but the rest rendered correctly. The weird thing is, when I made a texture using Full Render baking, the eyes actually showed up in render in Blender and in Ogre for that material. The only problem is, I can't get the right even lighting to bake. Even with a constant light source, the part of the eyes covered by eyelids (and other covered pieces) came out black on the texture.

Update:

I tried exporting a larger MakeHuman model (using inches instead of decimeters for units) and following the same steps. I now see the eyes' texture...perhaps the model was too small? the eyelashes, hair, and eyebrows show as partly gray still, and I think the problem is that in the separate materials, the eyelashes, hair and eyebrows were "invisible" materials (not sure how) and since I changed to a material that isn't, I get a gray background. I will now try messing with the settings of my material.

Second Update:

I've figured out that there are some material settings associated with Ogre that came with the Ogre exporter (ioDotScene), I had just needed to check the box to get the options (which now show up in the Options panel at the bottom of the materials tab). Now, my problem is this: I am able to export my model using alpha_blending for the scene blending, but it doesn't work. If I set the alpha to 0, my person is invisible, and with the alpha set to 1, the texture isn't see-through at all where I need it to be.

I think the reason alpha_blending won't work for me is that I can't get away with turning "depth write" off. When I do, I get a mesh that's all inside-out (I can see my person's internal mouth textures and don't see the hair or eyes).

The ONLY thing that remotely solves my problem is opening the .material file and manually entering alpha_rejection greater 64 under the line that says scene_blend alpha_blend.

Though it works, there are some problems with that solution:

  1. I don't know that the same alpha number will work every time I export a model with transparency,
  2. I don't even know how to begin to edit the export script after giving it a once-over, and
  3. alpha_rejection doesn't solve it perfectly the way I would like it to, and when I'm close to the model's eyes I can still see a little bit of gray.
$\endgroup$
2
$\begingroup$

I'm going to leave this here in case others have similar issues to the one I have faced.

Here's what I figured out to keep transparency working correctly in all textures and materials used for Ogre:

  1. Leave materials separate (or at least the ones using a texture with transparency).
  2. Enable the Ogre export tools by choosing File -> Export -> Ogre3D in Blender and checking the box in the top toolbar that says "Ogre".
  3. Go to the Object Properties of your model in Blender.
  4. Scroll to the bottom of the Materials tab with your material selected, and select alpha_blend in the drop-down menu for scene_blending. Hint: It should have one zero selected by default.
  5. Either un-check transparency or make sure it has the alpha you want your material to have(I use 1.0 for all of mine - opaque material with transparent parts).
  6. Check guru options
  7. Un-check depth write (but don't un-check depth check)
  8. Scroll to the bottom of the texture tab, with the material still selected and un-check the box to the very right of the drop-down menu that says mix. For this step I have a picture. (Look at the only box checked in the texture tab, you want to un-check that) Where to find texture alpha setting You will know you did this correctly because the text alpha_blend: should change to modulate:
    Note: Step 8 is optional and may not improve every texture you use, but it will improve some. It didn't make any of my textures look worse at all, though.
  9. Repeat steps 4-8 for each of your materials with transparency.

Note that this will completely mess your model's transparency up in Blender, so you may want to save your project beforehand if you will be using it for other engines besides Ogre. This is the only way I have found to make the settings in Blender show the correct transparency in Ogre.

If you are writing your own .material file and having problems with transparency, just remember:

  1. In the pass of your technique you will need depth_write off and scene_blend alpha_blend.
  2. Some textures may be improved by blending with the scene better if you add colour_op modulate to your texture_unit (Otherwise, you should use colour_op alpha_blend).
  3. If you are seeing your background instead of your texture, make sure in your pass you have the material's alpha set to 1.0.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.