Change default lighting channels on all actors

Hi,

I’d like all the actors in my game to have lighting channels 0 and 1 enabled as opposed to only channel 0 being enabled as it is by default.

I’ve noticed that all the actors/components where lighting channels can be changed are children of the engine’s Actor base class, so if I change the lighting channels in the base class, then that should be propagated to everything else in the game, however, I can’t find the lighting channels variable in the actor.cpp file.

Does anyone know where to find them or if there is a better way of doing this?

Thanks :blush:

Hi,

I’ve done some search and found that LightingChannels is in the UPrimitiveComponent class which is base class for StaticMeshComponent, SkeletalMeshComponent etc.
It makes sense because these components are the ones should be rendered or receive light.

So, you can specify lighting channel for any mesh you want.
Example:

YourMeshComponent.bChannel0 = true;
YourMeshComponent.bChannel1 = false;
YourMeshComponent.bChannel2 = false;
1 Like

Thanks for the reply.

Is there a way to override the UPrimitiveComponent base class in my project so that I don’t have to recompile the whole engine?

I found the solution. If you want to change the default lighting channel settings so that channel 1 is always set to enabled on everything in the engine, for example, this is what you need to do:

Open the header file PrimitiveComponent.h which is located in: /Engine/Source/Runtime/Engine/Classes/Components/PrimitiveComponent.h

This is the file in which the FLightingChannels structure which contains the booleans for channels 0, 1, and 2 is declared and where we can set their default values.

I wanted channel 1 to always be on by default so I set bChannel1(true), if I wanted channel 2 to also be on by default I would set bChannel2(true), etc.

struct FLightingChannels
{
	GENERATED_BODY()

	FLightingChannels() :
		bChannel0(true),
		bChannel1(true),
		bChannel2(false)
	{}

After making the changes, you need to recompile the engine and the project in Visual Studio.