Any Git Branch have Nanite support for Masked/WPO Materials?

The maker of this video mentions that he’s downloaded a commit of the Github UE5-Main branch which has some support for WPO/Masked materials in Nanite.

I tried downloading the main branch today and it didn’t work for me. Anyone know of a branch/commit that has those features working?

do a search in the current source code for “programmable raster”.

I haven’t tried it yet (plan to though) but there’s a define called IS_NANITE_RASTER_PASS which looks like it can be set to 1 to enable it…

1 Like

Changing the above code causes the following error:

Fatal error: [File:D:\Epic Games\UnrealEngine\Engine\Source\Runtime\Engine\Private\ShaderCompiler\ShaderCompiler.cpp] [Line: 4408] 
	/Engine/Private/PixelShaderOutputCommon.ush(57,3-25):  error X3000: unrecognized identifier 'FNaniteFullscreenVSToPS'
Failed to compile default material /Engine/EngineMaterials/DefaultLightFunctionMaterial.DefaultLightFunctionMaterial!

I’m about to go down the rabbit hole to see if I can fix this… wish me luck.

1 Like

Ahhh I found where the problem is happening!

Epic hasn’t even finished the code for the PROG_RASTER in NanitVertexFactory.ush:

#if IS_NANITE_RASTER_PASS

// TODO: PROG_RASTER

struct FVertexFactoryInput
{
};

struct FVertexFactoryIntermediates
{
	float3x3 TangentToLocal;
};

FVertexFactoryIntermediates GetVertexFactoryIntermediates(FVertexFactoryInput Input)
{
	FVertexFactoryIntermediates Intermediates = (FVertexFactoryIntermediates)0;
	return Intermediates;
};

float3x3 VertexFactoryGetTangentToLocal(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates)
{
	return Intermediates.TangentToLocal;
}

FMaterialVertexParameters GetMaterialVertexParameters(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates, float3 WorldPosition, float3x3 TangentToLocal)
{
	FMaterialVertexParameters Result = (FMaterialVertexParameters)0;

	return Result;
}

#endif // IS_NANITE_RASTER_PASS

And it looks like there’s still quite a bit of work TODO to PROG_RASTER properly:

1 Like

Oh well - hopefully in an update then - good attempt anyway…

UPDATE: I tried doing this again today and it’s working out of the box!!!

1 Like

Interesting! How does it perform? Any chance of a snapshot or two?

Performs quite smoothly! I’m getting high frame rates in editor with over 100k trees, tons of grass, etc. RTX2070 LAPTOP, i7, 16Gb RAM.

Not even using imposters for the trees!

2 Likes

That’s a cool looking scene! but I can’t see any masking or translucency (maybe those trees don’t use it?) - do the trees sway in the wind?

100k is a good amount of nanite trees too - I got to about 60k on a gtx1080 so was hoping it would be around that amount on a more modern gfx card. Nice!

The trees actually have Opacity Masking AND WPO enabled :slight_smile:
image

I’m not using any billboards for them either! The grass also uses masking and WPO. And same with some of the hand railings on far away buildings.

2 Likes

Oh very cool! I’m impatient to give it a go but I promised myself I’d get some other things finished first :smiley:

I can imagine a lot of people will be very interested in this!

1 Like

Did you do anything different to get it to work? I keep getting the same crash as you with "
Fatal error: [File:E:\UnrealEngine-release\Engine\Source\Runtime\Engine\Private\ShaderCompiler\ShaderCompiler.cpp] [Line: 4408] /Engine/Private/PixelShaderOutputCommon.ush(57,3-25): "

hello, when you say it is working out of the box, does it mean it works with the 5.0.3 main release version? or you downloaded a specific branch in Github and added custom code and then compiled yourself?

I am trying to make trees nanite that have WPO and masked materials and getting this with UE5.0.3:

thank you

1 Like

I have the same problem