Skip to main content

Handling Object Scaling in LCK Camera Rendering

Goal

You need to scale up the quality of an object ie: your player avatar’s, specifically for LCK camera rendering.

Background

LCK cameras use command buffers for rendering, which execute asynchronously on the GPU. This means traditional pre/post render events won’t work reliably for immediate mesh modifications, as the GPU commands may execute at different times than your CPU-side scaling operations.

Solutions

Recommended: Use Separate Render Layers

The simplest and most reliable approach is to create a duplicate object setup:
  1. Create a second copy of your object with the scaled object
  2. Configure this copy to be visible only on a specific render layer
  3. Set your LCK cameras to render this layer
  4. Keep your original object on a different layer for normal gameplay
Advantages:
  • No timing issues with GPU command buffers
  • Clean separation between gameplay and capture rendering
  • Works consistently across different rendering pipelines

Alternative: Command Buffers

If you need a more dynamic solution, you can use Command Buffers:
// Add command buffer before rendering

camera.AddCommandBuffer(CameraEvent.BeforeForwardOpaque, myCommandBuffer);
Note: This approach requires careful GPU-side handling and may involve custom shader work, especially when dealing with skinned mesh bones.

Alternative: URP Render Features

If you’re using Unity’s Universal Render Pipeline (URP), consider implementing a custom Render Feature to handle the scaling at the rendering pipeline level.

What Doesn’t Work

  • Events before/after frame capture: These fire at the wrong time relative to GPU command buffer execution
  • Direct pre/post render callbacks: LCK rendering happens asynchronously via command buffers
  • Synchronous mesh modifications: GPU timing makes this unreliable

Additional Context

LCK cameras don’t expose fine-grained render events (like pre/post render texture rendering) because the actual rendering happens through Unity’s command buffer system, which is designed for GPU efficiency rather than CPU-side callbacks.