AnyPortrait > Manual > Not rendered Clipped Meshes

Not rendered Clipped Meshes


1.4.6

One of the most common inquiries our team has received from users is "Clipping meshes are not rendering properly".
Rendering problems are not easy to troubleshoot because even seemingly identical problems can have different causes.
For issues with clipping meshes, different causes can cause the same issue.
This page introduces typical causes and solutions based on user feedback.




This is the character used on this page.
The eye and mouth meshes are set as clipping meshes.




Incorrect Render Pipeline settings


This is mostly the case when using URP, or when restoring to Built-In Render Pipeline.




It is set to URP in Project Settings > Graphics > Scriptable Render Pipeline Settings in Unity Editor.
After setting it to URP, use the Material Library to apply the material for URP. (Related page)




Bake and run the game, but clipping meshes are not rendered.




This is most likely caused by the Render Pipeline settings not matching the current project settings.
(1) Press the Bake button in the AnyPortrait editor.
(2) Select the Setting tab.
(3) Check if the Render Pipeline settings match the settings of the current project.
In the case of URP, it should be set to Scriptable Render Pipeline, and if you use the default render pipeline, it should be set to Default.




If you Bake and run the game, you can see that the clipping meshes are rendered normally.




When there are 2 or more cameras




(1) Let's configure the scene to have two cameras that render characters.
As above, you can see that one character is rendered twice by two cameras.




If you run the game in this state, clipping meshes will not be rendered normally for cameras other than one.


AnyPortrait's clipping mesh references the properties of the camera to create an optimized mask using a Render Texture of moderate resolution.
However, if more than one camera is trying to render a character, the optimization of the clipping mask is malfunctioning.


In order to solve this problem, you have to use VR support function which is a somewhat unexpected option.
VR is basically a two-camera system, and it's just like this case, so it's an appropriate solution.
(You can read more about VR support at the Related page.)




(1) Open the Bake dialog.
(2) Select the Setting tab.
(3) Change the VR / Multi-Camera option value to Multiple Cameras.


Now run Bake and the problem is solved.
Unfortunately, in this state, optimization of the clipping mesh is disabled.
Therefore, the problem of lowering the rendering quality due to the lower resolution clipping mask occurs.




(1) Select Mesh Group.
(2) Select a mesh to be the clipping mask.
(3) Increase the resolution of the clipping mask by changing the value of the Mask Texture Size property.
It should be decided according to the size and quality of the displayed mesh, but when optimization is off, 512 or 1024 is better in terms of quality.




If you Bake and run the game, you can see the clipping mesh is working properly.






Script execution order is not appropriate


AnyPortrait's clipping mask is calculated by how it will be drawn during the update routine.
That calculation references camera and character positions, attributes, etc.
If the states of related elements when calculating the mask in the update and when actually rendering do not match, there is a possibility that the clipping mask and mesh may not be rendered properly.
Many users experience this problem when using Cinemachine, UniTask, Naninovel, etc.


There is a separate manual dealing with this issue, you can refer to it.
- Execution order problem with assets