Full body line censoring shader
#1
Filter Guide

This post includes three main body-line clipping filters: V2.1, V3, and V3.1.

They are listed in order:
V2.1 → V3 → V3.1

What these filters actually are

All three filters are built around Godot shader logic, color-space matching, nearby-pixel checks, and short-range region filling.

They are NOT true body-part recognition models.

That means if some small or awkward exposed body parts are still missed, it is mostly because this setup is already reaching the practical limit of Godot-side heuristic detection and the recognition method used here — not because of one tiny coding mistake or one small threshold being wrong.

So if a version still misses a small exposed detail, especially under:
  • heavy stylization
  • dark shading
  • compression
  • unusual colors
  • difficult poses
  • black clothing near skin
  • pink or red backgrounds

that is mainly an engine / recognition limitation, not just a bug.

Custom Body Line Clipping V2.1
Best for: strong and simple overall censor coverage

V2.1 is the most direct and aggressive version of the three.
It focuses on broad body-line clipping and usually gives the strongest first-pass coverage.

This is the best choice if the goal is to catch as much as possible quickly.
The tradeoff is that it can be rougher and less precise in difficult scenes.

Use this if:
  • broad censor coverage matters more than precision
  • a simpler version is preferred as a starting point
  • the content does not have too many difficult shadows or confusing background colors

Custom Body Line Clipping V3
Best for: better handling of shadowed skin and more stable body continuity

V3 improves on V2.1 by adding better support for darker or shadowed body regions and more controlled local expansion.

In practice, it usually holds body areas together better when lighting gets weird or when skin tones shift into darker purple or low-light colors.

Use this if:
  • V2.1 misses shadowed or darker body regions
  • a better balance between coverage and control is needed
  • the scene has more difficult lighting or color variation

Custom Body Line Clipping V3.1
Best for: the most refined balance between coverage and precision

V3.1 is the most advanced and most refined version of the three.
It is designed to be more careful about when and where it expands the censor region.

In practice, this is usually the best balance between:
  • catching important exposed areas
  • avoiding unnecessary spreading into unrelated shapes

Use this if:
  • the most polished version is wanted
  • the best balance between precision and body-part coverage is needed
  • harder scenes are being tested and less unnecessary spreading is preferred

Which one should be used?

Simple rule:
  • Start with V2.1 if the goal is the strongest and simplest broad coverage
  • Move to V3 if V2.1 misses body areas under dark or difficult lighting
  • Use V3.1 if the goal is the most refined overall balance

Important limitation

These filters do NOT actually understand anatomy the way a trained segmentation or body-part detection model would.

They work by estimating likely regions from:
  • color
  • shading
  • nearby pixels
  • local support and short-range connection logic

So edge cases will always exist.

Small missing body-part censoring can still happen, especially with:
  • stylized anime art
  • strong shading
  • compression
  • unusual color grading
  • black clothing near skin
  • pink/red backgrounds
  • tiny exposed details

At this point, further improvement would likely require moving beyond pure Godot shader heuristics into a more advanced recognition or segmentation pipeline.

Quick usage note

The screenshot above shows a short guide for how to stack and use the filters.

The three body-line clipping filters included here are:
  1. Custom Body Line Clipping V2.1
  2. Custom Body Line Clipping V3
  3. Custom Body Line Clipping V3.1

Choose the one that fits the scene best, then combine it with Censor/Repeated Text as needed.
Some cheap talks
This is inspired from endofbeen, I'm studying embedded system and actually have some free time so I decided to make it in 2 hours.

                   
.zip   clipping.zip (Size: 44.35 KB / Downloads: 409)
  Reply
#2
Update on the bodyline clipping censor shader

I managed to get the shader much closer to what I wanted. The current version is a lightweight single-pass bodyline clipping shader. It samples the current screen, detects exposed skin/body-like pixels, and lets the censor show only through those areas.

The shader is still not perfect, but the current version is a big improvement over my earlier attempts.

Pros / what works well now:
  • Much faster than my older v3.1/v3.4 attempts. The current version only uses center + 4-neighbor sampling instead of a heavier 8-neighbor/bridge setup.
  • The skin scoring is shared in one function, so it avoids recalculating a lot of color logic multiple times.
  • Clothing clipping is much better now. Black clothing, dark straps, wings, hair, and accessories are less likely to be swallowed by the censor.
  • Background clipping is also much better. It no longer blindly censors large chunks of the background like my first version did.
  • It has a saturated red/pink detail detector, so it can catch exposed areas that normal skin-color detection misses.
  • It also has a red-cloth rejection pass to reduce false positives on red skirts, red fabric, and saturated clothing.
  • The shader has debug views for checking body score, hot/saturated score, neutral/background rejection, and red-cloth rejection.
  • It does not need machine learning, CPU image processing, or a separate segmentation mask. It is just a canvas_item shader.

Known flaws / current limitations:
  • Bright scenes are still the hardest case. Pale skin, white clothing, beige walls, bloom, and overexposed lighting can become very similar in color space. In those cases the censor can still come out looking square.
  • Character lighting affects detection a lot. Strong blue, red, purple, or green lighting can push skin outside the expected color range, so the shader can either miss skin or censor too much.
  • Red clothing is still difficult. The shader has a red-cloth rejector, but red/pink exposed detail and red fabric are very close in color. Tuning this is a tradeoff: stricter red rejection protects skirts/clothes, but can miss saturated exposed detail.
  • The shader is color-based, not true body segmentation. It does not understand anatomy or body shape. It only guesses from color, brightness, saturation, YCbCr-like values, and local neighbor support.
  • If the censor rectangle is too small and its edge crosses the body, the shader can still reveal the rectangle edge. The censor area needs to be larger than the body part, then the shader hides the excess.
  • There is still a possible “floating layer” or ghosting issue in restore-layer mode. This is not really a skin-detection flaw. It happens because the shader copies CurrentScreenTexture back onto the screen for non-skin pixels. If that texture is one frame delayed, it draws an old copy of the character over the current frame.

Important note about the layer glitch:

The shader has two possible output styles.

Restore-layer mode:
  • skin = transparent, censor below shows
  • non-skin = copied screen texture

This matches my original v2/v3.4 pipeline, but it can ghost if CurrentScreenTexture is delayed.

Direct censor mode:
  • skin = draw censor
  • non-skin = transparent

This should remove the ghosting because it no longer redraws the captured screen texture. But it requires a different setup: the shader has to be placed directly on the censor node, and the sampled CurrentScreenTexture must be a clean pre-censor same-frame texture.

The shader is now fast and usable, and it handles clothing/background much better than before. The remaining problems are mostly edge cases: bright scenes, red clothing, colored lighting, and the screen-texture timing issue. The biggest remaining technical problem is the layer ghosting, which likely needs a pipeline/render-order fix rather than more skin-detection math. This is my absolute best attempt, to balance out skin vs background blending. It can only be better if hotscreen itself improves.
[Image: tNPnKdg.png]
       

.zip   Custom Body Line Clipping3.4L.zip (Size: 14.32 KB / Downloads: 144)
  Reply
#3
Early impression is this seems to work a lot better compared to earlier versions <3
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)