arkavo-org / arkavo-org/VRMMetalKit

Enhance gravity formula to handle magnitude independently

Open
#52 0 comments 0 reactions 0 assignees View on GitHub
enhancement low
Dominant language
Swift
Stars
6
Forks
2
Avg merge
18h 51m
Merged PRs (30d)
26

Description

## Description

Currently, the per-joint gravity calculation multiplies global gravity by power and direction:

```metal
float3 effectiveGravity = globalParams.gravity * boneParams[id].gravityPower * boneParams[id].gravityDir;
```

This means `gravityDir` affects both direction AND magnitude. A more flexible approach would separate magnitude from direction.

## Proposed Enhancement

```metal
float gravityMagnitude = length(globalParams.gravity);
float3 effectiveGravity = gravityMagnitude * boneParams[id].gravityPower * boneParams[id].gravityDir;
```

## Benefits

- More intuitive: `gravityDir` only controls direction (normalized vector)
- Clearer separation of concerns
- Easier to understand and tune

## Scope

- Update `SpringBonePredict.metal` shader
- Update documentation
- Add tests for edge cases (zero magnitude, etc.)

## Priority

Low - Current implementation is correct, this is an enhancement for clarity

## Related

PR #51 - Implement per-joint gravity for cloth and hair physics

Contributor guide

Open the contributing guide

Research direction

Start with SpringBonePredict.metal and inspect the existing per-joint gravity calculation. Update the shader so gravity magnitude and direction are handled independently, then add coverage for zero-magnitude and related edge cases. Update the documentation described in the issue and verify the tests pass.

Written by the indexing model from the issue text.

Assessment

Domain
computer-graphics
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.