It is possible to create a layered morphed mesh system in Unreal Engine 4 (UE4) that uses ray-casting to find the overlapping meshes and prevent clipping. To do this, you would need to create a number of layers of morphed meshes, with each layer representing a different part of the body or clothing. You would then need to use ray-casting to find the overlapping meshes and adjust the weights of the layers accordingly.
To create a layered morphed mesh system, you would first need to create a base mesh for each layer. The base mesh should be a simplified version of the mesh that you want to morph. Once you have created the base meshes, you would need to create a morph target for each layer. The morph target should represent the desired deformation of the mesh.
Once you have created the morph targets, you would need to create a blend shape for each layer. The blend shape should blend between the base mesh and the morph target. Once you have created the blend shapes, you would need to assign them to a material.
To use ray-casting to find the overlapping meshes, you would need to create a ray cast for each layer. The ray cast should start at the camera and end at the surface of the mesh. If the ray cast hits the surface of the mesh, then you can assume that the mesh is overlapping the layer.
Once you have found the overlapping meshes, you need to adjust the weights of the layers accordingly. For example, if the arm mesh is overlapping the torso mesh, then you would need to reduce the weight of the arm mesh on the areas where it is overlapping the torso mesh.
You can use a variety of methods to adjust the weights of the layers. For example, you could use a weight map or you could use a skeletal mesh.
Here is a more detailed explanation of each step involved in creating a layered morphed mesh system in UE4 that uses ray-casting to prevent clipping:
- Create a base mesh for each layer. The base mesh should be a simplified version of the mesh that you want to morph.
- Create a morph target for each layer. The morph target should represent the desired deformation of the mesh.
- Create a blend shape for each layer. The blend shape should blend between the base mesh and the morph target.
- Assign the blend shapes to a material.
- Create a ray cast for each layer. The ray cast should start at the camera and end at the surface of the mesh.
- Find the overlapping meshes. If the ray cast hits the surface of the mesh, then you can assume that the mesh is overlapping the layer.
- Adjust the weights of the layers accordingly. For example, if the arm mesh is overlapping the torso mesh, then you would need to reduce the weight of the arm mesh on the areas where it is overlapping the torso mesh.
You can use this system to create a variety of different layered morphed mesh systems, such as a clothing system or a character customization system.
Here are some additional tips for creating a layered morphed mesh system in UE4:
- Use a reference skeleton to ensure that the meshes are deformed correctly.
- Test the system in different poses to identify any potential clipping issues.
- Use a mirror to check for clipping.
- Use a variety of methods to adjust the weights of the layers, such as weight maps or skeletal meshes.
now what these methods are i havent figured it out yet.