// Emissive-Gloam SKINNED — the deformation-aware variant of ProjectM/EmissiveGloam for // glow pieces that live on a Rukhanka-animated SkinnedMeshRenderer (suit porthole glass, // shoulder-lamp lens). Same ontology contract as the master: hue = warm(ours)/cold(gloam), // _FlickerAmount 0 = STEADY (true light). Vertexes are deformed through Rukhanka's // ComputeDeformedVertex include (the same entry the AnimatedLitShader subgraph uses), so the // glow rides the rig under Entities Graphics. Requires DOTS instancing (BRG-only, like all // EG-skinned materials: renders in the baked ECS world, not in a plain classic scene). // GOTCHAS (learned 07-16): (1) the UNITY_DOTS_INSTANCING_START block MUST precede the // ComputeDeformedVertex include — its UNITY_ACCESS_DOTS_INSTANCED_PROP expands at include time; // (2) _DeformedMeshIndex must ALSO exist in the Properties block — Rukhanka's SkinnedMeshBaker // validates material.HasProperty("_DeformedMeshIndex") and logs "does not support skinning" otherwise. Shader "ProjectM/EmissiveGloamSkinned" { Properties { [HDR] _EmissionColor ("Emission (HDR)", Color) = (2.0, 1.4, 0.55, 1) _FlickerAmount ("Flicker Amount (0=steady/true, 1=false)", Range(0,1)) = 0.0 _FlickerSpeed ("Flicker Speed", Float) = 6.0 _Seed ("Per-material phase seed", Float) = 0.0 [HideInInspector] _DeformedMeshIndex ("Deformed Mesh Index", Float) = 0 } SubShader { Tags { "RenderType"="Opaque" "RenderPipeline"="UniversalPipeline" "Queue"="Geometry" } Pass { Name "EmissiveGloamSkinnedUnlit" Tags { "LightMode"="UniversalForward" } HLSLPROGRAM #pragma target 4.5 #pragma vertex vert #pragma fragment frag #pragma multi_compile _ DOTS_INSTANCING_ON #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" CBUFFER_START(UnityPerMaterial) half4 _EmissionColor; half _FlickerAmount; half _FlickerSpeed; half _Seed; CBUFFER_END // MUST precede the Rukhanka include: its UNITY_ACCESS_DOTS_INSTANCED_PROP(_DeformedMeshIndex) // expands where the include is parsed. #ifdef UNITY_DOTS_INSTANCING_ENABLED UNITY_DOTS_INSTANCING_START(MaterialPropertyMetadata) UNITY_DOTS_INSTANCED_PROP(float, _DeformedMeshIndex) UNITY_DOTS_INSTANCING_END(MaterialPropertyMetadata) #endif #include "Packages/com.rukhanka.animation/Rukhanka.Runtime/Deformation/Resources/ComputeDeformedVertex.hlsl" struct Attributes { float4 positionOS : POSITION; float3 normalOS : NORMAL; uint vertexID : SV_VertexID; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct Varyings { float4 positionHCS : SV_POSITION; }; Varyings vert (Attributes IN) { UNITY_SETUP_INSTANCE_ID(IN); float3 dpos = IN.positionOS.xyz; float3 dnrm = IN.normalOS; float3 dtan = float3(1, 0, 0); ComputeDeformedVertex_float(IN.vertexID, IN.positionOS.xyz, IN.normalOS, dtan, dpos, dnrm, dtan); Varyings OUT; OUT.positionHCS = TransformObjectToHClip(dpos); return OUT; } half4 frag (Varyings IN) : SV_Target { float t = _Time.y * _FlickerSpeed + _Seed; float wave = 0.6 * sin(t) + 0.4 * sin(t * 2.37 + 1.3); float f = 1.0 - _FlickerAmount * (0.5 - 0.5 * wave); return half4(_EmissionColor.rgb * f, 1.0); } ENDHLSL } } Fallback Off }