Displacement map prototype (#26709)

Requires https://github.com/space-wizards/RobustToolbox/pull/5023

This uses the new engine features (above) to add a displacement map shader. This allows deforming a sprite based on another sprite.

Primary use case is automatically adapting human clothing sprites to different species, something we want to make species like Vox a reality.

A basic example of wiring this up with Vox has been added. The system is however incredibly simple and **will** need more work by a content developer to select and toggle displacement maps when appropriate. I am leaving that to somebody else. For example right now the displacement map is applied even if a species already has custom-fit sprites for a piece of clothing, such as the grey jumpsuit for Vox.

Basic Aseprite plugins to help with authoring displacement maps have also been made.
This commit is contained in:
Pieter-Jan Briers
2024-04-27 08:03:58 +02:00
committed by GitHub
parent b4212a08f4
commit 2f7d0dedbd
9 changed files with 303 additions and 1 deletions

View File

@@ -16,6 +16,17 @@
#- type: VoxAccent # Not yet coded
- type: Inventory
speciesId: vox
jumpsuitShader: DisplacedStencilDraw
displacements:
jumpsuit:
layer:
sprite: Mobs/Species/Vox/displacement.rsi
state: jumpsuit
copyToShaderParameters:
# Value required, provide a dummy. Gets overridden when applied.
layerKey: dummy
parameterTexture: displacementMap
parameterUV: displacementUV
- type: Speech
speechVerb: Vox
speechSounds: Vox

View File

@@ -0,0 +1,10 @@
- type: shader
id: DisplacedStencilDraw
kind: source
path: "/Textures/Shaders/displacement.swsl"
stencil:
ref: 1
op: Keep
func: NotEqual
params:
displacementSize: 127