Ice Melt Race – Dynamic Shader & Segmented Physics

Heatmap RenderTexture, melting shader, and optimized segmented cable physics.

Ice Melt cover Ice Melt gameplay gif

Technical Analysis: IceMeltRace

Real‑time ice melting combining shader programming, rendering, physics simulation, and performance optimization. Players use flamethrowers to melt ice blocks into water resources while maintaining 60+ FPS.

Shader/Heatmap

// Custom Ice Shader with Real-time Heat Mapping
float4 heatData = SampleTexture2D(RenderTexture, screenUV);
float meltThreshold = 0.5;
float3 finalColor = lerp(iceColor, waterColor, heatData.r);
float alpha = step(meltThreshold, heatData.r);
public class HeatmapPainter : MonoBehaviour {
    public RenderTexture heatmap; public Material drawMat;
    public void Paint(Vector2 uv, float radius, float power){
        RenderTexture active = RenderTexture.active; RenderTexture.active = heatmap;
        GL.PushMatrix(); GL.LoadOrtho(); drawMat.SetVector("_Center", new Vector4(uv.x, uv.y, radius, power));
        // Draw full-screen quad, shader writes falloff around uv
        Graphics.Blit(null, heatmap, drawMat);
        GL.PopMatrix(); RenderTexture.active = active;
    }
}

Modular Grid Architecture

// Procedural Ice Block Generation
for (int i = 0; i < widthObject; i++) {
    for (int j = 0; j < heightObject; j++) {
        Vector3 position = CalculateGridPosition(i, j);
        GameObject iceBlock = InstantiateIceBlock(position);
        ConfigurePhysicsAndNavigation(iceBlock);
    }
}

Scalable grid where blocks melt independently and auto‑regenerate after 10 seconds.

Visual Animation Pipelining

// Cascading Scale Animation
void Animate() {
    for (int i = 0; i < cableSegments.Length; i++) {
        LeanTween.scale(cableSegments[i].transform.GetChild(0).gameObject, 
                       Vector3.one * 1.3f, 0.3f)
                .setFrom(Vector3.one * 0.9f)
                .setEaseOutSine()
                .setLoopPingPong()
                .setDelay(i * 0.05f); // Staggered animation
    }
}

Collision Detection

// Collision Detection Mode Management
if (i != 0 && i != (segmentsQuantity - 1)) {
    rb.collisionDetectionMode = CollisionDetectionMode.ContinuousSpeculative;
}
// Only middle segments use expensive collision detection

Intelligent Object Pooling

// Threshold-Based Effect Spawning
Game_.instance.particle_.countToSpawnParticle++;
if (countToSpawnParticle >= 10) {
    LeanPool.Spawn(waterPuddleFx, position, rotation);
    countToSpawnParticle = 0;
}

Cable System Architecture

Segmented physics chain with 20+ segments (Rigidbody + CapsuleCollider), ConfigurableJoints, alternating materials, and proper collision layers.

public void ConnectCable(bool startSegment, Transform newTransform) {
    AwakeRigidbodies(); // Activate physics
    int id = startSegment ? 0 : cableSegments.Length - 1;
    cableSegments[id].GetComponent<Rigidbody>().isKinematic = true;
    cableSegments[id].transform.parent = newTransform;
    
    // Smooth connection animation
    LeanTween.moveLocal(cableSegments[id].gameObject, Vector3.zero, 0.2f);
    LeanTween.rotateLocal(cableSegments[id].gameObject, Vector3.zero, 0.2f);
}

Bidirectional resource flow (fuel forward, water backward), particle jets, 3D spatial audio, smart auto‑disconnect.

Technical Metrics and Results

  • GPU: 256² heatmap updates in < 0.2 ms.
  • CPU: Segmented cable < 0.3 ms/frame, no GC spikes.
  • Visual: Smooth melting with predictable behavior, no popping.