Changed body proportions: Torso, Chest, Waist

Body proportions have been changed: - Torso length is now the base value, replacing waist length in earlier versions.
- Hip length is now waist distance. Waist distance is only used when using a hip tracker
- Chest distance/length is the same. It is only used when using a chest tracker
- Autobone support with any mix-n-match configuration :)
- Virtual Waist changed its name to "Hip offset". It still behaves the same.
This commit is contained in:
Louka committed 2021-11-23 15:11:16 -05:00
1 parent f46f2bc913
commit 259190e478
7 files changed
+124 -111

No files matched your search

@@ -62,7 +62,7 @@ public class AutoBone {
// Assume these to be approximately half
public float kneeLegRatio = 0.5f;
public float chestWaistRatio = 0.5f;
public float chestHipRatio = 0.5f;
protected final VRServer server;
@@ -72,7 +72,7 @@ public class AutoBone {
public final HashMap<String, Float> configs = new HashMap<String, Float>();
public final HashMap<String, Float> staticConfigs = new HashMap<String, Float>();
public final FastList<String> heightConfigs = new FastList<String>(new String[]{"Neck", "Waist", "Hip", "Legs length"});
public final FastList<String> heightConfigs = new FastList<String>(new String[]{"Neck", "Torso", "Legs length"});
public AutoBone(VRServer server) {
this.server = server;
@@ -87,10 +87,10 @@ public class AutoBone {
}
public void reloadConfigValues(TrackerFrame[] frame) {
// Load waist configs
// Load torso configs
staticConfigs.put("Head", server.config.getFloat("body.headShift", HumanSkeletonWithWaist.HEAD_SHIFT_DEFAULT));
staticConfigs.put("Neck", server.config.getFloat("body.neckLength", HumanSkeletonWithWaist.NECK_LENGTH_DEFAULT));
configs.put("Waist", server.config.getFloat("body.waistDistance", 0.6f));
configs.put("Torso", server.config.getFloat("body.torsoLength", 0.7f));
if(server.config.getBoolean("autobone.forceChestTracker", false) || (frame != null && TrackerUtils.findTrackerForBodyPosition(frame, TrackerPosition.CHEST) != null) || TrackerUtils.findTrackerForBodyPosition(server.getAllTrackers(), TrackerPosition.CHEST) != null) {
// If force enabled or has a chest tracker
configs.put("Chest", server.config.getFloat("body.chestDistance", 0.35f));
@@ -101,11 +101,11 @@ public class AutoBone {
}
if(server.config.getBoolean("autobone.forceHipTracker", false) || (frame != null && TrackerUtils.findTrackerForBodyPosition(frame, TrackerPosition.HIP) != null) || TrackerUtils.findTrackerForBodyPosition(server.getAllTrackers(), TrackerPosition.HIP) != null) {
// If force enabled or has a hip tracker
configs.put("Hip", server.config.getFloat("body.hipDistance", 0.1f));
configs.put("Waist", server.config.getFloat("body.waistDistance", 0.1f));
} else {
// Otherwise, make sure it's not used
configs.remove("Hip");
staticConfigs.put("Hip", server.config.getFloat("body.hipDistance", 0.1f));
configs.remove("Waist");
staticConfigs.put("Waist", server.config.getFloat("body.waistDistance", 0.1f));
}
// Load leg configs
@@ -156,7 +156,7 @@ public class AutoBone {
setConfig("Neck", "body.neckLength");
setConfig("Waist", "body.waistDistance");
setConfig("Chest", "body.chestDistance");
setConfig("Hip", "body.hipDistance");
setConfig("Torso", "body.torsoLength");
setConfig("Hips width", "body.hipsWidth");
setConfig("Legs length", "body.legsLength");
setConfig("Knee height", "body.kneeHeight");
@@ -400,12 +400,12 @@ public class AutoBone {
protected float getProportionErrorDeriv(SimpleSkeleton skeleton) {
Float neckLength = skeleton.getSkeletonConfig("Neck");
Float chestLength = skeleton.getSkeletonConfig("Chest");
Float waistLength = skeleton.getSkeletonConfig("Waist");
Float torsoLength = skeleton.getSkeletonConfig("Torso");
Float legsLength = skeleton.getSkeletonConfig("Legs length");
Float kneeHeight = skeleton.getSkeletonConfig("Knee height");
float chestWaist = chestLength != null && waistLength != null ? Math.abs((chestLength / waistLength) - chestWaistRatio) : 0f;
float legBody = legsLength != null && waistLength != null && neckLength != null ? Math.abs((legsLength / (waistLength + neckLength)) - legBodyRatio) : 0f;
float chestHip = chestLength != null && torsoLength != null ? Math.abs((chestLength / torsoLength) - chestHipRatio) : 0f;
float legBody = legsLength != null && torsoLength != null && neckLength != null ? Math.abs((legsLength / (torsoLength + neckLength)) - legBodyRatio) : 0f;
float kneeLeg = kneeHeight != null && legsLength != null ? Math.abs((kneeHeight / legsLength) - kneeLegRatio) : 0f;
if(legBody <= legBodyRatioRange) {
@@ -414,7 +414,7 @@ public class AutoBone {
legBody -= legBodyRatioRange;
}
return (chestWaist + legBody + kneeLeg) / 3f;
return (chestHip + legBody + kneeLeg) / 3f;
}
// The distance of any points to the corresponding absolute position
@@ -25,15 +25,18 @@ public class SimpleSkeleton {
protected final TransformNode chestNode = new TransformNode("Chest", false);
protected final TransformNode hipNode = new TransformNode("Hip", false);
/**
* Distance from shoulders to chest
*/
protected float chestDistance = 0.35f;
/**
* Distance from eyes to waist
* Distance from hip to waist
*/
protected float waistDistance = 0.6f;
protected float waistDistance = 0.1f;
/**
* Distance from waist to hip
* Distance from shoulder to hip
*/
protected float hipDistance = 0.1f;
protected float torsoLength = 0.7f;
/**
* Distance from eyes to the base of the neck
*/
@@ -81,10 +84,10 @@ public class SimpleSkeleton {
chestNode.localTransform.setTranslation(0, -chestDistance, 0);
chestNode.attachChild(waistNode);
waistNode.localTransform.setTranslation(0, -(waistDistance - chestDistance), 0);
waistNode.localTransform.setTranslation(0, (chestDistance - torsoLength + waistDistance), 0);
waistNode.attachChild(hipNode);
hipNode.localTransform.setTranslation(0, -hipDistance, 0);
hipNode.localTransform.setTranslation(0, -waistDistance, 0);
// Assemble skeleton to feet
hipNode.attachChild(leftHipNode);
@@ -222,26 +225,27 @@ public class SimpleSkeleton {
neckNode.update();
}
break;
case "Waist":
waistDistance = newLength;
waistNode.localTransform.setTranslation(0, -(waistDistance - chestDistance), 0);
case "Torso":
torsoLength = newLength;
waistNode.localTransform.setTranslation(0, (chestDistance - torsoLength + waistDistance), 0);
if(updatePose) {
waistNode.update();
hipNode.update();
}
break;
case "Chest":
chestDistance = newLength;
chestNode.localTransform.setTranslation(0, -chestDistance, 0);
waistNode.localTransform.setTranslation(0, -(waistDistance - chestDistance), 0);
waistNode.localTransform.setTranslation(0, (chestDistance - torsoLength + waistDistance), 0);
if(updatePose) {
chestNode.update();
}
break;
case "Hip":
hipDistance = newLength;
hipNode.localTransform.setTranslation(0, -hipDistance, 0);
case "Waist":
waistDistance = newLength;
waistNode.localTransform.setTranslation(0, (chestDistance - torsoLength + waistDistance), 0);
hipNode.localTransform.setTranslation(0, -waistDistance, 0);
if(updatePose) {
hipNode.update();
waistNode.update();
}
break;
case "Hips width":
@@ -282,12 +286,12 @@ public class SimpleSkeleton {
return headShift;
case "Neck":
return neckLength;
case "Torso":
return torsoLength;
case "Waist":
return waistDistance;
case "Chest":
return chestDistance;
case "Hip":
return hipDistance;
case "Hips width":
return hipsWidth;
case "Knee height":
@@ -360,7 +364,7 @@ public class SimpleSkeleton {
config.setProperty("body.neckLength", neckLength);
config.setProperty("body.waistDistance", waistDistance);
config.setProperty("body.chestDistance", chestDistance);
config.setProperty("body.hipDistance", hipDistance);
config.setProperty("body.torsoLength", torsoLength);
// Save leg configs
config.setProperty("body.hipsWidth", hipsWidth);
@@ -4632,7 +4632,7 @@ public final class ProtobufMessages {
}
private com.google.protobuf.MapField<java.lang.String, java.lang.String>
internalGetMutableExtra() {
onChanged();;
onChanged();
if (extra_ == null) {
extra_ = com.google.protobuf.MapField.newMapField(
ExtraDefaultEntryHolder.defaultEntry);
@@ -5099,7 +5099,7 @@ public final class ProtobufMessages {
public int getNumber() {
return this.value;
}
};
}
@Override
public MessageCase
@@ -5791,7 +5791,7 @@ public final class ProtobufMessages {
message_ = null;
}
messageCase_ = 1;
onChanged();;
onChanged();
return positionBuilder_;
}
@@ -5932,7 +5932,7 @@ public final class ProtobufMessages {
message_ = null;
}
messageCase_ = 2;
onChanged();;
onChanged();
return userActionBuilder_;
}
@@ -6073,7 +6073,7 @@ public final class ProtobufMessages {
message_ = null;
}
messageCase_ = 3;
onChanged();;
onChanged();
return trackerAddedBuilder_;
}
@@ -6214,7 +6214,7 @@ public final class ProtobufMessages {
message_ = null;
}
messageCase_ = 4;
onChanged();;
onChanged();
return trackerStatusBuilder_;
}
@java.lang.Override
@@ -340,21 +340,20 @@ public class AutoBoneWindow extends JFrame {
//#region Stats/Values
Float neckLength = autoBone.getConfig("Neck");
Float chestLength = autoBone.getConfig("Chest");
Float waistLength = autoBone.getConfig("Waist");
Float hipLength = autoBone.getConfig("Hip");
Float chestDistance = autoBone.getConfig("Chest");
Float torsoLength = autoBone.getConfig("Torso");
Float hipWidth = autoBone.getConfig("Hips width");
Float legsLength = autoBone.getConfig("Legs length");
Float kneeHeight = autoBone.getConfig("Knee height");
float neckWaist = neckLength != null && waistLength != null ? neckLength / waistLength : 0f;
float chestWaist = chestLength != null && waistLength != null ? chestLength / waistLength : 0f;
float hipWaist = hipWidth != null && waistLength != null ? hipWidth / waistLength : 0f;
float legWaist = legsLength != null && waistLength != null ? legsLength / waistLength : 0f;
float legBody = legsLength != null && waistLength != null && neckLength != null ? legsLength / (waistLength + neckLength) : 0f;
float neckHip = neckLength != null && torsoLength != null ? neckLength / torsoLength : 0f;
float chestHip = chestDistance != null && torsoLength != null ? chestDistance / torsoLength : 0f;
float hipWaist = hipWidth != null && torsoLength != null ? hipWidth / torsoLength : 0f;
float legWaist = legsLength != null && torsoLength != null ? legsLength / torsoLength : 0f;
float legBody = legsLength != null && torsoLength != null && neckLength != null ? legsLength / (torsoLength + neckLength) : 0f;
float kneeLeg = kneeHeight != null && legsLength != null ? kneeHeight / legsLength : 0f;
LogManager.log.info("[AutoBone] Ratios: [{Neck-Waist: " + StringUtils.prettyNumber(neckWaist) + "}, {Chest-Waist: " + StringUtils.prettyNumber(chestWaist) + "}, {Hip-Waist: " + StringUtils.prettyNumber(hipWaist) + "}, {Leg-Waist: " + StringUtils.prettyNumber(legWaist) + "}, {Leg-Body: " + StringUtils.prettyNumber(legBody) + "}, {Knee-Leg: " + StringUtils.prettyNumber(kneeLeg) + "}]");
LogManager.log.info("[AutoBone] Ratios: [{Neck-Hip: " + StringUtils.prettyNumber(neckHip) + "}, {Chest-Hip: " + StringUtils.prettyNumber(chestHip) + "}, {Hip-Waist: " + StringUtils.prettyNumber(hipWaist) + "}, {Leg-Hip: " + StringUtils.prettyNumber(legWaist) + "}, {Leg-Body: " + StringUtils.prettyNumber(legBody) + "}, {Knee-Leg: " + StringUtils.prettyNumber(kneeLeg) + "}]");
String lengthsString = getLengthsString();
LogManager.log.info("[AutoBone] Length values: " + lengthsString);
@@ -103,25 +103,25 @@ public class SkeletonConfig extends EJBagNoStretch {
}}, s(c(4, row, 2), 3, 1));
row++;
add(new JLabel("Chest"), c(0, row, 2));
add(new JLabel("Torso length"), c(0, row, 2));
add(new AdjButton("+", "Torso", 0.01f), c(1, row, 2));
add(new SkeletonLabel("Torso"), c(2, row, 2));
add(new AdjButton("-", "Torso", -0.01f), c(3, row, 2));
add(new TimedResetButton("Reset", "Torso"), c(4, row, 2));
row++;
add(new JLabel("Chest distance"), c(0, row, 2));
add(new AdjButton("+", "Chest", 0.01f), c(1, row, 2));
add(new SkeletonLabel("Chest"), c(2, row, 2));
add(new AdjButton("-", "Chest", -0.01f), c(3, row, 2));
add(new ResetButton("Reset", "Chest"), c(4, row, 2));
row++;
add(new JLabel("Waist"), c(0, row, 2));
add(new JLabel("Waist distance"), c(0, row, 2));
add(new AdjButton("+", "Waist", 0.01f), c(1, row, 2));
add(new SkeletonLabel("Waist"), c(2, row, 2));
add(new AdjButton("-", "Waist", -0.01f), c(3, row, 2));
add(new TimedResetButton("Reset", "Waist"), c(4, row, 2));
row++;
add(new JLabel("Hip"), c(0, row, 2));
add(new AdjButton("+", "Hip", 0.01f), c(1, row, 2));
add(new SkeletonLabel("Hip"), c(2, row, 2));
add(new AdjButton("-", "Hip", -0.01f), c(3, row, 2));
add(new ResetButton("Reset", "Hip"), c(4, row, 2));
add(new ResetButton("Reset", "Waist"), c(4, row, 2));
row++;
add(new JLabel("Hips width"), c(0, row, 2));
@@ -142,7 +142,7 @@ public class SkeletonConfig extends EJBagNoStretch {
add(new AdjButton("+", "Knee height", 0.01f), c(1, row, 2));
add(new SkeletonLabel("Knee height"), c(2, row, 2));
add(new AdjButton("-", "Knee height", -0.01f), c(3, row, 2));
add(new TimedResetButton("Reset", "Knee height"), c(4, row, 2));
add(new ResetButton("Reset", "Knee height"), c(4, row, 2));
row++;
add(new JLabel("Foot length"), c(0, row, 2));
@@ -152,13 +152,6 @@ public class SkeletonConfig extends EJBagNoStretch {
add(new ResetButton("Reset", "Foot length"), c(4, row, 2));
row++;
add(new JLabel("Foot offset"), c(0, row, 2));
add(new AdjButton("+", "Foot offset", 0.01f), c(1, row, 2));
add(new SkeletonLabel("Foot offset"), c(2, row, 2));
add(new AdjButton("-", "Foot offset", -0.01f), c(3, row, 2));
add(new ResetButton("Reset", "Foot offset"), c(4, row, 2));
row++;
add(new JLabel("Head offset"), c(0, row, 2));
add(new AdjButton("+", "Head", 0.01f), c(1, row, 2));
add(new SkeletonLabel("Head"), c(2, row, 2));
@@ -173,11 +166,18 @@ public class SkeletonConfig extends EJBagNoStretch {
add(new ResetButton("Reset", "Neck"), c(4, row, 2));
row++;
add(new JLabel("Virtual waist"), c(0, row, 2));
add(new AdjButton("+", "Virtual waist", 0.01f), c(1, row, 2));
add(new SkeletonLabel("Virtual waist"), c(2, row, 2));
add(new AdjButton("-", "Virtual waist", -0.01f), c(3, row, 2));
add(new ResetButton("Reset", "Virtual waist"), c(4, row, 2));
add(new JLabel("Hip offset"), c(0, row, 2));
add(new AdjButton("+", "Hip offset", 0.01f), c(1, row, 2));
add(new SkeletonLabel("Hip offset"), c(2, row, 2));
add(new AdjButton("-", "Hip offset", -0.01f), c(3, row, 2));
add(new ResetButton("Reset", "Hip offset"), c(4, row, 2));
row++;
add(new JLabel("Foot offset"), c(0, row, 2));
add(new AdjButton("+", "Foot offset", 0.01f), c(1, row, 2));
add(new SkeletonLabel("Foot offset"), c(2, row, 2));
add(new AdjButton("-", "Foot offset", -0.01f), c(3, row, 2));
add(new ResetButton("Reset", "Foot offset"), c(4, row, 2));
row++;
gui.refresh();