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.
Master materials
Section titled “Master materials”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 HLSL editor
Section titled “The HLSL editor”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.
Material domains
Section titled “Material domains”A material’s domain decides where and how it plugs into the renderer:
| Domain | Use |
|---|---|
| Surface | Standard lit PBR geometry (deferred) |
| Translucent | Transparent surfaces (forward) |
| Subsurface / Cloth / Clear-coat | Specialised shading models |
| Unlit | No lighting — UI, effects |
| Decal | Projected textures onto surfaces |
| Post-process | A full-screen effect in the post chain |
Post-process materials
Section titled “Post-process materials”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.
Material instances & dynamic parameters
Section titled “Material instances & dynamic parameters”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