当前位置:网站首页>UE4阴影:PerObjectShadow验证
UE4阴影:PerObjectShadow验证
2022-07-16 18:16:00 【sh15285118586】
r.Shadow.PerObject
1 开启, 0关闭
PerObjectShadow包括:
bCreateTranslucentObjectShadow || bCreateInsetObjectShadow || bCreateObjectShadowForStationaryLight
const bool bTranslucentObjectShadow = LightSceneInfo->Proxy->CastsTranslucentShadows() && PrimitiveSceneInfo->Proxy->CastsVolumetricTranslucentShadow();
const bool bInsetObjectShadow =
// Currently only supporting inset shadows on directional lights, but could be made to work with any whole scene shadows
LightSceneInfo->Proxy->GetLightType() == LightType_Directional
&& PrimitiveSceneInfo->Proxy->CastsInsetShadow();
const uint32 MinShadowResolution = FMath::Max<int32>(0, CVarMinShadowResolution.GetValueOnRenderThread());
const uint32 ShadowFadeResolution = FMath::Max<int32>(0, CVarShadowFadeResolution.GetValueOnRenderThread());
static TAutoConsoleVariable<int32> CVarShadowFadeResolution(
TEXT("r.Shadow.FadeResolution"),
64,
TEXT("Resolution in texels below which shadows are faded out"),
ECVF_Scalability | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarMinShadowResolution(
TEXT("r.Shadow.MinResolution"),
32,
TEXT("Minimum dimensions (in texels) allowed for rendering shadow subject depths"),
ECVF_RenderThreadSafe);
AmountShadow,阴影透明度条件
MinShadowResolution ShadowFadeResolution 阴影渐变消失调节,大小可以理解屏幕的像素值。
/**
* Helper function to determine fade alpha value for shadows based on resolution. In the below ASCII art (1) is
* the MinShadowResolution and (2) is the ShadowFadeResolution. Alpha will be 0 below the min resolution and 1
* above the fade resolution. In between it is going to be an exponential curve with the values between (1) and (2)
* being normalized in the 0..1 range.
*
*
* | /-------
* | /
* |/
* 1-----2-------
*
* @param MaxUnclampedResolution Requested resolution, unclamped so it can be below min
* @param ShadowFadeResolution Resolution at which fade begins
* @param MinShadowResolution Minimum resolution of shadow
*
* @return fade value between 0 and 1
*/
float CalculateShadowFadeAlpha(const float MaxUnclampedResolution, const uint32 ShadowFadeResolution, const uint32 MinShadowResolution)
{
// NB: MaxUnclampedResolution < 0 will return FadeAlpha = 0.0f.
float FadeAlpha = 0.0f;
// Shadow size is above fading resolution.
if (MaxUnclampedResolution > ShadowFadeResolution)
{
FadeAlpha = 1.0f;
}
// Shadow size is below fading resolution but above min resolution.
else if (MaxUnclampedResolution > MinShadowResolution)
{
const float Exponent = CVarShadowFadeExponent.GetValueOnRenderThread();
// Use the limit case ShadowFadeResolution = MinShadowResolution
// to gracefully handle this case.
if (MinShadowResolution >= ShadowFadeResolution)
{
const float SizeRatio = (float)(MaxUnclampedResolution - MinShadowResolution);
FadeAlpha = 1.0f - FMath::Pow(SizeRatio, Exponent);
}
else
{
const float InverseRange = 1.0f / (ShadowFadeResolution - MinShadowResolution);
const float FirstFadeValue = FMath::Pow(InverseRange, Exponent);
const float SizeRatio = (float)(MaxUnclampedResolution - MinShadowResolution) * InverseRange;
// Rescale the fade alpha to reduce the change between no fading and the first value, which reduces popping with small ShadowFadeExponent's
FadeAlpha = (FMath::Pow(SizeRatio, Exponent) - FirstFadeValue) / (1.0f - FirstFadeValue);
}
}
return FadeAlpha;
}


相机远离物体,阴影渐渐消失

边栏推荐
- 1. Solve com mysql. jdbc. PacketTooBigException: Packet for query is too large
- Solve the hikaricp problem of database connection pool
- 【学浪下载教程】05学浪下载之正式抓包下载
- Add, delete, check and modify the MySQL Learning Notes database (Advanced)
- Hystrix 部署
- 开口就要20k的软件测试工程师需要掌握哪些技能?有这些技能我敢要更高~
- Solve yolov7/detect Py calls the camera for recognition, and there is an error "typeerror: argument of type 'Int' is not Iterable"
- scrcpy投屏
- go ———数组与切片的区别
- Redis cluster
猜你喜欢

Splunk configuring multi cluster index

【uniapp调用微信支付】uniapp开发小程序-调用微信支付

浅谈数组方法重构再封装-forEach-Map——push(),unshift(),shift(),Map(),filter(),every(),some(), reduce()

There is something that turns vscode into an idea effect

Redis cluster

OSPF理论

什么是产业规划?产业园区该如何做好产业规划

OpenCV 教程 02: OpenCV 的核心操作

SAP AppGyver 简介

1. Reptile overview
随机推荐
2022.7.4-7.10 AI industry weekly (issue 105): snails
Interview question 5
SF city test development side 49min answer
Fade in and fade out 1920-500 (7)
Pytorch 深度可分离卷积和MobileNet_v1
高级程序员面试常用问题,你知道回答吗? 带答案
顺丰同城测试开发一面 49min答案
Remember these points and you can quickly find bugs
There is something that turns vscode into an idea effect
[Xuelang download tutorial] 03 proxifier settings for Xuelang Download
Scrcpy projection
程序员都看不懂的代码 渐隐渐现1920-500(1)
Metrics study notes
这些用例设计题,你在面试时遇到过吗?
Splunk configuring multi cluster index
jenkins安装
你猜不到的代码
Applet page navigation
Research on driverless dynamic obstacle avoidance strategy | robot dynamic obstacle avoidance strategy
阿里云视频点播