Skip to content

Forge Graphite and Rendering Improvements

date: 10/20/2026

gif

Big Update!

I spent this development session working on Forge’s editor interface and cleaning up a few rendering issues. There was no major new gameplay system this time, but I wanted to make the editor more comfortable to use and address some of the smaller problems that were getting in the way.

The biggest visible change is Forge’s new Graphite theme. I also got the camera icon rendering in the scene viewport, re-enabled VSync for both Vulkan and Metal, and spent some time investigating an annoying Vulkan transparency issue.

Stats Menu

Another area I’ve been spending quite a bit of time on is performance profiling.

One of my long-term goals for Anvil is to build an engine that can render complex environments while maintaining smooth, consistent performance. Obviously, that’s still a long way off, but I want to establish good performance practices early rather than try to fix everything later.

For a while, I was mostly relying on FPS to judge how well Anvil was performing. The problem is that FPS only tells you part of the story. It doesn’t explain why a frame took longer than expected, or which part of the engine is responsible.

That’s where the new Stats menu comes in.

Forge now has a Stats panel that displays FPS, frame time, and a breakdown of where the engine spends its time during each frame. This became very useful during tonights heavy optimization run.

The profiler tracks several major stages:

  • Input: Processing user input.
  • Updates: Updating engine systems and scene logic.
  • Rendering: Preparing the scene for rendering.
  • Editor: Processing and drawing Forge’s interface.
  • Submission: Submitting rendering commands and presenting frames.

The panel uses a visual frame-budget breakdown, making it easier to see which systems are consuming the most time.

I’m also tracking more specific operations within the Vulkan renderer, including sprite sorting, batch construction, vertex-buffer uploads, and command generation.

This has been particularly useful when finding the expensive code. Especially in the physics system and render thread.

During optimization testing, Anvil’s Play Mode performance increased from approximately 34 FPS to 100 FPS—a 194% improvement. These gains came from improvements to world-transform caching and sprite rendering, demonstrating how much performance can be recovered by addressing CPU-side rendering overhead.

Implementing sprite batching introduced an interesting challenge: reducing draw calls is only one part of improving rendering performance.

Even if the GPU receives fewer draw calls, the CPU still has to gather sprites, resolve textures, calculate transforms, sort submissions, prepare vertex data, and record commands.

Each of those operations has a cost.

The new profiling tools let me measure these operations separately rather than assuming that fewer draw calls automatically means better performance.

I’ve also been working with a rendering command queue that separates command recording and submission from other engine work.

That introduced additional things worth measuring, such as synchronization, worker-thread execution time, and the time spent waiting for rendering operations to complete.

Something I’ve been paying more attention to is frame-time consistency.

A game averaging 120 FPS can still feel unpleasant if individual frames occasionally take significantly longer than others.

At 60 FPS, the engine has approximately 16.67 milliseconds to produce each frame. At 120 FPS, that budget drops to around 8.33 milliseconds.

The goal isn’t necessarily to make every system execute as quickly as possible. It’s to understand where the time goes and make sure expensive operations don’t interfere with smooth gameplay.

The Stats panel currently uses rolling averages to make performance trends easier to interpret, although I eventually want more detailed profiling tools for identifying individual frame spikes.

This is still an early implementation of Anvil’s profiling tools.

Eventually, I’d like to expand the profiler with frame-time graphs, CPU and GPU timing, memory and VRAM usage, draw-call statistics, and potentially a proper timeline view showing how different engine systems overlap.

For now, having a clear breakdown of engine performance directly inside Forge is already a major improvement to my development workflow.

I’m trying to build Anvil around the idea that performance should be measurable from the beginning, not treated as an afterthought.

It’s one thing to build a renderer that works. It’s another to understand exactly how that renderer spends its time and how to make it better.

Graphite

Forge has been using a fairly basic dark ImGui style for a while. It worked, but I wanted something more consistent and a little more distinctive.

The new Graphite theme uses dark charcoal surfaces, subtle borders, and restrained steel-blue highlights. I also adjusted spacing, padding, and rounding so the editor feels a bit more cohesive.

One thing I wanted to preserve was the familiar axis coloring used in editing tools:

  • X is red.
  • Y is green.
  • Z will be blue when I start adding 3D transform controls.

In the Inspector, the 2D position and scale fields now have colored X and Y labels, making it easier to scan their values.

I also spent some time redesigning the component headers.

Previously, the settings button and collapsing header looked like separate rounded controls. They now share a single full-width graphite bar with sharp corners and a thin divider along the bottom.

The collapse arrow and component name sit on the left, while the ... settings button is aligned to the right.

It’s a relatively small change, but I like the cleaner separation between components. There’s still more UI work I want to do, but the Inspector is starting to look much closer to what I have in mind for Forge.

Another issue I worked on was the camera icon.

Anvil already created an editor-only SpriteRenderer for camera entities, but the scene renderer filtered sprites based on whether they were visible in-game. That meant the editor-only camera texture never made it into the quad queue.

I added a push_billboards() function to Forge’s viewport. It gathers editor-only sprites and submits their quads immediately before drawing the scene viewport:

push_billboards(scene);
Renderer2D::DrawScene(m_ViewportTarget, m_EditorCamera);

I also removed the old ImGui-drawn camera symbol while keeping the camera’s frustum outline and selection visualization.

The camera icon now renders as a texture in the scene viewport. I also fixed a capitalization mismatch in its resource path and added a fallback lookup for engine resources beside the executable.

For now, editor billboards still use SpriteRenderer. I’d eventually like to separate these from ordinary game sprites so Forge can draw camera, light, and audio icons without adding game-rendering components to those entities.

I re-enabled VSync for both rendering backends.

Vulkan now uses VK_PRESENT_MODE_FIFO_KHR, while Metal enables CAMetalLayer.displaySyncEnabled.

This should help synchronize presentation with the display. It isn’t a substitute for proper frame-time profiling or an efficient renderer, but consistent presentation is important as I continue working toward smooth performance on both backends.

The first Vulkan edit briefly broke compilation due to malformed source formatting. That was corrected before moving on.

Getting the camera icon on screen exposed another issue: on Vulkan, the transparent parts of the PNG appeared as a solid dark rectangle.

I checked the image data and ran a number of shader tests. The texture’s alpha channel was being sampled correctly, and a fragment with a constant 50% alpha blended as expected. However, using the image’s original alpha still produced the unwanted background.

Discarding pixels with exactly zero alpha removed the rectangle, while leaving the partially transparent edge pixels available for blending:

vec4 texColor = texture(spriteTexture, fragTexCoord);
if (texColor.a == 0.0)
discard;
outColor = texColor * fragColor;

That gives me a usable workaround, but I haven’t identified the underlying Vulkan rendering problem yet. I’ll revisit it when I work further on transparency and effects. Metal hasn’t shown the same issue.

I had also wanted to get started on game UI this session, but I didn’t make it that far. That’s one of the things I’d like to tackle next.

The other improvements I have in mind are separating editor billboards from game components, improving how viewport draw submissions are isolated, and continuing to refine the Inspector.

The engine already has a working 2D runtime, physics, scripting, and rendering across both backends. Lately, I’ve been spending more time on making the tools around those systems easier to work with.

That’s the direction I want to keep pushing: not just adding features to Anvil, but making it a better engine to actually build games with.