inochi2d icon indicating copy to clipboard operation
inochi2d copied to clipboard

Support treating 3D objects as 2D layers

Open LunaTheFoxgirl opened this issue 1 year ago • 0 comments

A lot of rigging in the VTuber space nowadays tries to emulate 3D using 2D, we can do better than that by allowing 3D models to be seamlessly integrated in to the Inochi2D workflow.

Some highlights of how this should be implemented for future reference

  • glTF loader that discards anything we don't need
  • We have a new 3D Root node type, which contains blendshapes and a range of 3D Object children (1 by default)
  • We have 3D Object children which contains meshes and materials, they can not be moved out of their parent 3D Root.
  • A 3D Object can be split in to a seperate object by mesh, 3D object will inherit any textures it needs to render.
  • Meshes can be moved between 3D Objects and be re-sorted in 2D.
  • Meshes will be deformed to match their 3D Root's blendshape configuration
  • 3D Objects can be used for masking and be masked by rendering them to the stencil buffer or by using the Clip To Lower blending mode.

Rendering Steps is as follows: For each 3D Object that is sorted in sequence

  1. Enable and clear depth buffer
  2. Render 3D Object(s) and their meshes
  3. Disable depth buffer and continue

Note: 3D Objects will NOT be PBR workflow, we will still take Emission and Normal Map textures from the models, but they will be used for 2D lighting.

Considerations to be made:

  1. Will we support CPU side semi-transparent triangle sorting? (Probably not)

(More will be added as I think of them)

LunaTheFoxgirl avatar Sep 16 '22 00:09 LunaTheFoxgirl