hi friends, I try to add some “post process” into lightmap after the lightmaps are baked.
however, I encountered some problems at the veryfirst step:
UStaticMeshComponent *umc = it->FindComponentByClass<UStaticMeshComponent>();
const FMeshMapBuildData* MeshMapBuildData = umc->GetMeshMapBuildData(umc->LODData[0]);
if (MeshMapBuildData != nullptr)
{
FLightMap2D *LightMap2D = MeshMapBuildData->LightMap->GetLightMap2D();
if (LightMap2D != nullptr)
{
UTexture2D *RealTexture2D = LightMap2D->GetTexture(1); // get the low quality
FTexture2DMipMap *ZeroMipMap = &RealTexture2D->PlatformData->Mips[0];
FByteBulkData *RawData = &ZeroMipMap->BulkData;
if (RawData->GetElementCount() > 0)
{ // this ElementCound is always 0
The Elementcount of bulkdata is always 0, it is true that lightmaps are not cpu-readable, so I cannot read the values and modify it (like darken a part of it) ?