MontyTRC89 / TombEngine

A new custom Tomb Raider engine based on TR5 engine
60 stars 16 forks source link

Skinned meshes #1218

Open Adngel opened 9 months ago

Adngel commented 9 months ago

Feature: Adding new skinned meshes to TEN engine

Descriptions:

The objective of this project is to introduce skinned meshes into the TEN engine, enhancing character models' realism and animation quality. Unlike traditional models (with the skin joints method), skinned meshes allow for better blending and more natural animations, as seen in the upcoming Tomb Raider remaster.

Comparison (images from the future Tomb Raider 1,2,3 remaster)

An idea to accomplish this, we would have to work on different areas: TEN code, Shaders, WadTool and Tomb Editor.

TEN Engine

Shaders

WadTool

This should be critical for the resource management. Ideally, these new system should be adapted to can be imported using the existing WadTool. There may be many ways to do it. The idea I propose is create a new layer for the existing objects to separate the animation skeleton from the rendered model. (But using still the same object slot).

Currently, Lara uses different slots some for her animations, and others for her outfits (SKIN, SKIN_JOINTS, HAIR). Using this method for every enemy or item in the game, could make things very long lists and ardous.

So implementing a layer system could organize and simplify options for the users

Also each layer could have import/export options related to them (so we can clean the crowded population of buttons in the interface).

Tomb Editor

Motivation:

Key Considerations:

Plan Overview

1. Update Item Structures

2. Skinned Mesh Class

3. Renderer Integration

4. Level Flow load

5. Vertex Shader

6. WadTool Update

7. Tomb Editor Update

Diagrams

Loading

2

Drawing Flow

3

WadTool

4 5 6

Lwmte commented 9 months ago

Several ideas from me:

1) Skinned mesh should be a separate category in Wad2, so that several objects may refer to the same skinned mesh. This will allow to easily attach same skinned meshes to different objects. Also in final compiled level, skinned meshes should be also kept separately from actual objects. This will allow to easily swap skinned meshes in runtime and somehow replicate old meshswap workflow.

2) There should be no separate skinned mesh editor. Original mesh editor should be just extended with a toolset to edit vertex weights.

3) boneWeights should actually be std::vector<std::map<BoneIndex, Weight>>.

4) Good question about bone mutators - should they affect skinned mesh at all? At first stage, I think we can ignore that, because mutators are usually used with detached meshes, such as rolling wheels, stretching spikes, etc. Later we can think how to adapt mutators to a skinned mesh too.