Overriding Volumetric Lightmap for Select Meshes in UE4 for Standalone VR

I’m trying to figure out how to override the volumetric lightmap for certain meshes.
We have a moving spaceship and dynamic meshes in the spaceship are getting the volumetric lighting from the space environment. This is for standalone VR so dynamic lighting isn’t a solution, and we want to keep volumetric lighting enabled elsewhere in the level.

The best solution I can think of is modifying the engine source, but that’s turning out to be quite complicated. If anyone can think of a simpler solution that would be great.

I’m considering just using an unlit material with fake lighting but then the meshes won’t react to movable lights. But if I can’t figure this out we’ll probably have to do that.

I’ve attempted to add a shader parameter to control the override. However, the OverrideVolumetricLightmap parameter isn’t being recognized correctly in the shader – it always evaluates to false.

LocalVertexFactory.h:
Added LAYOUT_FIELD(FShaderParameter, OverrideVolumetricLightmap);

LocalVertexFactory.cpp:

void FLocalVertexFactoryShaderParametersBase::Bind(const FShaderParameterMap& ParameterMap)
{
	OverrideVolumetricLightmap.Bind(ParameterMap, TEXT("OverrideVolumetricLightmap"), SPF_Optional);
	UE_LOG(LogTemp, Warning, TEXT("OverrideVolumetricLightmap is bound: %s"), OverrideVolumetricLightmap.IsBound() ? TEXT("True") : TEXT("False"));
// this is always false
}

void FLocalVertexFactoryShaderParametersBase::GetElementShaderBindingsBase(...) {
...

	ShaderBindings.Add(OverrideVolumetricLightmap, true); //set to true for testing
}


void FLocalVertexFactory::ModifyCompilationEnvironment(...) {
...
	OutEnvironment.SetDefine(TEXT("OVERRIDE_VOLUMETRIC_LIGHTMAP"), TEXT("1"));
}

Added this to LocalVertexFactory.usf:

 #if OVERRIDE_VOLUMETRIC_LIGHTMAP
bool OverrideVolumetricLightmap;
#endif

In BaseBassPixelShader.usf GetPrecomputedIndirectLightingAndSkyLight():
This doesn’t work:

#if OVERRIDE_VOLUMETRIC_LIGHTMAP
		if(OverrideVolumetricLightmap) {
		OutDiffuseLighting = float3(1,0,0); //set to red to test
		}
#endif

This works:

#if OVERRIDE_VOLUMETRIC_LIGHTMAP
		OutDiffuseLighting = float3(1,0,0);
#endif

So the OverrideVolumetricLightmap parameter isn’t being set correctly.