Making character render on top of another
Hi i spent a lot of time looking for an answer for this.
i am making a 2.5D fighting game and i want the character who landed the last hit to be rendered on the top of the other.
i noticed that it's been done on UE4 games like Street Fighter V and Dragon Ball FighterZ.
I tried changing the material to translucent but it flipped the character inside out. and for now i am just stuck with custom depth and post processing that's rendering solid colors and outlines in overlapped points.
asked Jan 13 '19 at 02:58 AM in Rendering
The weird look when using a translucent material is because the polygons are in a pretty much random order and thus rendered all over each other. (The classic problem with hair strips.) Depending on the art style and camera movement you might be help this by sorting the polygons in DCC, ordering them toward the camera. This is a somewhat dicey solution, especially that you'd need two versions of each character depending on which way they are facing (ie which side of them is closer to the camera.)
The next, cleaner but more performance intensive approach would be rendering only the character who landed the hit into a render target with a camera matching the game camera. Since you already figured out custom depth masking you can just replace that solid color with samples from the render target.
The most performant and robust solution would be modifying the render pipeline to support "always on top" objects but that involves a deep dive into the guts of the engine with a C++ snorkel and a lot of courage.
EDIT: The CameraOffset node in the material editor moves vertices toward the camera center so they get closer without looking different. It still has artifacts, bits disappearing sometimes. It would be perhaps the best solution if it works well enough on your assets.
Follow this question
Once you sign in you will be able to subscribe for any updates here