Shapes IM and Unity 2023.3

Avatar
  • updated

Is Shapes not compatible with Unity 2023.3 yet? I can't seem to get immediate mode drawing to work. I see nothing in the frame debugger and the console has the following error produced every frame

"RecordRenderGraph is not implemented, the pass Shapes.ShapesRenderPass won't be recorded in the current RenderGraph."

Adding shapes to the scene works. Just immediate mode rendering doesn't seem to work.

Reporting a bug? please specify Unity version:
2023.3.0b6
Reporting a bug? please specify Shapes version:
4.3.1
Reporting a bug? please specify Render Pipeline:
URP
Avatar
Freya Holmér creator
Quote from adam reed

I am having a similiar issue with 2023.2.20f1 in HDRP. Immediate mode does not render lines, and there are no errors on the console. If I remove Shapes then reimport, IM draw calls work, IF I do not run the script to convert Shapes to HDRP.

What is the lastest version of Unity that Shapes supports?

Usually I always ensure it's stable on the latest LTS, so, 2022.3 at the moment, but for the next update I'll try and get support in for the latest (non-alpha/beta) tech stream release, which would be unity 6

Avatar
adam reed

I am having a similiar issue with 2023.2.20f1 in HDRP. Immediate mode does not render lines, and there are no errors on the console. If I remove Shapes then reimport, IM draw calls work, IF I do not run the script to convert Shapes to HDRP.

What is the lastest version of Unity that Shapes supports?

Avatar
manik bhat

Any updates on when this will be resolved? Using Immediate mode is my main use case so hoping for a fix to come soon. 

Avatar
Freya Holmér creator

thanks for looking into this yall <3 I'll push a proper fix for the next update

Avatar
james billy

Just wanted to comment to say that this issue still occurs in all Unity versions past 2023.3 and makes IM mode non-functional out of the box. The fix suggested by Scott Daley seems to work perfectly.

Avatar
Scott Daley

I managed to get Shapes working in 2023.3.0b10 with minimal changes:

// Added to ShapesRenderPass.cs

private class PassData { }
public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData)
{
using IUnsafeRenderGraphBuilder builder = renderGraph.AddUnsafePass<PassData>("Render Shapes", out _);
builder.AllowPassCulling(false);
builder.SetRenderFunc(
(PassData _, UnsafeGraphContext context) =>
{
CommandBuffer unsafeCmd = CommandBufferHelpers.GetNativeCommandBuffer(context.cmd);
drawCommand.AppendToBuffer(unsafeCmd);
}
);
}

This is very similar to what Patrick did above, but with the following changes:

  • builder.AllowPassCulling(false) : This fixes the "BeginRenderPass: Already inside a Renderpass ..." error
  • Instead of modifying DrawCommand to work with a RasterCommandBuffer, I added an "unsafe" pass so that it could continue using a normal CommandBuffer. This was only to reduce the amount of code changes needed. But I think adding a raster pass would be the more "correct" way from what I've read in the RenderGraph docs.
Avatar
Patrick Hogan

I did a little digging and found the problem. As of Unity 2023.3.0a18, in new projects, Render Graph in URP is now enabled by default. There is still a compatibility mode that can be turned on in Project Settings > Graphics > Render Graph Settings, which I turned on and that works for the time being.


It comes with a warning: "Unity no longer develops or improves the rendering path that does not use Render Graph API. Use the Render Graph API when developing new graphics features."


So, it seems ShapesRenderPass will require some modification. Execute() is deprecated and there's a new method RecordRenderGraph().


I made a brief foray into writing the modification, but my knowledge of render passes is very limited and it doesn't appear to be a straightforward conversion.

This is what I tried:

class PassData {}
public override void RecordRenderGraph( RenderGraph renderGraph, ContextContainer frameData )
{
using var builder = renderGraph.AddRasterRenderPass<PassData>( "Render Shapes", out _ );
builder.SetRenderFunc( ( PassData _, RasterGraphContext context ) =>
{
drawCommand.AppendToBuffer( context.cmd ); // modified to take a RasterCommandBuffer
} ); }

This compiles, but produces execution errors along the lines of "BeginRenderPass: Already inside a Renderpass ..." at which point I was out of my depth and gave up. ¯\_(ツ)_/¯

Avatar
Freya Holmér creator

does the Shapes settings window say anything about a faulty URP install?