Accessing Static Light Information from C++

I made some progress on this question. It would seem I was looking at the wrong thing and conflated PrecomputedLightVolume with PrecomputedVolumetricLightmap. If you wish to access the PrecomputedLightVolume, you have to change World Settings->Lightmass->Volume Lighting Method to Sparse Volume Lighting Samples.

The following is the code to a function that should output “LightVolume not added to scene” or “VolumetricLightmap not added to scene” corresponding to the above mentioned setting.

void UTestLighting::CheckLight() {
    ULevel *Level = GetComponentLevel();
    FPrecomputedLightVolume *Volume = GetWorld()->GetCurrentLevel()->PrecomputedLightVolume;
    FPrecomputedVolumetricLightmap *VolumetricLightmap = GetWorld()->GetCurrentLevel()->PrecomputedVolumetricLightmap;

    if (!Volume) {
        UE_LOG(LogTemp, Warning, TEXT("Volume returned Null"));
        return;
    }

    if (!VolumetricLightmap) {
        UE_LOG(LogTemp, Warning, TEXT("Volumetric Lightmap returned Null"));
        return;
    }

    if (!VolumetricLightmap->IsAddedToScene()) {
        UE_LOG(LogTemp, Warning, TEXT("VolumetricLightmap not added to Scene"));
    }

    if (!Volume->IsAddedToScene()) {
        UE_LOG(LogTemp, Warning, TEXT("LightVolume not added to Scene"));
    }
}

I will continue looking into this as I believe that Volumetric Lightmaps give a better visual representation of light, however I am not currently sure how to query them for specific information at a point in world space.

I’m open to suggestions should anyone come through here and find this.

1 Like