Box-bounded PointLightComponent

Hello,

I’m using dynamic lights, placed procedurally in procedural rooms. And I faced to the limitation that only 4 Movable shadowed lights can intersect each other.

So I would like to bound a UPointLightComponent by adjacent FBoxes to make it affect the world only within those given FBoxes. This could help with more strict separation of light groups from each other, since box-aligned PointLight bounds better fit to rectangular rooms, rather then current spherical ones.

As far as I understand, it could be achieved in C++ by overriding methods AffectsBounds() and GetBoundingBox() in FPointLightPolicy struct, like it’s done for USpotLightComponent in UE4 sources.


--- Is my guess about overriding those methods correct - or it could be done in simpler way?

I tried to override UPointLightComponent and FPointLightPolicy in my code, but an access to FPointLightPolicy requires file Runtime/Engine/Private/PointLightSceneProxy.h to be included. This file resides in a Private folder and internally uses some RHI-related things, which need RHI-related libs while linking. So I was unable to compile it because of these linking errors:

1>Module.IM.cpp.obj : error LNK2019: unresolved external symbol “__declspec(dllimport) unsigned int __cdecl RHIGetShaderLanguageVersion(enum EShaderPlatform)” (_imp?RHIGetShaderLanguageVersion@@YAIW4EShaderPlatform@@@Z) referenced in function "public: virtual bool __cdecl FBoxLightSceneProxy::GetWholeSceneProjectedShadowInitializer(class FSceneViewFamily const &,class TArray > &)const " (?GetWholeSceneProjectedShadowInitializer@FBoxLightSceneProxy@@UEBA_NAEBVFSceneViewFamily@@AEAV?$TArray@VFWholeSceneProjectedShadowInitializer@@anonymous_user_e71e0d8a1?$TInlineAllocator@$05VFDefaultAllocator@@@@@@@Z)

1>Module.IM.cpp.obj : error LNK2019: unresolved external symbol “__declspec(dllimport) public: void __cdecl FRHICommandSetScissorRect::Execute(class FRHICommandListBase &)” (_imp?Execute@FRHICommandSetScissorRect@@QEAAXAEAVFRHICommandListBase@@@Z) referenced in function “public: virtual void __cdecl FRHICommand::ExecuteAndDestruct(class FRHICommandListBase &,struct FRHICommandListDebugContext &)” (?ExecuteAndDestruct@?$FRHICommand@UFRHICommandSetScissorRect@@@@UEAAXAEAVFRHICommandListBase@@AEAUFRHICommandListDebugContext@@@Z)

1>Module.IM.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __cdecl FRHICommandList::IsOutsideRenderPass(void)const " (_imp?IsOutsideRenderPass@FRHICommandList@@QEBA_NXZ) referenced in function "public: virtual void __cdecl FPointLightSceneProxyBase::SetScissorRect(class FRHICommandList &,class FSceneView const &,struct FIntRect const &)const " (?SetScissorRect@FPointLightSceneProxyBase@@UEBAXAEAVFRHICommandList@@AEBVFSceneView@@AEBUFIntRect@@@Z)

1>Module.IM.cpp.obj : error LNK2001: unresolved external symbol “__declspec(dllimport) class FRHICommandListExecutor GRHICommandList” (_imp?GRHICommandList@@3VFRHICommandListExecutor@@A)

(FBoxLightSceneProxy is a child of TPointLightSceneProxy with overriden methods)


--- Is there any way to override **UPointLightComponent** and **FPointLightPolicy** without recompiling UE4 from sources?

I use UE 4.19.0, MS Visual Studio 2017.

Any help on this point would be greatly appreciated :slight_smile:

Thank you.

Weirdly enough, I was trying to do the same thing 3 years later ^^_