Possible solution for RE5 character hair alpha back edges
Apr 12, 2015 14:35:30 GMT 10
George, EvilLord, and 4 more like this
Post by aman on Apr 12, 2015 14:35:30 GMT 10
There are many character mods for RE5 has hair alpha texture showing black spots or edges.
As an example, I use Jill Valentine RE3 HD by felix download from residentevilmodding.boards.net/thread/3498/resident-evil-hd-remaster. It replaces JillCos1 (pl0200.mod)
In following image the "Before" version show alpha render problem. The "After" show some improvements after some modifications to the hair mesh.
www.mediafire.com/view/uibghzj10qt1qa6/hair_compare.jpg
The fix I propose here is not a 100% fix and it may not work for other character. If you think the "after" image still not good enough then you can ignore the rest of this post.
This problem is caused by having only one single mesh for hair and this mesh contains multiple layers of hair with alpha texture. When there are multiple overlapped alpha texture layers in hair, RE5 (using Direct 3d) need to render layer from back to front order (or inside to outside) to get the correct mixture of the alpha textures. Having only one mesh for hair does not give RE5 any option to sort and render each layers in correct order.
1. Subdivide the single hair mesh into multiple mesh, based on layering of the hair pieces. First detach the outer-most hair pieces that do not overlapped each other into one mesh, then detach the hair pieces in the next layer that don't overlap each other. and continue until only the inner most layer of hair remain by itself. It is like peeling an onion , each layer become its own mesh, none of the faces in the layer overlap others. Following image shows I divided Jill's hair into 5 layers (meshes). The right-most mesh seems to have many layers but most of them are back faces of the 4 outer layers and are not visible, only the inner most layer is visible in this mesh
www.mediafire.com/view/4747k9667jy776e/hair%20layers.jpg#
2. Need to assign mesh name to these new layer meshes so that the innermost layer get render first at game time. I don;t know how RE5 decides which mesh render first so I did some trial-and-error. if the base character you replace has layered hair, it make sense to place corresponding meshes with new layer meshes based on matching positions. JillCos1 ponytail contains several meshes group in layers, but the ponytail position is much lower than RE3 Jill's hair so I cannot replace them. I end up replace JillCos1 right front hair pieces and hat with layers meshes.
Below are JillCos1 meshes to be replaced and their locations:
www.mediafire.com/view/hwje4eunk649rj5/jill%20hair.jpg#
Below are Jill RE3 HD meshes with name assigned to replace JillCos1 hair :
www.mediafire.com/view/ag5k91e2dl4y4hh/hair%20layers_replace.jpg#
With the above mesh name assignments for layered hair I exported new character over JillCos1 and run RE5TriStrip and get the "After" look.
As an example, I use Jill Valentine RE3 HD by felix download from residentevilmodding.boards.net/thread/3498/resident-evil-hd-remaster. It replaces JillCos1 (pl0200.mod)
In following image the "Before" version show alpha render problem. The "After" show some improvements after some modifications to the hair mesh.
www.mediafire.com/view/uibghzj10qt1qa6/hair_compare.jpg
The fix I propose here is not a 100% fix and it may not work for other character. If you think the "after" image still not good enough then you can ignore the rest of this post.
This problem is caused by having only one single mesh for hair and this mesh contains multiple layers of hair with alpha texture. When there are multiple overlapped alpha texture layers in hair, RE5 (using Direct 3d) need to render layer from back to front order (or inside to outside) to get the correct mixture of the alpha textures. Having only one mesh for hair does not give RE5 any option to sort and render each layers in correct order.
1. Subdivide the single hair mesh into multiple mesh, based on layering of the hair pieces. First detach the outer-most hair pieces that do not overlapped each other into one mesh, then detach the hair pieces in the next layer that don't overlap each other. and continue until only the inner most layer of hair remain by itself. It is like peeling an onion , each layer become its own mesh, none of the faces in the layer overlap others. Following image shows I divided Jill's hair into 5 layers (meshes). The right-most mesh seems to have many layers but most of them are back faces of the 4 outer layers and are not visible, only the inner most layer is visible in this mesh
www.mediafire.com/view/4747k9667jy776e/hair%20layers.jpg#
2. Need to assign mesh name to these new layer meshes so that the innermost layer get render first at game time. I don;t know how RE5 decides which mesh render first so I did some trial-and-error. if the base character you replace has layered hair, it make sense to place corresponding meshes with new layer meshes based on matching positions. JillCos1 ponytail contains several meshes group in layers, but the ponytail position is much lower than RE3 Jill's hair so I cannot replace them. I end up replace JillCos1 right front hair pieces and hat with layers meshes.
Below are JillCos1 meshes to be replaced and their locations:
www.mediafire.com/view/hwje4eunk649rj5/jill%20hair.jpg#
Below are Jill RE3 HD meshes with name assigned to replace JillCos1 hair :
www.mediafire.com/view/ag5k91e2dl4y4hh/hair%20layers_replace.jpg#
With the above mesh name assignments for layered hair I exported new character over JillCos1 and run RE5TriStrip and get the "After" look.