Render Custom Depth on Nanite enabled not working

Ok guys,

This is now solved in ue5-main branch (upcoming 5.2). I can now write to stencil buffers from Nanite in the CitySample demo.

Thanks to ZacD for pointing the correct commit that solves the issue.

I have ended up with git checking out a little newer commit from ue5-main branch, namely c825148dc6e0.

Had to solve super minor issues when building ue5-main at this commit and running it with CitySample, but it seems it works fine for me now.

Not fully set up stencil values for my case, but here all buildings, trees, cars, are Nanite (except humans as skeletal meshes).

2 Likes

I’m waiting to test nanite stencils in upcoming ue5.2

While Blueprints doesn’t allow you to change this parameter in runtime, C++ does. I ended up exposing a C++ function to Blueprints through the use of a “FunctionLibrary”.

My hightlight looks like this in blueprints. It does seem to work when I view the Nanite Visualization when hovering / unhovering.

Header

UFUNCTION(BlueprintCallable, Category = "Nanite")
static void SetDisallowNanite(UStaticMeshComponent* staticMeshComponent, bool disallow);

CPP

void UNCMethodExtensions::SetDisallowNanite(UStaticMeshComponent* staticMeshComponent, bool disallow)
{
	staticMeshComponent->bDisallowNanite = disallow;
}

Result
NaniteFix

1 Like

This works great as a work around. Can’t wait for this to work naturally again one day.

This doesn’t seem necessary anymore in 5.3