Phase 6 updates

Phase 6 · Slice 63 ·

Shader Graph

  • .shadergraph files (Shader Graph 10 and later: multi-JSON) are project shaders named "Shader Graphs/<file name>", as Unity names them (materials by GUID, Shader.Find, Resources). tassix_shaderlab::graph translates one to ShaderLab with Tassix's own HLSL for each node, written from what the nodes are documented to do: the graph's properties (Properties block and UnityPerMaterial), keywords (shader_feature/multi_compile, local or global, boolean and enum), one pass for its URP target (Unlit, Lit through UniversalFragmentPBR, Fullscreen through the full-screen triangle), its vertex blocks (position, normal, tangent) and fragment blocks (base color, alpha and clip threshold; normal, metallic, smoothness, emission, occlusion for Lit), and the render state (surface type, blending, render face, depth, or the material's _Cull/_SrcBlend/_DstBlend/_ZWrite/_ZTest when the graph allows overrides).
  • Dynamic vectors resolve as Shader Graph's do (the narrowest connected input wider than one; scalars spread), sub-graphs become functions (one per dropdown choice and set of connected inputs, for Branch On Input Connection), and custom function nodes call their HLSL (a file's, by GUID, or the node's own body) with Shader Graph's texture and sampler structs. About eighty node types: math, vectors, properties, inputs (position, normal, tangent, view direction in each space, UV, vertex color, screen position kinds, time, object, camera, fog, baked GI), textures (Sample Texture 2D and LOD, triplanar, tiling and offset), keywords, dropdowns, scene depth and color, URP Sample Buffer's blit source, transforms, hue and colorspace conversion.
  • URP's light-layer, shadow-mask and baked-GI mixing functions and the additional lights' arrays are in the pipeline includes (custom lighting reads them).
  • The script host finds sub-graphs and HLSL files by GUID from the project's .meta files. Graphs that fail (older formats, unsupported nodes or targets) warn and draw as Standard, as before.
  • The Platformer template's Toon and ToonGridRepeating graphs (custom toon lighting through eleven sub-graphs) and Nitrate's film and silhouette graphs draw. Checked by translates_and_compiles_a_graph, compiles_corpus_graphs (ignored: needs the corpus) and shader_graphs_draw_as_project_shaders.
  • Not yet: graphs from before Shader Graph 10, the Sprite and Decal targets, gradients, noise nodes, matrices, fog in project shaders, shadow casters for graph materials.
  • Next: SSAO.