Merge branch 'whocares77-master'
This commit is contained in:
@@ -13,6 +13,7 @@ void GraphicsSettings::Apply()
|
||||
Graphics::ShadowsQuality = ShadowsQuality;
|
||||
Graphics::ShadowMapsQuality = ShadowMapsQuality;
|
||||
Graphics::AllowCSMBlending = AllowCSMBlending;
|
||||
Graphics::DefaultProbeResolution = (int32)DefaultProbeResolution;
|
||||
Graphics::GlobalSDFQuality = GlobalSDFQuality;
|
||||
Graphics::GIQuality = GIQuality;
|
||||
Graphics::PostProcessSettings = PostProcessSettings;
|
||||
|
||||
@@ -63,6 +63,22 @@ public:
|
||||
API_FIELD(Attributes="EditorOrder(1320), DefaultValue(false), EditorDisplay(\"Quality\", \"Allow CSM Blending\")")
|
||||
bool AllowCSMBlending = false;
|
||||
|
||||
/// <summary>
|
||||
/// Default probes cubemap resolution.
|
||||
/// </summary>
|
||||
API_ENUM() enum class DefaultProbeResolutions
|
||||
{
|
||||
_64 = 64,
|
||||
_128 = 128,
|
||||
_256 = 256,
|
||||
_512 = 512,
|
||||
_1024 = 1024,
|
||||
_2048 = 2048,
|
||||
_4096 = 4096,
|
||||
};
|
||||
API_FIELD(Attributes = "EditorOrder(1500), DefaultValue(DefaultProbeResolutions._512), EditorDisplay(\"Quality\", \"Default Probe Resolution\")")
|
||||
DefaultProbeResolutions DefaultProbeResolution = DefaultProbeResolutions::_512;
|
||||
|
||||
/// <summary>
|
||||
/// If checked, enables Global SDF rendering. This can be used in materials, shaders, and particles.
|
||||
/// </summary>
|
||||
|
||||
@@ -14,6 +14,7 @@ Quality Graphics::VolumetricFogQuality = Quality::High;
|
||||
Quality Graphics::ShadowsQuality = Quality::Medium;
|
||||
Quality Graphics::ShadowMapsQuality = Quality::Medium;
|
||||
bool Graphics::AllowCSMBlending = false;
|
||||
int32 Graphics::DefaultProbeResolution = 512;
|
||||
Quality Graphics::GlobalSDFQuality = Quality::High;
|
||||
Quality Graphics::GIQuality = Quality::High;
|
||||
PostProcessSettings Graphics::PostProcessSettings;
|
||||
|
||||
@@ -53,6 +53,11 @@ public:
|
||||
/// </summary>
|
||||
API_FIELD() static bool AllowCSMBlending;
|
||||
|
||||
/// <summary>
|
||||
/// Default probes cubemap resolution.
|
||||
/// </summary>
|
||||
API_FIELD() static int32 DefaultProbeResolution;
|
||||
|
||||
/// <summary>
|
||||
/// The Global SDF quality. Controls the volume texture resolution and amount of cascades to use.
|
||||
/// </summary>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "Engine/ContentImporters/AssetsImportingManager.h"
|
||||
#include "Engine/Serialization/Serialization.h"
|
||||
#include "Engine/Level/Scene/Scene.h"
|
||||
#include "Engine/Graphics/Graphics.h"
|
||||
|
||||
EnvironmentProbe::EnvironmentProbe(const SpawnParams& params)
|
||||
: Actor(params)
|
||||
@@ -80,8 +81,12 @@ void EnvironmentProbe::Bake(float timeout)
|
||||
|
||||
void EnvironmentProbe::SetProbeData(TextureData& data)
|
||||
{
|
||||
int32 probeResolution = (int32)CubemapResolution;
|
||||
// if Use Graphics Settings
|
||||
if (probeResolution == 0) probeResolution = Graphics::DefaultProbeResolution;
|
||||
|
||||
// Validate input data
|
||||
ASSERT(data.GetArraySize() == 6 && data.Height == ENV_PROBES_RESOLUTION && data.Width == ENV_PROBES_RESOLUTION);
|
||||
ASSERT(data.GetArraySize() == 6 && data.Height == probeResolution && data.Width == probeResolution);
|
||||
|
||||
// Check if was using custom probe
|
||||
if (_isUsingCustomProbe)
|
||||
@@ -170,6 +175,7 @@ void EnvironmentProbe::Serialize(SerializeStream& stream, const void* otherObj)
|
||||
SERIALIZE_GET_OTHER_OBJ(EnvironmentProbe);
|
||||
|
||||
SERIALIZE_MEMBER(Radius, _radius);
|
||||
SERIALIZE(CubemapResolution);
|
||||
SERIALIZE(Brightness);
|
||||
SERIALIZE(AutoUpdate);
|
||||
SERIALIZE(CaptureNearPlane);
|
||||
@@ -183,6 +189,7 @@ void EnvironmentProbe::Deserialize(DeserializeStream& stream, ISerializeModifier
|
||||
Actor::Deserialize(stream, modifier);
|
||||
|
||||
DESERIALIZE_MEMBER(Radius, _radius);
|
||||
DESERIALIZE(CubemapResolution);
|
||||
DESERIALIZE(Brightness);
|
||||
DESERIALIZE(AutoUpdate);
|
||||
DESERIALIZE(CaptureNearPlane);
|
||||
|
||||
@@ -19,6 +19,23 @@ private:
|
||||
AssetReference<CubeTexture> _probe;
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// The reflections texture resolution.
|
||||
/// </summary>
|
||||
API_ENUM() enum class CubemapResolutions
|
||||
{
|
||||
UseGraphicsSettings = 0,
|
||||
_64 = 64,
|
||||
_128 = 128,
|
||||
_256 = 256,
|
||||
_512 = 512,
|
||||
_1024 = 1024,
|
||||
_2048 = 2048,
|
||||
_4096 = 4096,
|
||||
};
|
||||
API_FIELD(Attributes = "EditorOrder(0), DefaultValue(CubemapResolutions.UseGraphicsSettings), EditorDisplay(\"Probe\")")
|
||||
CubemapResolutions CubemapResolution = CubemapResolutions::UseGraphicsSettings;
|
||||
|
||||
/// <summary>
|
||||
/// The reflections brightness.
|
||||
/// </summary>
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "Engine/Graphics/Textures/TextureData.h"
|
||||
#include "Engine/Graphics/RenderTask.h"
|
||||
#include "Engine/Engine/Engine.h"
|
||||
#include "Engine/Graphics/Graphics.h"
|
||||
|
||||
/// <summary>
|
||||
/// Custom task called after downloading probe texture data to save it.
|
||||
@@ -279,7 +280,15 @@ bool ProbesRenderer::Init()
|
||||
|
||||
// Init rendering pipeline
|
||||
_output = GPUDevice::Instance->CreateTexture(TEXT("Output"));
|
||||
if (_output->Init(GPUTextureDescription::New2D(ENV_PROBES_RESOLUTION, ENV_PROBES_RESOLUTION, ENV_PROBES_FORMAT)))
|
||||
int32 probeResolution = ENV_PROBES_RESOLUTION;
|
||||
if (_current.Type == EntryType::EnvProbe)
|
||||
{
|
||||
auto envProbe = (EnvironmentProbe*)_current.Actor.Get();
|
||||
probeResolution = (int32)envProbe->CubemapResolution;
|
||||
// if Use Graphics Settings
|
||||
if (probeResolution == 0) probeResolution = Graphics::DefaultProbeResolution;
|
||||
}
|
||||
if (_output->Init(GPUTextureDescription::New2D(probeResolution, probeResolution, ENV_PROBES_FORMAT)))
|
||||
return true;
|
||||
_task = New<SceneRenderTask>();
|
||||
auto task = _task;
|
||||
@@ -301,15 +310,15 @@ bool ProbesRenderer::Init()
|
||||
view.StaticFlagsMask = StaticFlags::ReflectionProbe;
|
||||
view.MaxShadowsQuality = Quality::Low;
|
||||
task->IsCameraCut = true;
|
||||
task->Resize(ENV_PROBES_RESOLUTION, ENV_PROBES_RESOLUTION);
|
||||
task->Resize(probeResolution, probeResolution);
|
||||
task->Render.Bind(onRender);
|
||||
|
||||
// Init render targets
|
||||
_probe = GPUDevice::Instance->CreateTexture(TEXT("ProbesUpdate.Probe"));
|
||||
if (_probe->Init(GPUTextureDescription::NewCube(ENV_PROBES_RESOLUTION, ENV_PROBES_FORMAT, GPUTextureFlags::ShaderResource | GPUTextureFlags::RenderTarget | GPUTextureFlags::PerMipViews, 0)))
|
||||
if (_probe->Init(GPUTextureDescription::NewCube(probeResolution, ENV_PROBES_FORMAT, GPUTextureFlags::ShaderResource | GPUTextureFlags::RenderTarget | GPUTextureFlags::PerMipViews, 0)))
|
||||
return true;
|
||||
_tmpFace = GPUDevice::Instance->CreateTexture(TEXT("ProbesUpdate.TmpFae"));
|
||||
if (_tmpFace->Init(GPUTextureDescription::New2D(ENV_PROBES_RESOLUTION, ENV_PROBES_RESOLUTION, 0, ENV_PROBES_FORMAT, GPUTextureFlags::ShaderResource | GPUTextureFlags::RenderTarget | GPUTextureFlags::PerMipViews)))
|
||||
if (_tmpFace->Init(GPUTextureDescription::New2D(probeResolution, probeResolution, 0, ENV_PROBES_FORMAT, GPUTextureFlags::ShaderResource | GPUTextureFlags::RenderTarget | GPUTextureFlags::PerMipViews)))
|
||||
return true;
|
||||
|
||||
// Mark as ready
|
||||
@@ -465,9 +474,13 @@ void ProbesRenderer::onRender(RenderTask* task, GPUContext* context)
|
||||
|
||||
// Init
|
||||
float customCullingNear = -1;
|
||||
int32 probeResolution = ENV_PROBES_RESOLUTION;
|
||||
if (_current.Type == EntryType::EnvProbe)
|
||||
{
|
||||
auto envProbe = (EnvironmentProbe*)_current.Actor.Get();
|
||||
probeResolution = (int32)envProbe->CubemapResolution;
|
||||
// if Use Graphics Settings
|
||||
if (probeResolution == 0) probeResolution = Graphics::DefaultProbeResolution;
|
||||
LOG(Info, "Updating Env probe '{0}'...", envProbe->ToString());
|
||||
Vector3 position = envProbe->GetPosition();
|
||||
float radius = envProbe->GetScaledRadius();
|
||||
@@ -525,7 +538,7 @@ void ProbesRenderer::onRender(RenderTask* task, GPUContext* context)
|
||||
{
|
||||
PROFILE_GPU("Copy Face");
|
||||
context->SetRenderTarget(_probe->View(faceIndex));
|
||||
context->SetViewportAndScissors(ENV_PROBES_RESOLUTION, ENV_PROBES_RESOLUTION);
|
||||
context->SetViewportAndScissors(probeResolution, probeResolution);
|
||||
auto probeFrame = _output->View();
|
||||
if (setLowerHemisphereToBlack && faceIndex != 2)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user