public record class TexturedMaterialLayersFeatureN metal-roughness layers whose weights are painted rather than authored: a splat map.
Remarks
What makes a painted layer stack shippable as a live material. MaterialLayersFeature's remarks say where the weights come from is the caller's business — and no caller supplied one, so a ten-layer stack with painted masks was expressible only as the images it evaluates to. This is the feature that reads the mask at the point being shaded instead. See doc 48 § B1, which named the gap.
⚠ Four layers per map, because a splat map has four channels — R, G, B and A are layers 0 to 3 and a fifth layer's painted weight is zero, which is the same ceiling TerrainSplat.LayersPerWeightMap works to. A stack deeper than four wants a second map, and that is a second feature rather than a wider one: this feature holds one name and a table keyed by one name cannot hold two.
⚠ And the fourth channel has to be declared — see PaintedChannels. A one- or three-channel texture samples alpha as 1, so a fourth layer weighted by the alpha of an RGB splat map is weighted 1 everywhere, and the normalisation then makes that layer the whole surface. Three is the default and the compiler warns about a layer past it, which turns the widest wrong picture this feature can draw into a message somebody reads.
⚠ Weight survives, and it is a scale on the painted channel rather than the weight itself. One is the map exactly, which is why the layers a caller builds should carry one; zero disables a layer wherever it was painted, which is what an author toggling a layer off wants and is the reason the constant was not dropped.
LayerCount is a permutation, as it is on MaterialLayersFeature and for the same reason: a two-layer material's constant buffer holds two layers rather than the most anyone might use. ⚠ Raven resolves a permutation by name across the whole compilation, so this shader and MaterialLayersFeature's share one LayerCount — which is right, they are the same knob, and it is why a material carrying both would have to agree with itself about the count.
Same conditions as every other sampling feature: a name rather than a handle, a device with HasBindless, and a host that paired the name through MaterialRenderFeature.TextureIndices. ⚠ And one more that the others do not have — a host that registered LayerCount in MaterialRenderFeature.PermutationKeys, without which the count set here reaches no compiler and every layered material draws the shader's declared two.
⚠ Two maps, not one — see HeightBlended. The second is doc 48 § B1's height map in the only one of its three readings that is a surface feature, it is off by default, and its own key HeightBlended has to be registered beside the count.
Fields and properties (9)
public MaterialLayerValue[] LayersThe layers, innermost first. Layer i is painted by the map's ith channel.
public string SplatMapWhat the material calls the splat map its weights are painted in.
public int PaintedChannelsHow many of the splat map's channels carry a painted weight.
public bool HeightBlendedWhether a second map's per-layer heights decide which layer shows at a seam.
public string HeightMapWhat the material calls the per-layer height map. Channel i is layer i.
public float HeightContrastHow far a full-height texel can push a layer, in splat-weight units.
public float HeightTransitionHow wide the transition between two competing layers is, in the same units.
public string ShaderNameThe Raven shader implementing this feature, from Raven/Library/Material.
public bool IsBaseSurface
Methods (3)
public static string SplatIndexParameter(string path)What the shader calls the slot, under a composition path.
public static string HeightIndexParameter(string path)What the shader calls the height map's slot, under a composition path.
public void Compile(MaterialCompilationContext context)Writes this feature's parameters, and fills any slots of its own.
Used by (15)
- PaintedLayersTestsThirdPersonShooter.Frame.Tests
- LayeredMaterialImageTestsVixen.Graphics.Golden.Tests
- MaterialBaseSurfaceTestsVixen.Rendering.Tests
- MaterialCompilerTestsVixen.Rendering.Tests
- MaterialSurfaceVixen.Rendering
- MaterialSurfaceTestsVixen.Rendering.Tests
- TexturedMaterialTestsVixen.Rendering.Tests
- TypeRegistrationVixen.Rendering
- Vixen_Rendering_Materials_TexturedMaterialLayersFeatureSerializerVixen.Rendering
- WorldRendererVixen.Engine.Renderer
- MaterialBakeVixen.Editor.Assets
- MaterialBakeTestsVixen.Editor.Assets.Tests
- MaterialMapNamingVixen.Editor.Assets
- MaterialSplatTestsVixen.Editor.Assets.Tests
- SplatBakeDeviceTestsVixen.Editor.Texturing.Tests