Optimize which surfaces are passed to lightmapper

This commit is contained in:
RaveYard 2023-09-14 12:17:33 +02:00 committed by Magnus Norddahl
commit 7cd33cc060
4 changed files with 9 additions and 1 deletions

View file

@ -93,6 +93,10 @@ struct LevelMeshSurface
int lightmapperAtlasY = -1;
};
inline float IsInFrontOfPlane(const FVector4& plane, const FVector3& point)
{
return (plane.X * point.X + plane.Y * point.Y + plane.Z * point.Z) >= plane.W;
}
struct LevelMeshSmoothingGroup
{

View file

@ -126,6 +126,9 @@ void VkLightmap::RenderAtlasImage(size_t pageIndex, const TArray<LevelMeshSurfac
if (targetSurface->lightmapperAtlasPage != pageIndex)
continue;
if (targetSurface->LightList.empty() && (targetSurface->plane.XYZ() | mesh->SunDirection) < 0.0f) // No lights, no sun //TODO fill the area with black pixels skipping blur and resolve pass
continue;
VkViewport viewport = {};
viewport.maxDepth = 1;
viewport.x = (float)targetSurface->lightmapperAtlasX - 1;