Repository navigation
Skewed, omni-directional and fading decals - #61
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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