Skip to content

Skewed, omni-directional and fading decals - #61

Merged
LogicalError merged 3 commits into
RadicalCSG:mainfrom
LogicalError:decal-skew-omni-fade
Oct 25, 2026
Merged

LogicalError merged 3 commits into
RadicalCSG:mainfrom
LogicalError:decal-skew-omni-fade

Conversation

@LogicalError

@LogicalError LogicalError commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Three decal features, a commit each.

Skewed decals (#34): a Skew setting shears the decal about its origin, in degrees (x leans the image's sides, y its top and bottom), so its image frame is a parallelogram. The shear goes into the decal's matrix, so the volume, bounds and image mapping follow it; the gizmo and box handle are drawn sheared.

Omni-directional decals (#33): a new Omni projection places a decal the way Source's infodecal does: every surface it reaches takes the whole image, laid flat on it round the point nearest the decal's center and turned with the surface's texture. Size X and Y are the image, Z the reach: a sphere's diameter or the edge of a cube turned with the decal. Each surface gets an orthographic volume of its own, so cutting and image coordinates are those of box decals.

Fade distances (#35): a transparent decal can fade between a start and an end distance from the camera (at a 60 degree field of view); opaque decals don't fade, since they replace the surface below. A fading decal is a mesh and renderer of its own, cross-faded by a LODGroup. Its material's shader has to support LOD cross-fading, as URP's Lit does, with LOD Cross Fade on in the pipeline asset.

Fixes #33, fixes #34, fixes #35

ChiselDecalSettings.skew shears the decal about its origin, in degrees (x leans
the image's sides, y its top and bottom), so its image frame is a parallelogram.
The shear goes into the decal's matrix: the volume's planes, bounds and image
mapping follow it. The inspector has a Skew field; the gizmo and box handle are
drawn sheared.

Fixes #34
ChiselDecalProjection.Omni places a decal the way Source's infodecal does: every
surface it reaches takes the whole image, laid flat on it round the point
nearest the decal's center and turned with the surface's texture (its u). Size
X and Y are the image, Z the reach: the diameter of a sphere, or the edge of a
cube turned with the decal (ChiselDecalSettings.reach). A surface is reached
when its plane passes within that and faces the center.

Each surface gets an orthographic volume of its own (DecalVolume.OnSurface)
in GenerateSurfaceTrianglesJob, so cutting and image coordinates are those of
box decals. The inspector shows Reach instead of Max Angle, and no skew or
repeats; the gizmo shows the sphere or cube.

Fixes #33
ChiselDecalSettings.fadeDistance: a transparent decal starts to fade at x from
the camera and is gone at y (at a 60 degree field of view); opaque decals don't
fade, since they replace the surface below. A fading decal's pieces are a mesh
of their own (ChiselDecalMeshes.FadeChunkOf its entity), and ChiselDecalFades
gives that renderer a LODGroup that cross-fades it between the two distances,
sized to its mesh. Its material's shader has to support LOD cross-fading, as
URP's Lit does. The inspector shows Fade Distance for transparent decals.

Fixes #35
@LogicalError
LogicalError merged commit 5a07526 into RadicalCSG:main Oct 25, 2026
2 checks passed
@LogicalError
LogicalError deleted the decal-skew-omni-fade branch October 25, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decal fade distances Skewed decals Omni directional decals

1 participant