Skip to content

Materials

HxEngine materials are master materials authored in a dedicated editor: you define parameters through the UI and write the shading in HLSL, with a live 3D preview.

A material asset describes:

  • Parameters — scalar values and texture slots, defined in the UI. The engine auto-generates the constant buffer and texture bindings for them.
  • Shading body — you write the material function in HLSL directly in the editor.
  • Includes & shader functions — reusable HLSL functions can be pulled into any material and surface in autocompletion.
  • Blend mode & feature flags — opaque / masked / translucent / additive, plus compile-time features (normal map, displacement, parallax, emissive, alpha test, two-sided, …).

The material editor embeds a code editor (built on AvaloniaEdit + TextMate) with:

  • HLSL syntax highlighting.
  • Autocomplete for HLSL keywords, engine types and your own shader-function library.
  • A live 3D preview that recompiles as you edit.
  • A read-only view of the final generated HLSL.

A material’s domain decides where and how it plugs into the renderer:

DomainUse
SurfaceStandard lit PBR geometry (deferred)
TranslucentTransparent surfaces (forward)
Subsurface / Cloth / Clear-coatSpecialised shading models
UnlitNo lighting — UI, effects
DecalProjected textures onto surfaces
Post-processA full-screen effect in the post chain

A post-process material is a material whose domain is Post-process. Instead of shading geometry, it runs as a screen-space pass in the post-processing stack — sample the scene color, depth and other buffers, and output a custom effect. It’s the same HLSL editor and parameter workflow as a surface material, so you can author bespoke screen effects without touching the renderer’s code.

A material instance overrides a master material’s parameters per object, backed by its own parameter buffer. Parameters can be changed at runtime, so materials respond to gameplay — drive a glow, a dissolve, a tint, anything your shader exposes.

MaterialAsset (master: domain + parameters + HLSL body)
└── MaterialInstance (per-object parameter overrides)
└── set dynamically at runtime