DirectionalLightComponent.cpp
/** Accesses parameters needed for rendering the light. */
virtual void GetLightShaderParameters(FLightShaderParameters& LightParameters) const override
{
LightParameters.Position = FVector::ZeroVector;
LightParameters.InvRadius = 0.0f;
LightParameters.FalloffExponent = 0.0f;
// We only apply transmittance in some cases. For instance if transmittance is evaluated per pixel, no apply it to the light illuminance.
LightParameters.Color = FVector(GetColor() * (bApplyAtmosphereTransmittanceToLightShaderParam ? AtmosphereTransmittanceFactor : FLinearColor::White));
LightParameters.Direction = -GetDirection();
LightParameters.Tangent = -GetDirection();
LightParameters.SpotAngles = FVector2D(0, 0);
LightParameters.SpecularScale = SpecularScale;
LightParameters.SourceRadius = FMath::Sin( 0.5f * FMath::DegreesToRadians( LightSourceAngle ) );
LightParameters.SoftSourceRadius = FMath::Sin( 0.5f * FMath::DegreesToRadians( LightSourceSoftAngle ) );
LightParameters.SourceLength = 0.0f;
LightParameters.SourceTexture = GWhiteTexture->TextureRHI;
}
SpotLightComponent.cpp
/** Accesses parameters needed for rendering the light. */
virtual void GetLightShaderParameters(FLightShaderParameters& LightParameters) const override
{
LightParameters.Position = GetOrigin();
LightParameters.InvRadius = InvRadius;
LightParameters.Color = FVector(GetColor());
LightParameters.FalloffExponent = FalloffExponent;
LightParameters.Direction = -GetDirection();
LightParameters.Tangent = FVector(WorldToLight.M[0][2], WorldToLight.M[1][2], WorldToLight.M[2][2]);
LightParameters.SpotAngles = FVector2D(CosOuterCone, InvCosConeDifference);
LightParameters.SpecularScale = SpecularScale;
LightParameters.SourceRadius = SourceRadius;
LightParameters.SoftSourceRadius = SoftSourceRadius;
LightParameters.SourceLength = SourceLength;
LightParameters.SourceTexture = GWhiteTexture->TextureRHI;
LightParameters.RectLightBarnCosAngle = 0.0f;
LightParameters.RectLightBarnLength = -2.0f;
}
PointLightComponent.cpp
/** Accesses parameters needed for rendering the light. */
void FPointLightSceneProxy::GetLightShaderParameters(FLightShaderParameters& LightParameters) const
{
LightParameters.Position = GetOrigin();
LightParameters.InvRadius = InvRadius;
LightParameters.Color = FVector(GetColor());
LightParameters.FalloffExponent = FalloffExponent;
LightParameters.Direction = -GetDirection();
LightParameters.Tangent = FVector(WorldToLight.M[0][2], WorldToLight.M[1][2], WorldToLight.M[2][2]);
LightParameters.SpotAngles = FVector2D( -2.0f, 1.0f );
LightParameters.SpecularScale = SpecularScale;
LightParameters.SourceRadius = SourceRadius;
LightParameters.SoftSourceRadius = SoftSourceRadius;
LightParameters.SourceLength = SourceLength;
LightParameters.SourceTexture = GWhiteTexture->TextureRHI;
LightParameters.RectLightBarnCosAngle = 0.0f;
LightParameters.RectLightBarnLength = -2.0f;
}
RectLightComponent.cpp
/** Accesses parameters needed for rendering the light. */
void FRectLightSceneProxy::GetLightShaderParameters(FLightShaderParameters& LightParameters) const
{
FLinearColor LightColor = GetColor();
LightColor /= 0.5f * SourceWidth * SourceHeight;
LightParameters.Position = GetOrigin();
LightParameters.InvRadius = InvRadius;
LightParameters.Color = FVector(LightColor.R, LightColor.G, LightColor.B);
LightParameters.FalloffExponent = 0.0f;
LightParameters.Direction = -GetDirection();
LightParameters.Tangent = FVector(WorldToLight.M[0][2], WorldToLight.M[1][2], WorldToLight.M[2][2]);
LightParameters.SpotAngles = FVector2D(-2.0f, 1.0f);
LightParameters.SpecularScale = SpecularScale;
LightParameters.SourceRadius = SourceWidth * 0.5f;
LightParameters.SoftSourceRadius = 0.0f;
LightParameters.SourceLength = SourceHeight * 0.5f;
LightParameters.SourceTexture = SourceTexture ? SourceTexture->Resource->TextureRHI : GWhiteTexture->TextureRHI;
LightParameters.RectLightBarnCosAngle = FMath::Cos(FMath::DegreesToRadians(BarnDoorAngle));
LightParameters.RectLightBarnLength = BarnDoorLength;
}