Skip to content

Morph targets #74

@LocalInsomniac

Description

@LocalInsomniac

Implement morph targets similarly to Source Engine's Flex animation by cloning a model's vertex buffers (instancing) and using vertex_update_buffer_from_buffer() on them to lerp from base flex to target flexes when needed.

This would be difficult to implement mainly because ModelInstances are supposed to be fully garbage collectable and the workflow would be very inefficient - models would need to be exported and converted into BBMOD files for each morph and a new tool would need to be implemented to calculate deltas of vertex positions and normals (maybe even tangents!?) on each vertex buffer from base BBMOD to target BBMOD and output them.

If implemented, ModelInstance would receive a new method morph(name, value) with the following behaviour:

  • On first call, clones the Model's vertex buffers (and stores the weak reference of the ModelInstance somewhere in order automatically destroy the buffers on GC).
  • Updates a morph struct containing the value of each morph target defined in a Model.
  • Use vertex_update_buffer_from_buffer() on every cloned vertex buffer that is affected by the specified morph.
  • (OPTIONAL) clear_morphs() would get rid of the cloned vertex buffers and all other morph information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthyperspeculatoryBrainstorming, unlikely to be implementedvisualGraphics and/or audio-related issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions