Hi,
We are seeing assert failures inside the VT system due to an off by one error in FVirtualTextureCollectionResource::InitRHI when using UVirtualTextureCollection.
It seems the code assigns ProducerDesc.MaxLevel to be the count instead of the max level. Changing the code to this
ProducerDesc.MaxLevel = FMath::Max(MaxVirtualMipCount, 1u) - 1;
seems to solve the issue.
Thanks,
Lucas
[Attachment Removed]
Steps to Reproduce
Create a UVirtualTextureCollection and assign a 1024x1024 texture. Observe the following assert hits
Assertion failed: InDesc.MaxLevel <= FMath::CeilLogTwo(FMath::Max(ProducerWidth, ProducerHeight)) [File:X:\J\Engine\Source\Runtime\Renderer\Private\VT\VirtualTextureProducer.cpp] [Line: 63]
UnrealEditor_Core!FDebug::CheckVerifyFailedImpl2()
UnrealEditor_Renderer!FVirtualTextureProducerCollection::RegisterProducer()
UnrealEditor_Renderer!FVirtualTextureSystem::RegisterProducer()
UnrealEditor_Renderer!FRendererModule::RegisterVirtualTextureProducer()
UnrealEditor_Engine!FVirtualTextureCollectionResource::InitRHI()
UnrealEditor_RenderCore!FRenderResource::InitResource()
UnrealEditor_RenderCore!ExecuteCommand()
UnrealEditor_RenderCore!UE::RenderCommandPipe::FCommandList::ConsumeCommands<`FRenderThreadCommandPipe::ExecuteCommands'::`2'::<lambda_1> >()
UnrealEditor_RenderCore!`FRenderThreadCommandPipe::EnqueueAndLaunch'::`5'::<lambda_1>::operator()()
UnrealEditor_RenderCore!TGraphTask<TFunctionGraphTaskImpl<void __cdecl(void),1> >::ExecuteTask()
UnrealEditor_Core!UE::Tasks::Private::FTaskBase::TryExecuteTask()
UnrealEditor_Core!FNamedTaskThread::ProcessTasksNamedThread()
UnrealEditor_Core!FNamedTaskThread::ProcessTasksUntilQuit()
UnrealEditor_RenderCore!RenderingThreadMain()
UnrealEditor_RenderCore!FRenderingThread::Run()
UnrealEditor_Core!FRunnableThreadWin::Run()
[Attachment Removed]
Hi Lucas,
Thanks for calling this out. The fix seems reasonable, but we addressed this issue by reworking the texture packing logic for Virtual Texture collections in 5.8. The CL with the change is 53920109 in UE5-Main. You can either upgrade to 5.8 or look to backport the change if you need it in 5.7. Let me know if that helps.
Cheers,
Tim
[Attachment Removed]
No problem! If there are no further questions, I will close out the ticket. Let me know if that’s ok with you
[Attachment Removed]
Thanks for the pointer to the CL! We are looking to upgrade to 5.8 so I’ll check it out.
[Attachment Removed]