mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-06-24 00:39:30 +08:00
simplify comments
This commit is contained in:
parent
e8908c0f69
commit
017abfdb28
@ -78,12 +78,8 @@ def _build_specs_from_pose(
|
||||
return rgb
|
||||
return rgb * (1.0 - pastel) + pastel
|
||||
|
||||
# SCAIL drops the 4 face bones (13..16: nose↔eyes, eyes→ears) — in the
|
||||
# reference, NLF leaves those COCO slots at zero so its `sum==0` skip
|
||||
# silently culls them. The grey neck limb (12) blends spine direction
|
||||
# (mid-hip → neck, stable) with the neck→nose direction at 60/40 so
|
||||
# the stub tracks head pose lightly without flapping around like full
|
||||
# nose direction does.
|
||||
# SCAIL skips face bones (13..16) and redirects limb 12 into a short
|
||||
# head stub blending spine + neck→nose direction.
|
||||
body_limb_count = 13 if palette == "scail" else len(OPENPOSE_18_PAIRS)
|
||||
body_kp = kp_cam[OPENPOSE18_TO_MHR70]
|
||||
spine_dir = None
|
||||
@ -302,10 +298,7 @@ def _render_capsules_torch(
|
||||
normals = normals / normals.norm(dim=-1, keepdim=True).clamp(min=1e-8)
|
||||
|
||||
col = colors[m_h, :3]
|
||||
# SCAIL shading (render_torch.py:290-331). Light from camera (+Z toward
|
||||
# subject); diffuse term `N·-L` simplifies to `-N.z`. Specular uses the
|
||||
# proper Blinn-Phong half-vector `(view + (-L))` — using `diff` as a
|
||||
# shortcut would lock the highlight to image center.
|
||||
# SCAIL Blinn-Phong (render_torch.py:290-331). Headlight: light = +Z.
|
||||
diff = torch.clamp(-(normals[:, 2]), min=0.0)
|
||||
diffuse = 0.45 + 0.55 * diff
|
||||
|
||||
@ -315,9 +308,7 @@ def _render_capsules_torch(
|
||||
half_dir = half_dir / half_dir.norm(dim=-1, keepdim=True).clamp(min=1e-8)
|
||||
spec = torch.clamp((normals * half_dir).sum(dim=-1), min=0.0).pow(32)
|
||||
|
||||
# SCAIL's reference depth fade uses mm-scale constants (`z_max + 6000`)
|
||||
# that translate to almost no fade in our meter units — `depth_factor`
|
||||
# stays ~0.85-1.0. Matching that with a mild ramp.
|
||||
# Mild depth fade matches SCAIL's mm-scale ramp in our meter units.
|
||||
z_vals = p_hit[:, 2]
|
||||
z_lo, z_hi = float(z_vals.min().item()), float(z_vals.max().item())
|
||||
if z_hi - z_lo > 1e-6:
|
||||
|
||||
@ -128,11 +128,8 @@ def render_pose_data_openpose(
|
||||
`composite='over'` paints over `background` (else black canvas).
|
||||
`hand_marker_radius_px` / `hand_stick_width_px`: 0 = auto = 0.7x / 0.5x
|
||||
of the body sizes.
|
||||
`face_style`: 'disabled' = no face dots, 'full' = all face landmarks
|
||||
(prefers sapiens-238 if present, else rig-fallback ~30), 'eyes_mouth' =
|
||||
rig-fallback subset (~12 dots: eyes + mouth only). The subset only has a
|
||||
documented layout for the rig fallback so eyes_mouth always uses it,
|
||||
regardless of whether sapiens-238 is available.
|
||||
`face_style`: 'disabled' / 'full' / 'eyes_mouth'. eyes_mouth falls through
|
||||
to the rig fallback since sapiens-238 has no documented subset.
|
||||
`person_brightness_falloff` mixes each person's drawn pixels toward white
|
||||
by `1 - falloff^k` (track 0 stays vivid). Applied post-draw so per-limb
|
||||
alpha blending against the existing canvas remains correct.
|
||||
@ -154,15 +151,11 @@ def render_pose_data_openpose(
|
||||
if int(hand_stick_width_px) <= 0:
|
||||
hand_stick_width_px = max(1, int(round(stick_width_px * 0.5)))
|
||||
|
||||
# Eyes+mouth indices into the rig fallback (FACE_LANDMARK_TARGETS): 6..13
|
||||
# = both eyes, 19..22 = outer-lip ring. Brows/nose/chin/jaw are dropped.
|
||||
_EYES_MOUTH_IDX = np.array([6, 7, 8, 9, 10, 11, 12, 13, 19, 20, 21, 22], dtype=np.int64)
|
||||
|
||||
include_face = face_style != "disabled"
|
||||
use_rig_only = face_style == "eyes_mouth"
|
||||
|
||||
# Real 238 sapiens face KPs take priority for 'full'; 'eyes_mouth' always
|
||||
# falls through to the rig path since sapiens has no documented subset.
|
||||
face_vert_ids: Optional[np.ndarray] = None
|
||||
if include_face:
|
||||
any_real = (not use_rig_only) and any(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user