# AlternativeFuta 7 — community patch: bug fixes + seam color blending Hi! I've been using AlternativeFuta 7 and ended up fixing a few bugs and building a new feature ("Seam Color Blend") on top of it. I'd like to hand the work back to you to use, adapt, or ignore as you see fit. A caveat up front: I'm an amateur, not a developer — everything here was tuned by trial and error, so please review it critically before adopting anything. All changes are contained in `Custom/Scripts/RunRudolf/AlternativeFuta/AlternativeFuta.cs` (+1720 / −38 lines vs. the .var). Attached: - `AlternativeFuta.cs` — the modified file (drop-in replacement, compiles in VaM as-is) - `AlternativeFuta_v7_to_modified.diff` — unified diff against your v7 release --- ## Part 1 — Bug fixes ### 1. Morph lookup breaks outside the .var package All bundled morphs were resolved with `GetMorphByUid($"{packagePath}Custom/.../X.vmi")`, which fails when the plugin runs as a loose install or the morphs come in via a different package version. Changed to `GetMorphByDisplayName(...)`, with a fallback for the `Pubis_Size_Z` / `Pubis Size Z` naming difference between VL_13 releases. ### 2. 'Hide Penis' morph capture/restore clobbers the character's own morphs `showHideGenital(true)` unconditionally captured the *current* morph values as the restore set. If it ran again while the override was already applied (e.g. a skin reload with Hide Penis on), the hidden-override values themselves were captured, and since `OnDestroy` restored unconditionally, removing the plugin (or reloading the scene) overwrote the character's real Penis Length / Genital Bulge / MonsPubis values with stale or default data. Older versions left this residue behind, which shows up as a body-colored mound at the crotch once 'Hide Male Pelvis' is used. Fix: - new persisted flag `hiddenMorphsApplied` (registered, `StoreType.Full`): capture only when the override is not already applied; restore only when it actually is - `CleanupStaleHiddenMorphs()` runs once on load: if Hide Penis is off but the character carries the exact override signature (MonsPubis 4.0 + Genital Bulge 2.0 + Genital Area 0.5 — two or more of the three), it clears the leftovers and logs it. ### 3. "Female Pelvis Out/In" default of 1.0 never actually worked The 1.0 default was silently zeroed on every load by the unconditional restore above, so nobody ever saw it applied. Once the restore bug was fixed, the 1.0 default started genuinely applying and bulged the hidden female pelvis out at the penis base. Default is now 0.0, with a migration that resets saved scenes still carrying exactly 1.0 from the old default. ### 4. Out-of-range vertex guards The perineum/vagina graft pins and the male AutoCollider vertex remaps are now validated against the actual mesh vertex counts (`ValidateGraftVertex` + checks in the pin loops). Out-of-range entries are skipped with a `LogError` instead of throwing mid-graft and leaving the character half-built. --- ## Part 2 — New feature: "Seam Color Blend" A toggle (with tooltips) in the main UI. Goal: hide the color discontinuity where the grafted male mesh meets the female body. When enabled it first matches the penis skin material params/color to the body, then bakes decal textures; everything is restored on toggle-off, mode change, and skin unload. **Status up front:** Mode A (pelvis visible) works well — essentially seamless. Mode B (Hide Male Pelvis) **does not work — the result is visibly broken** and I stopped there. Its code and design are included as a starting point in case any of it is useful; details under "Known limitations". ### Mode A — pelvis visible (Hide Male Pelvis OFF) A wide, soft color patch straddling the seam on both sides: - Patch color = average of the body texels the patch will cover, weighted by patch opacity and averaged in **linear** color space (gamma-space averaging comes out visibly brighter), multiplied by the material diffuse. - Graft side (GPUmaterials 29 + 30): decal painting that flat color, weight from distance to the seam verts, `pow(w, 5)` falloff, default radius 0.1 m. - Body side: the same flat color alpha-composited **over** the existing torso/genital decals with the mirrored falloff. It deliberately does not try to match textures — it spreads the transition over ~10 cm so no visible line remains. This mode looks essentially seamless. ### Mode B — Hide Male Pelvis ON (experimental, NOT working) The mesh cut ring is buried inside the body (in tests, >80% of ring vertices had no visible body vertex within 5 cm), so any distance-to-ring fade paints the wrong region. The fade is instead anchored to the **visible body surface**: - Collect visible body vertices near the graft (positions, normals, and colors sampled from the body textures at 1024), indexed in a spatial hash grid. - For each graft vertex: find the nearest visible body vertex and compute the signed distance along that vertex's normal. ≤ 0 → buried → fully painted in body color; > 0 → SmoothStep fade over "Seam Fade Range" (default 4 cm), `pow(w, 2)`. The fade therefore starts exactly where the shaft exits the body. - Painted color = inverse-distance-weighted blend of nearby body vertex colors. Per-pixel detail is preserved by modulating with `penisTexel / penisTexAverage`, so veins/wrinkles survive inside the painted zone. - The decal is stored pre-diffuse (divided by the material `_Color`, guarded) so the material tint is applied once, not twice. ### Infrastructure - Bakes are debounced (0.4 s after the last UI change) and retried up to 5× after a skin reload while textures are still loading asynchronously. - A 1 s watchdog re-applies the baked decals if VaM's material system swaps them out (this genuinely happens after async texture loads). - All params are registered for scene save/restore. ### Calibration sliders (temporary — feel free to hard-code) `Seam Patch Radius`, `Seam Fade Range`, `Seam Anchor Offset`, `Seam Color Brightness`, `Seam Surface Range` exist for visual calibration. Once you settle on values they can be constants and the sliders removed. `[AF debug]` log lines are also still in — strip at will. --- ## Known limitations / open questions 1. **Brightness 0.95.** Even with coverage-weighted, linear-space averaging, the flat painted patch renders ~5% brighter than the textured skin around it. About 1% was averaging math; the remaining ~4% appears to be lighting-driven (the flat decal responds to light differently than normal-mapped/textured skin — something texture-space math can't capture). `Seam Color Brightness` defaults to the empirically measured 0.95. If you know a shader-level explanation or fix, that would be the clean solution. 2. **Hide Male Pelvis mode is broken.** The albedo fade itself behaves as designed (the gradient starts at the shaft exit and the painted zone picks up nearby body colors), but the end result does not blend — the base of the shaft still reads as a different material and the overall look falls apart. The main identified cause is the specular/gloss/normal detail mismatch at the base, which I could not fix: fading `_SpecTex` / `_GlossTex` / `_BumpMap` of `GPUmaterials[30]` toward their own average color in a narrow band had **zero visible effect**, and even outright replacing those textures didn't seem to change rendering. (Open question: does the skin shader actually sample these properties from the GPU materials, or are they fed in from somewhere else?) Treat this whole mode as an unfinished experiment, not a shippable feature. --- Based on RunRudolf.AlternativeFuta.7. This is a hand-off as-is: I'm not planning to develop it further or provide support.