Merge branch 'Develope' into Effect
This commit is contained in:
@@ -154,9 +154,9 @@ void CBroom::Late_Update(_float fTimeDelta)
|
||||
GUI::Checkbox("BillBoard", &m_pWindEffect->Get_Effect_Info()->isBillboard);
|
||||
GUI::DragFloat("Offset", &m_fCameraOffset);
|
||||
GUI::End();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
|
||||
|
||||
@@ -21,10 +21,6 @@ void CCamera_Debug::Priority_Update(_float fTimeDelta)
|
||||
m_pGameInstance->Bind_Camera(g_iStaticLevel, CAMERA_DEBUG, false);
|
||||
#endif // _DEBUG
|
||||
|
||||
}
|
||||
|
||||
void CCamera_Debug::Update(_float fTimeDelta)
|
||||
{
|
||||
if (FAILED(m_pGameInstance->IsBinded_Camera(CAMERA_DEBUG))) {
|
||||
return;
|
||||
}
|
||||
@@ -88,6 +84,10 @@ void CCamera_Debug::Update(_float fTimeDelta)
|
||||
__super::Bind_Matrices();
|
||||
}
|
||||
|
||||
void CCamera_Debug::Update(_float fTimeDelta)
|
||||
{
|
||||
}
|
||||
|
||||
void CCamera_Debug::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
if (FAILED(m_pGameInstance->IsBinded_Camera(CAMERA_DEBUG))) {
|
||||
|
||||
@@ -27,7 +27,11 @@ void CInstancedProp::Late_Update(_float fTimeDelta)
|
||||
}
|
||||
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
|
||||
//pair<_bool, _ubyte> pairShadowResult = m_pGameInstance->IsIn_ShadowViewFrustum(m_pTransformCom->Get_State(STATE::POSITION), m_pTransformCom->Get_Radius());
|
||||
//if (0 == ((_ubyte)SHADOW::SHADOW_FAR & pairShadowResult.second)) {
|
||||
// pairShadowResult.first = true;
|
||||
// Set_Shadow(pairShadowResult);
|
||||
//}
|
||||
}
|
||||
|
||||
HRESULT CInstancedProp::Render()
|
||||
|
||||
@@ -118,16 +118,19 @@ void CInteraction_Key::ReLockOnTarget()
|
||||
m_bActive = false;
|
||||
m_LockOnInteractionObject.pInteractive = nullptr;
|
||||
}
|
||||
m_bActive = true;
|
||||
m_fSize = _float3(40.f, 40.f, 1.f);
|
||||
_vector Position = XMVectorSet(m_LockOnInteractionObject.pInteractive->Get_WorldPostion().m128_f32[0],
|
||||
m_LockOnInteractionObject.pInteractive->Get_WorldPostion().m128_f32[1] + 0.5f,
|
||||
m_LockOnInteractionObject.pInteractive->Get_WorldPostion().m128_f32[2],
|
||||
m_LockOnInteractionObject.pInteractive->Get_WorldPostion().m128_f32[3]);
|
||||
m_pTransformCom->Set_State(STATE::POSITION, Position);
|
||||
else {
|
||||
m_bActive = true;
|
||||
m_fSize = _float3(40.f, 40.f, 1.f);
|
||||
_vector Position = XMVectorSet(m_LockOnInteractionObject.pInteractive->Get_WorldPostion().m128_f32[0],
|
||||
m_LockOnInteractionObject.pInteractive->Get_WorldPostion().m128_f32[1] + 0.5f,
|
||||
m_LockOnInteractionObject.pInteractive->Get_WorldPostion().m128_f32[2],
|
||||
m_LockOnInteractionObject.pInteractive->Get_WorldPostion().m128_f32[3]);
|
||||
m_pTransformCom->Set_State(STATE::POSITION, Position);
|
||||
}
|
||||
}
|
||||
else
|
||||
else{
|
||||
m_bActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CInteraction_Key::Ready_Components()
|
||||
@@ -231,7 +234,10 @@ void CInteraction_Key::Free()
|
||||
SAFE_RELEASE(m_pShaderCom);
|
||||
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
|
||||
void CInteraction_Key::Describe_Entity()
|
||||
{
|
||||
}
|
||||
|
||||
#endif // _DEBUG
|
||||
|
||||
@@ -47,6 +47,28 @@ HRESULT CLand::Render()
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CLand::Render_Shadow(SHADOW eType)
|
||||
{
|
||||
if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Bind_Shadow_Resource(m_pShaderCom, "g_ViewMatrix", D3DTS::VIEW, eType))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Bind_Shadow_Resource(m_pShaderCom, "g_ProjMatrix", D3DTS::PROJ, eType))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::SHADOW)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pModelCom->Render(0))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CLand::Initialize_Prototype()
|
||||
{
|
||||
return S_OK;
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
#include "pch.h"
|
||||
#include "Level_Loading.h"
|
||||
|
||||
#include "Loader.h"
|
||||
#include "Light_Main.h"
|
||||
#include "GameInstance.h"
|
||||
#include "Layer.h"
|
||||
#include "Level_Logo.h"
|
||||
#include "Level_GamePlay.h"
|
||||
#include "Level_Restart.h"
|
||||
#include "Level_Field.h"
|
||||
|
||||
#include "Intro_Image.h"
|
||||
#include "Intro_BG.h"
|
||||
#include "Loding_Panel.h"
|
||||
@@ -23,9 +22,6 @@ HRESULT CLevel_Loading::Initialize(LEVEL eNextLevelID)
|
||||
m_eNextLevelID = eNextLevelID;
|
||||
|
||||
m_pLoader = CLoader::Create(m_pDevice, m_pContext, eNextLevelID);
|
||||
//m_ShadowDesc.vAt = _float4(-10.f, -10.f, 10.f, 1.f);
|
||||
//m_ShadowDesc.fWidth = 300.f;
|
||||
//m_ShadowDesc.fHeight = 300.f;
|
||||
if (nullptr == m_pLoader) {
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -64,7 +60,6 @@ void CLevel_Loading::Update(_float fTimeDelta)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (m_bNextLevel == true)
|
||||
{
|
||||
pair<CLevel*, function<void()>> pairLevel = { nullptr, nullptr };
|
||||
@@ -77,10 +72,8 @@ void CLevel_Loading::Update(_float fTimeDelta)
|
||||
} break;
|
||||
case LEVEL::GAMEPLAY:
|
||||
{
|
||||
//m_ShadowDesc.vAt = _float4(-194, 18.5f, -153.f, 1.f);
|
||||
//m_ShadowDesc.fHeight = 1000.f;
|
||||
//m_ShadowDesc.fWidth = 1000.f;
|
||||
pairLevel = CLevel_GamePlay::Create(m_pDevice, m_pContext, m_eNextLevelID, nullptr);
|
||||
Capture_TerrainPreShadow();
|
||||
} break;
|
||||
case LEVEL::FIELD:
|
||||
{
|
||||
@@ -90,12 +83,10 @@ void CLevel_Loading::Update(_float fTimeDelta)
|
||||
{
|
||||
pairLevel = CLevel_Restart::Create(m_pDevice, m_pContext, m_eNextLevelID);
|
||||
} break;
|
||||
|
||||
default:
|
||||
assert(false); // E_IMPL
|
||||
break;
|
||||
}
|
||||
// Capture_TerrainPreShadow(m_ShadowDesc);
|
||||
if (SUCCEEDED(m_pGameInstance->Change_Level(pairLevel.first))) {
|
||||
if (nullptr != pairLevel.second)
|
||||
{
|
||||
@@ -115,34 +106,17 @@ HRESULT CLevel_Loading::Render()
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
//
|
||||
//void CLevel_Loading::Capture_TerrainPreShadow(SHADOW_LIGHT_DESC& ShadowDesc)
|
||||
//{
|
||||
// CLayer* pLayer = m_pGameInstance->Get_Layer(NEXT_LEVEL, LAYER_BACKGROUND);
|
||||
// if (nullptr != pLayer) {
|
||||
// ShadowDesc.fFar = 1000.f;
|
||||
// ShadowDesc.fNear = 0.1f;
|
||||
// _float3 vRollPichYaw = { 35.2643897f, 45.f, 0.f }; // (1, -1, 1) 방향 look
|
||||
//
|
||||
// _matrix matRotation = XMMatrixRotationRollPitchYaw(
|
||||
// XMConvertToRadians(vRollPichYaw.x), XMConvertToRadians(vRollPichYaw.y), XMConvertToRadians(vRollPichYaw.z));
|
||||
//
|
||||
// XMStoreFloat4(&ShadowDesc.vEye, XMLoadFloat4(&ShadowDesc.vAt) - matRotation.r[2] * (ShadowDesc.fFar * 0.25f));
|
||||
//
|
||||
// if (FAILED(m_pGameInstance->Ready_Shadow_Light(ShadowDesc))) {
|
||||
// assert(false);
|
||||
// }
|
||||
//
|
||||
// const list<CGameObject*>* pObjects = pLayer->Get_Objects();
|
||||
// _float4 vPos = {};
|
||||
// for (auto& pObject : *pObjects) {
|
||||
// if (FAILED(m_pGameInstance->Add_RenderGroup(RENDER::PRESHADOW, pObject))) {
|
||||
// assert(false);
|
||||
// }
|
||||
// }
|
||||
// m_pGameInstance->Render_PreShadow();
|
||||
// }
|
||||
//}
|
||||
|
||||
void CLevel_Loading::Capture_TerrainPreShadow()
|
||||
{
|
||||
CLayer* pLayer = m_pGameInstance->Get_Layer(NEXT_LEVEL, LAYER_LIGHT);
|
||||
assert(nullptr != pLayer);
|
||||
CLight_Main* pLight = pLayer->Get_Object<CLight_Main>();
|
||||
assert(nullptr != pLight);
|
||||
if (FAILED(pLight->Capture_PreShadow())) {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CLevel_Loading::Ready_Layer_BackGround(const _wstring& strLayerTag)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "pch.h"
|
||||
#include "Light_Main.h"
|
||||
#include "GameInstance.h"
|
||||
#include "Layer.h"
|
||||
|
||||
CLight_Main::CLight_Main(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: CGameObject(pDevice, pContext)
|
||||
@@ -22,32 +23,24 @@ HRESULT CLight_Main::Initialize(void* pArg)
|
||||
if (FAILED(__super::Initialize(pArg))){
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
if (FAILED(Ready_Components())){
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pTransformCom->Set_State(STATE::LOOK, XMVectorSet(1.f, -1.f, 1.f, 0.f));
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CLight_Main::Priority_Update(_float fTimeDelta)
|
||||
{
|
||||
_float4 vLook = {};
|
||||
XMStoreFloat4(&vLook, m_pTransformCom->Get_State(STATE::LOOK));
|
||||
m_pGameInstance->Ready_Shadow_Light(vLook);
|
||||
_float4 vRPYQuat = {};
|
||||
XMStoreFloat4(&vRPYQuat, m_pTransformCom->Get_QuarternionVector());
|
||||
m_pGameInstance->Ready_Shadow_Light(vRPYQuat);
|
||||
}
|
||||
|
||||
void CLight_Main::Update(_float fTimeDelta)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
GUI::Begin("LIGHT", 0, IMGUI_GLOBAL_BEGIN_FLAG);
|
||||
if (GUI::CollapsingHeader("Main_Light")) {
|
||||
m_pLightCom->Describe_Entity();
|
||||
}
|
||||
GUI::End();
|
||||
Describe_Entity();
|
||||
#endif // _DEBUG
|
||||
}
|
||||
|
||||
@@ -60,10 +53,49 @@ HRESULT CLight_Main::Render()
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CLight_Main::Capture_PreShadow()
|
||||
{
|
||||
CLayer* pLayer = m_pGameInstance->Get_Layer(NEXT_LEVEL, LAYER_BACKGROUND);
|
||||
assert(nullptr != pLayer);
|
||||
|
||||
const list<CGameObject*>* pObjects = pLayer->Get_Objects();
|
||||
for (auto& pObject : *pObjects) {
|
||||
if (FAILED(m_pGameInstance->Add_RenderGroup(RENDER::PRESHADOW, pObject))) {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
vector<_float3> vNeededPos = {};
|
||||
vNeededPos.reserve(12);
|
||||
{
|
||||
// 외곽이 더 많아지면 많아질수록 더 정밀한 경계가 가능
|
||||
// 하지만 더 실제보다 멀리 외곽을 두르면 필요한 것보다 더 많이 찍게 됨
|
||||
// 결국 딱 맞춰서 찍는게 제일 중요함
|
||||
vNeededPos.emplace_back(_float3(-112.f, 155.f, 362.f));
|
||||
vNeededPos.emplace_back(_float3(- 188.f, 10.f, 476.f));
|
||||
vNeededPos.emplace_back(_float3(- 571.f, 19.f, 476.f));
|
||||
vNeededPos.emplace_back(_float3(- 326.f, -64.f, 480.f));
|
||||
vNeededPos.emplace_back(_float3(569.f, 77.f, 250.f));
|
||||
vNeededPos.emplace_back(_float3(320.f, -236.f, 360.f));
|
||||
vNeededPos.emplace_back(_float3(570.f, 277.f, -277.f));
|
||||
vNeededPos.emplace_back(_float3(570.f, 176.f, -527.f));
|
||||
vNeededPos.emplace_back(_float3(- 108.f, -64.f, -1146.f));
|
||||
vNeededPos.emplace_back(_float3(- 824.f, 128.f, -533.f));
|
||||
vNeededPos.emplace_back(_float3(- 826.f, 145.f, -150.f));
|
||||
vNeededPos.emplace_back(_float3(- 256.f, -92.f, -414.f));
|
||||
}
|
||||
_matrix xmViewMatrix = m_pTransformCom->Get_WorldMatrixInv();
|
||||
_float4x4 ViewMatrix = {}; XMStoreFloat4x4(&ViewMatrix, xmViewMatrix);
|
||||
_float4x4 ProjMatrix = {}; XMStoreFloat4x4(&ProjMatrix, Get_OffCenterProjMatrix(xmViewMatrix, vNeededPos));
|
||||
|
||||
m_pGameInstance->Render_PreShadow(ViewMatrix, ProjMatrix);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CLight_Main::Ready_Components()
|
||||
{
|
||||
__super::Ready_Components(nullptr);
|
||||
|
||||
m_pTransformCom->LookAt(XMVectorSet(1.f, -4.f, 1.f, 1.f));
|
||||
LIGHT_DESC LightDesc{};
|
||||
|
||||
LightDesc.eType = LIGHT::DIRECTIONAL;
|
||||
@@ -95,6 +127,35 @@ HRESULT CLight_Main::Bind_ShaderResources()
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
_matrix CLight_Main::Get_OffCenterProjMatrix(_fmatrix ViewMatrix, vector<_float3>& WorldPositions)
|
||||
{
|
||||
_float fMinX = FLT_MAX;
|
||||
_float fMinY = FLT_MAX;
|
||||
_float fMinZ = FLT_MAX;
|
||||
_float fMaxX = -FLT_MAX;
|
||||
_float fMaxY = -FLT_MAX;
|
||||
_float fMaxZ = -FLT_MAX;
|
||||
|
||||
_uint iPosNum = (_uint)WorldPositions.size();
|
||||
for (_uint iIndexPoint = 0; iIndexPoint < iPosNum; ++iIndexPoint)
|
||||
{
|
||||
_vector vLightViewPos = XMVector4Transform(XMVectorSetW(XMLoadFloat3(&WorldPositions[iIndexPoint]), 1.f), ViewMatrix);
|
||||
|
||||
_float x = XMVectorGetX(vLightViewPos);
|
||||
_float y = XMVectorGetY(vLightViewPos);
|
||||
_float z = XMVectorGetZ(vLightViewPos);
|
||||
|
||||
fMinX = min(fMinX, x); fMaxX = max(fMaxX, x);
|
||||
fMinY = min(fMinY, y); fMaxY = max(fMaxY, y);
|
||||
fMinZ = min(fMinZ, z); fMaxZ = max(fMaxZ, z);
|
||||
}
|
||||
_float fShadowDepthMArgin = 10.f; // 캐릭터 이동 보정
|
||||
fMinZ -= fShadowDepthMArgin;
|
||||
fMaxZ += fShadowDepthMArgin;
|
||||
return XMMatrixOrthographicOffCenterLH(fMinX, fMaxX, fMinY, fMaxY, fMinZ, fMaxZ);
|
||||
}
|
||||
|
||||
|
||||
CLight_Main* CLight_Main::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
{
|
||||
CLight_Main* pInstance = new CLight_Main(pDevice, pContext);
|
||||
@@ -131,6 +192,20 @@ void CLight_Main::Free()
|
||||
|
||||
void CLight_Main::Describe_Entity()
|
||||
{
|
||||
GUI::Begin("LIGHT", 0, IMGUI_GLOBAL_BEGIN_FLAG);
|
||||
if (GUI::CollapsingHeader("Main_Light")) {
|
||||
if (GUI::Button("Capture_PreShadow")) {
|
||||
if (FAILED(Capture_PreShadow())) {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
m_pLightCom->Describe_Entity();
|
||||
if (GUI::Button("Sync_CamToLight")) {
|
||||
m_pTransformCom->Set_WorldMatrix(m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW_INV));
|
||||
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(0.f, 0.f, 0.f, 1.f));
|
||||
}
|
||||
}
|
||||
GUI::End();
|
||||
}
|
||||
|
||||
#endif // _DEBUG
|
||||
|
||||
@@ -919,6 +919,7 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
}
|
||||
#pragma endregion
|
||||
#if 진우
|
||||
#elif 기무리
|
||||
#else
|
||||
#pragma region UI_ANI
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Altering_Spell"),
|
||||
|
||||
@@ -87,6 +87,7 @@ void CMapObject_Render::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
case MAPOBJECT_RENDER_TYPE::NORMAL:
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
Set_Shadow(m_pGameInstance->IsIn_ShadowViewFrustum(XMLoadFloat4((_float4*)&m_CombinedWorldMatrix.m[3][0]), m_fRadius));
|
||||
break;
|
||||
case MAPOBJECT_RENDER_TYPE::GLASS:
|
||||
break;
|
||||
@@ -139,10 +140,6 @@ HRESULT CMapObject_Render::Render_Shadow(SHADOW eType)
|
||||
|
||||
for (_uint i = 0; i < iMeshes; i++)
|
||||
{
|
||||
if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::SHADOW)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ class CLand final : public CGameObject
|
||||
virtual void Update(_float fTimeDelta) override;
|
||||
virtual void Late_Update(_float fTimeDelta) override;
|
||||
virtual HRESULT Render() override;
|
||||
virtual HRESULT Render_Shadow(SHADOW eType) override;
|
||||
|
||||
private:
|
||||
CShader* m_pShaderCom = { nullptr };
|
||||
|
||||
@@ -15,10 +15,9 @@ class CLevel_Loading final : public CLevel
|
||||
virtual void Update(_float fTimeDelta) override;
|
||||
virtual HRESULT Render() override;
|
||||
virtual _uint Get_NextLevelID() override { return ENUM_CLASS(m_eNextLevelID); };
|
||||
//virtual void Capture_TerrainPreShadow(SHADOW_LIGHT_DESC& ShadowDesc);
|
||||
virtual void Capture_TerrainPreShadow();
|
||||
|
||||
private:
|
||||
//SHADOW_LIGHT_DESC m_ShadowDesc = {};
|
||||
LEVEL m_eNextLevelID = { LEVEL::END };
|
||||
class CLoader* m_pLoader = { nullptr };
|
||||
|
||||
|
||||
@@ -17,15 +17,18 @@ class CLight_Main final : public CGameObject
|
||||
virtual void Update(_float fTimeDelta) override;
|
||||
virtual void Late_Update(_float fTimeDelta) override;
|
||||
virtual HRESULT Render() override;
|
||||
virtual HRESULT Capture_PreShadow();
|
||||
|
||||
private:
|
||||
CLight* m_pLightCom = { nullptr };
|
||||
|
||||
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
HRESULT Ready_Components();
|
||||
HRESULT Bind_ShaderResources();
|
||||
_matrix Get_OffCenterProjMatrix(_fmatrix ViewMatrix, vector<_float3>& WorldPositions);
|
||||
|
||||
public:
|
||||
static CLight_Main* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
@@ -33,7 +36,6 @@ class CLight_Main final : public CGameObject
|
||||
virtual void Free() override;
|
||||
#ifdef _DEBUG
|
||||
virtual void Describe_Entity() override;
|
||||
|
||||
#endif // _DEBUG
|
||||
|
||||
};
|
||||
|
||||
@@ -77,6 +77,13 @@ DepthStencilState DSS_None
|
||||
DepthWriteMask = zero;
|
||||
};
|
||||
|
||||
DepthStencilState DSS_Default_Less
|
||||
{
|
||||
DepthEnable = true;
|
||||
DepthWriteMask = all;
|
||||
DepthFunc = less;
|
||||
};
|
||||
|
||||
DepthStencilState DSS_Effect
|
||||
{
|
||||
DepthEnable = true;
|
||||
|
||||
@@ -11,7 +11,6 @@ float g_fFar;
|
||||
float g_fShadowFar_NEAR;
|
||||
float g_fShadowFar_MIDDDLE;
|
||||
float g_fShadowFar_FAR;
|
||||
float g_fPreShadowFar;
|
||||
float g_fCascadeSplitRatioNear;
|
||||
float g_fCascadeSplitRatioFar;
|
||||
uint g_iMaxShadowWidth;
|
||||
@@ -27,6 +26,7 @@ float g_fFarBlurStart;
|
||||
float g_fFarBlurEnd;
|
||||
float g_fDOFBlurMultiplier;
|
||||
float g_fSSAO_BIAS;
|
||||
float g_fSSAOStrength;
|
||||
|
||||
Texture2D g_Texture;
|
||||
Texture2D g_SSAONoiseTexture;
|
||||
@@ -77,6 +77,7 @@ vector g_vLightSpecular;
|
||||
|
||||
float g_fFogDensity;
|
||||
float g_fFogPow;
|
||||
bool g_bFogVisible;
|
||||
vector g_vFogColor;
|
||||
|
||||
float g_fWeights_32[32] =
|
||||
@@ -220,10 +221,10 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
|
||||
|
||||
float2 uv = In.vTexcoord;
|
||||
|
||||
float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
|
||||
float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1.f);
|
||||
float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
|
||||
float fAmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
|
||||
float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1.f);
|
||||
float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
|
||||
float fSSAO_AmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
|
||||
float fViewZ = vDepth.y * g_fFar;
|
||||
|
||||
@@ -279,12 +280,12 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
|
||||
}
|
||||
else // basic Lighting(phong blinn) // if you were here, you miss some assets.
|
||||
{
|
||||
Out.vShade = g_vLightDiffuse * saturate(max(dot(normalize(g_vLightDir.xyz) * -1.f, vNormal), 0.f) + (fAmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient));
|
||||
Out.vShade = g_vLightDiffuse * saturate(max(dot(normalize(g_vLightDir.xyz) * -1.f, vNormal), 0.f) + (fSSAO_AmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient));
|
||||
Out.vSpecular = (g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(vToView * -1.f, vToLight), 0.f), 50.f);
|
||||
|
||||
Out.vSpecular.a = 0.f;
|
||||
return Out;
|
||||
}
|
||||
float fTotalOcclusion = saturate(fOcclusion * fAmbientOcclusion);
|
||||
float fTotalOcclusion = saturate(fOcclusion * fSSAO_AmbientOcclusion);
|
||||
|
||||
{ // 수치조정 // 디렉셔널
|
||||
float fMinRoughness = 0.05f;
|
||||
@@ -302,7 +303,7 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
|
||||
float3 vFinalSpecular = PBR_Out.vSpecular * g_vLightSpecular.rgb;
|
||||
|
||||
Out.vShade = float4(vFinalDiffuse, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 0.f);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -343,7 +344,7 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
|
||||
float fLightDistance = length(vFinalLightPosition - vWorldPosition.xyz);
|
||||
float3 vToView = normalize(g_vCamPosition.xyz - vWorldPosition.xyz); // 픽셀에서 카메라로
|
||||
float3 vToLight = normalize(vFinalLightPosition - vWorldPosition.xyz); // 픽셀에서 라이트로
|
||||
float fAmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
float fSSAO_AmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
|
||||
if (g_bUsePowerLightAttenuation)
|
||||
{
|
||||
@@ -358,7 +359,7 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
|
||||
if (fAttenuation <= 0.f)
|
||||
{
|
||||
Out.vShade = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 0.f);
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -391,13 +392,13 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
|
||||
}
|
||||
else // basic Lighting(phong blinn) // if you were here, you miss some assets.
|
||||
{
|
||||
Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vToLight * -1.f, vNormal), 0.f) + (fAmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient)));
|
||||
Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vToLight * -1.f, vNormal), 0.f) + (fSSAO_AmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient)));
|
||||
Out.vSpecular = fAttenuation * ((g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(vToView * -1.f, vToLight), 0.f), 50.f));
|
||||
|
||||
Out.vSpecular.a = 0.f;
|
||||
return Out;
|
||||
}
|
||||
|
||||
float fTotalOcclusion = saturate(fOcclusion * fAmbientOcclusion);
|
||||
float fTotalOcclusion = saturate(fOcclusion * fSSAO_AmbientOcclusion);
|
||||
|
||||
{ // 수치조정 // 점광원
|
||||
float fMinRoughness = 0.05f;
|
||||
@@ -415,7 +416,7 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
|
||||
float3 vFinalSpecular = PBR_Out.vSpecular * g_vLightSpecular.rgb;
|
||||
|
||||
Out.vShade = float4(vFinalDiffuse, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 0.f);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -430,7 +431,7 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
|
||||
float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1.f);
|
||||
float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
|
||||
float fAmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
float fSSAO_AmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
|
||||
float fViewZ = vDepth.y * g_fFar;
|
||||
|
||||
@@ -471,7 +472,7 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
if (fAttenuation <= 0.f)
|
||||
{
|
||||
Out.vShade = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 0.f);
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -482,7 +483,7 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
if (fCosAngle < g_fSpotOuterAngle)
|
||||
{
|
||||
Out.vShade = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 0.f);
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -519,12 +520,12 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
}
|
||||
else // basic Lighting(phong blinn) // if you were here, you miss some assets.
|
||||
{
|
||||
Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vToLight * -1.f, vNormal), 0.f) + (fAmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient)));
|
||||
Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vToLight * -1.f, vNormal), 0.f) + (fSSAO_AmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient)));
|
||||
Out.vSpecular = fAttenuation * ((g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(vToView * -1.f, vToLight), 0.f), 50.f));
|
||||
|
||||
Out.vSpecular.a = 0.f;
|
||||
return Out;
|
||||
}
|
||||
float fTotalOcclusion = saturate(fOcclusion * fAmbientOcclusion);
|
||||
float fTotalOcclusion = saturate(fOcclusion * fSSAO_AmbientOcclusion);
|
||||
|
||||
{ // 수치조정 // 점광원
|
||||
float fMinRoughness = 0.05f;
|
||||
@@ -542,7 +543,7 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
float3 vFinalSpecular = PBR_Out.vSpecular * g_vLightSpecular.rgb;
|
||||
|
||||
Out.vShade = float4(vFinalDiffuse, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 0.f);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -560,23 +561,23 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
{
|
||||
PS_OUT_BACKBUFFER Out;
|
||||
|
||||
vector vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
if (0.f == vDiffuse.a) { discard; }
|
||||
|
||||
vector vShade = g_ShadeTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
vector vSpecular = g_SpecularTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vShade = g_ShadeTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
float4 vSpecular = g_SpecularTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
vSpecular.a = 0.f;
|
||||
Out.vBackBuffer = vDiffuse * vShade + vSpecular;
|
||||
|
||||
|
||||
vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
float fViewZ = vDepthDesc.y * g_fFar;
|
||||
|
||||
|
||||
vector vPosition, vPreShadowPosition;
|
||||
float4 vPosition, vPreShadowPosition;
|
||||
|
||||
/* (로컬위치 * 월드 * 뷰 * 투영 / w) -> (로컬위치 * 월드) */
|
||||
vPosition.x = In.vTexcoord.x * 2.f - 1.f;
|
||||
@@ -607,7 +608,7 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
/* 광원의 NDC에서 샘플링 */
|
||||
float fVisibility_Dynamic_Near = ShadowVisibility_hwPCF(g_ShadowNearTexture, vNearShadowPos, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.x);
|
||||
float fVisibility_Dynamic_Middle = ShadowVisibility_hwPCF(g_ShadowMiddleTexture, vMiddleShadowPos, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.y);
|
||||
float fVisibility_Dynamic_Far = ShadowVisibility_hwPCF(g_ShadowFarTexture, vFarShadowPos, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.z);
|
||||
//float fVisibility_Dynamic_Far = ShadowVisibility_hwPCF(g_ShadowFarTexture, vFarShadowPos, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.z);
|
||||
float fVisibility_Static = ShadowVisibility_hwPCF(g_PreShadowTexture, vPreShadowPosition, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.w);
|
||||
|
||||
////////////////////////////
|
||||
@@ -620,20 +621,31 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
// 경계 주변 부드럽게 할 비중
|
||||
float fCascadeBlend_NearToMiddle = smoothstep(g_fCascadeSplitRatioNear - fShadowCascadeBlendWidthRatio,
|
||||
g_fCascadeSplitRatioNear + fShadowCascadeBlendWidthRatio, fDepthRatio);
|
||||
float fCascadeBlend_MiddleToFar = smoothstep(g_fCascadeSplitRatioFar - fShadowCascadeBlendWidthRatio,
|
||||
g_fCascadeSplitRatioFar + fShadowCascadeBlendWidthRatio, fDepthRatio);
|
||||
//float fCascadeBlend_MiddleToFar = smoothstep(g_fCascadeSplitRatioFar - fShadowCascadeBlendWidthRatio,
|
||||
// g_fCascadeSplitRatioFar + fShadowCascadeBlendWidthRatio, fDepthRatio);
|
||||
|
||||
// Near -> Middle
|
||||
float fVisibilityDynamic = lerp(fVisibility_Dynamic_Near, fVisibility_Dynamic_Middle, fCascadeBlend_NearToMiddle);
|
||||
// Middle -> Far 경계 부드럽게
|
||||
fVisibilityDynamic = lerp(fVisibilityDynamic, fVisibility_Dynamic_Far, fCascadeBlend_MiddleToFar);
|
||||
|
||||
// PreShadow(Static)로 넘어가는 구간(원하는 대로 조절)
|
||||
float fStaticShadowBlendStartRatio = 0.70f;
|
||||
float fStaticShadowBlendEndRatio = 0.95f;
|
||||
|
||||
float fStaticShadowBlendWeight = smoothstep(fStaticShadowBlendStartRatio, fStaticShadowBlendEndRatio, fDepthRatio);
|
||||
float fVisibilityCombined = lerp(fVisibilityDynamic, fVisibility_Static, fStaticShadowBlendWeight);
|
||||
//fVisibilityDynamic = lerp(fVisibilityDynamic, fVisibility_Dynamic_Far, fCascadeBlend_MiddleToFar);
|
||||
|
||||
|
||||
// 1번째 방법
|
||||
// Dynamic->Static 부드럽게 전환
|
||||
//float fVisibilityCombinedLogical = min(fVisibilityDynamic, fVisibility_Static);
|
||||
//float fStaticShadowBlendStartRatio = g_fCascadeSplitRatioFar;
|
||||
//float fStaticShadowBlendWidthRatio = 0.05f;
|
||||
//float fStaticShadowBlendEndRatio = min(1.0f, fStaticShadowBlendStartRatio + fStaticShadowBlendWidthRatio);
|
||||
//float fStaticShadowBlendWeight = smoothstep(fStaticShadowBlendStartRatio, fStaticShadowBlendEndRatio, fDepthRatio);
|
||||
//float fVisibilityCombined = lerp(fVisibilityDynamic, fVisibilityCombinedLogical, fStaticShadowBlendWeight);
|
||||
|
||||
// 2번째 방법
|
||||
// Dynamic * Static 항상 최소곱
|
||||
//float fVisibilityCombined = saturate(fVisibilityDynamic * fVisibility_Static);
|
||||
|
||||
// 3번째 방법
|
||||
// Dynamic , Static 최소값만 취함
|
||||
float fVisibilityCombined = min(fVisibilityDynamic, fVisibility_Static);
|
||||
|
||||
// 최소 밝기
|
||||
float fMinShadowBrightness = 0.25f;
|
||||
@@ -644,7 +656,7 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
|
||||
////////////////////////////
|
||||
// 블러 추가
|
||||
float4 vColor = 0.f;
|
||||
float3 vColor = { 0.f, 0.f, 0.f };
|
||||
|
||||
/* (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 ) -> (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 * (/w) */
|
||||
float2 vTexcoord;
|
||||
@@ -656,10 +668,10 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
vTexcoord.x = In.vTexcoord.x;
|
||||
vTexcoord.y = In.vTexcoord.y + (float) i / g_vResolution.y;
|
||||
|
||||
vColor += g_fWeights_128[i + 63] * g_BlurXTexture.Sample(BorderZeroSampler, vTexcoord);
|
||||
vColor += g_fWeights_128[i + 63] * g_BlurXTexture.Sample(BorderZeroSampler, vTexcoord).rgb;
|
||||
}
|
||||
|
||||
Out.vBackBuffer += vColor;
|
||||
Out.vBackBuffer.rgb += vColor;
|
||||
Out.vEnvironment = Out.vBackBuffer;
|
||||
|
||||
return Out;
|
||||
@@ -839,14 +851,15 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In)
|
||||
{
|
||||
PS_OUT_BLUR_X Out;
|
||||
|
||||
vector vDepthDesc;
|
||||
float2 vTexcoord;
|
||||
float4 vDepthDesc = float4(0.f, 0.f, 0.f, 1.f);
|
||||
float3 vColor = float3(0.f, 0.f, 0.f);
|
||||
float2 vTexcoord = In.vTexcoord;
|
||||
float fSampleViewZ;
|
||||
float4 vColor = 0.f;
|
||||
float fBlurAmount = 0.0f;
|
||||
|
||||
float4 vCenter = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vOriginal = g_BlurTexture.Sample(BorderZeroSampler, In.vTexcoord);
|
||||
float4 vCenter = g_DepthTexture.Sample(DefaultSampler, vTexcoord);
|
||||
float4 vOriginal = g_BlurTexture.Sample(PointSampler, vTexcoord);
|
||||
float fOriginalAlpha = vOriginal.a;
|
||||
float fCenterViewZ = vCenter.y * g_fFar;
|
||||
|
||||
float fTerrain = (1.f / 255.f);
|
||||
@@ -880,7 +893,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In)
|
||||
|
||||
vDepthDesc = g_DepthTexture.Sample(DefaultSampler, vTexcoord);
|
||||
|
||||
if (false == AlmostEqual3(vDepthDesc.a, fTerrain))
|
||||
if (false == AlmostEqual3(vDepthDesc.w, fTerrain))
|
||||
{ // 터레인셀이 아니면 스킵
|
||||
continue;
|
||||
}
|
||||
@@ -890,7 +903,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In)
|
||||
continue;
|
||||
}
|
||||
|
||||
vColor += g_fWeights_32[i + 16] * g_BlurTexture.Sample(BorderZeroSampler, vTexcoord);
|
||||
vColor += g_fWeights_32[i + 16] * g_BlurTexture.Sample(BorderZeroSampler, vTexcoord).rgb;
|
||||
fAcc += g_fWeights_32[i + 16];
|
||||
}
|
||||
|
||||
@@ -902,10 +915,23 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In)
|
||||
}
|
||||
else
|
||||
{
|
||||
vColor.xyz /= fAcc;
|
||||
vColor /= fAcc;
|
||||
}
|
||||
|
||||
Out.vBlurX = vColor;
|
||||
float fOriginalLumen = length(vOriginal.rgb); // 원본 빛양을 보존
|
||||
float fBlurLumen = length(vColor);
|
||||
|
||||
float fLumenScale = 1.0f;
|
||||
if (fBlurLumen > FLT_EPSILON3)
|
||||
{
|
||||
fLumenScale = fOriginalLumen / fBlurLumen;
|
||||
}
|
||||
float3 vBlurAdjusted = vColor * fLumenScale;
|
||||
|
||||
float fBlendAmount = saturate(fBlurAmount * g_fDOFBlurMultiplier);
|
||||
float3 vFinalColor = lerp(vOriginal.rgb, vBlurAdjusted, fBlendAmount);
|
||||
|
||||
Out.vBlurX = float4(vColor, fOriginalAlpha);
|
||||
Out.vBlurWeight = fAcc;
|
||||
|
||||
return Out;
|
||||
@@ -914,14 +940,16 @@ PS_OUT_BACKBUFFER PS_MAIN_POSTCOMBINED(PS_IN In)
|
||||
{
|
||||
PS_OUT_BACKBUFFER Out;
|
||||
|
||||
vector vDepthDesc;
|
||||
float2 vTexcoord;
|
||||
float4 vDepthDesc = float4(0.f, 0.f, 0.f, 1.f);
|
||||
float3 vColor = float3(0.f, 0.f, 0.f);
|
||||
float2 vTexcoord = In.vTexcoord;
|
||||
float fSampleViewZ;
|
||||
float4 vColor = 0.f;
|
||||
float fBlurAmount = 0.0f;
|
||||
|
||||
float4 vOriginal = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vCenter = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vCenter = g_DepthTexture.Sample(DefaultSampler, vTexcoord);
|
||||
float4 vOriginal = g_DiffuseTexture.Sample(PointSampler, vTexcoord);
|
||||
float4 vXBlur = g_BlurTexture.Sample(BorderZeroSampler, vTexcoord);
|
||||
float fOriginalAlpha = vOriginal.a;
|
||||
float fCenterViewZ = vCenter.y * g_fFar;
|
||||
|
||||
float fTerrain = (1.f / 255.f);
|
||||
@@ -933,16 +961,16 @@ PS_OUT_BACKBUFFER PS_MAIN_POSTCOMBINED(PS_IN In)
|
||||
}
|
||||
|
||||
if (fCenterViewZ > g_fFocusDistance)
|
||||
{
|
||||
{
|
||||
// 현재 셀이 초점거리보다 멀면 블러
|
||||
// 블러되는 양은 (현재 셀의 거리가 얼마나 더 멀리 있냐) // END보다 멀면 최대치이므로 saturate
|
||||
float fValue = saturate((fCenterViewZ - g_fFarBlurStart) / (g_fFarBlurEnd - g_fFarBlurStart));
|
||||
fBlurAmount = fValue; // 0~1
|
||||
}
|
||||
|
||||
if (fBlurAmount <= FLT_EPSILON3)
|
||||
if (fBlurAmount <= FLT_EPSILON3)
|
||||
{
|
||||
// 최소치 이내면 블러 스킵
|
||||
// 최소치 이내면 블러 안함
|
||||
Out.vBackBuffer = vOriginal;
|
||||
Out.vEnvironment = 0.0f;
|
||||
return Out;
|
||||
@@ -956,7 +984,7 @@ PS_OUT_BACKBUFFER PS_MAIN_POSTCOMBINED(PS_IN In)
|
||||
|
||||
vDepthDesc = g_DepthTexture.Sample(DefaultSampler, vTexcoord);
|
||||
|
||||
if (false == AlmostEqual3(vDepthDesc.a, fTerrain))
|
||||
if (false == AlmostEqual3(vDepthDesc.w, fTerrain))
|
||||
{ // 터레인셀이 아니면 스킵
|
||||
continue;
|
||||
}
|
||||
@@ -966,7 +994,7 @@ PS_OUT_BACKBUFFER PS_MAIN_POSTCOMBINED(PS_IN In)
|
||||
continue;
|
||||
}
|
||||
|
||||
vColor += g_fWeights_32[i + 16] * g_BlurTexture.Sample(BorderZeroSampler, vTexcoord);
|
||||
vColor += g_fWeights_32[i + 16] * g_BlurTexture.Sample(BorderZeroSampler, vTexcoord).rgb;
|
||||
fAcc += g_fWeights_32[i + 16];
|
||||
}
|
||||
if (fAcc <= FLT_EPSILON3)
|
||||
@@ -974,28 +1002,27 @@ PS_OUT_BACKBUFFER PS_MAIN_POSTCOMBINED(PS_IN In)
|
||||
Out.vBackBuffer = vOriginal;
|
||||
Out.vEnvironment = 0.0f;
|
||||
return Out;
|
||||
return Out;
|
||||
}
|
||||
else
|
||||
{
|
||||
vColor.xyz /= fAcc;
|
||||
vColor /= fAcc;
|
||||
}
|
||||
|
||||
float fOriginalLumen = length(vOriginal.rgb);
|
||||
float fBlurLumen = length(vColor.rgb);
|
||||
float fOriginalLumen = length(vOriginal.rgb); // 원본 빛양을 보존
|
||||
float fBlurLumen = length(vColor);
|
||||
|
||||
float fLumenScale = 1.0f;
|
||||
if (fBlurLumen > 1e-4f)
|
||||
if (fBlurLumen > FLT_EPSILON3)
|
||||
{
|
||||
fLumenScale = fOriginalLumen / fBlurLumen;
|
||||
}
|
||||
float3 vBlurMatched = vColor.rgb * fLumenScale;
|
||||
float3 vBlurAdjusted = vColor * fLumenScale;
|
||||
|
||||
float fBlendAmount = saturate(fBlurAmount * g_fDOFBlurMultiplier);
|
||||
float3 finalColor = lerp(vOriginal.rgb, vBlurMatched, fBlendAmount);
|
||||
float3 vFinalColor = lerp(vOriginal.rgb, vBlurAdjusted, fBlendAmount);
|
||||
|
||||
Out.vBackBuffer = float4(finalColor.xyz, vOriginal.a);
|
||||
Out.vEnvironment = 0.f;
|
||||
Out.vBackBuffer = float4(vColor, fOriginalAlpha);
|
||||
Out.vEnvironment = fAcc;
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -1023,26 +1050,30 @@ PS_OUT_FLT4_SINGLE PS_MAIN_FOG(PS_IN In)
|
||||
{
|
||||
PS_OUT_FLT4_SINGLE Out;
|
||||
|
||||
vector vColor = g_OriginalTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
vector vFinalColor;
|
||||
float fViewZ = vDepthDesc.y * g_fFar;
|
||||
|
||||
float fRatio;
|
||||
|
||||
|
||||
fRatio = pow(1.f - saturate(exp(-1.f * vDepthDesc.y * g_fFogDensity)), g_fFogPow);
|
||||
|
||||
vFinalColor = lerp(vColor, g_vFogColor, fRatio);
|
||||
vFinalColor.a = 1.f;
|
||||
|
||||
if (1.f == vDepthDesc.y)
|
||||
float4 vColor = g_OriginalTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
if (true == g_bFogVisible)
|
||||
{
|
||||
vFinalColor = float4(g_vFogColor);
|
||||
}
|
||||
Out.vFirstTarget = vFinalColor;
|
||||
float4 vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float fOriginalAlpha = vColor.a;
|
||||
float fViewZ = vDepthDesc.y * g_fFar;
|
||||
|
||||
float4 vFinalColor;
|
||||
float fRatio = pow(1.f - saturate(exp(-1.f * vDepthDesc.y * g_fFogDensity)), g_fFogPow);
|
||||
|
||||
vFinalColor = lerp(vColor, g_vFogColor, fRatio);
|
||||
|
||||
if (1.f == vDepthDesc.y)
|
||||
{
|
||||
vFinalColor = float4(g_vFogColor);
|
||||
}
|
||||
vFinalColor.a = 1.f; // fOriginalAlpha;
|
||||
Out.vFirstTarget = vFinalColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
vColor.a = 1.f;
|
||||
Out.vFirstTarget = vColor;
|
||||
}
|
||||
return Out;
|
||||
}
|
||||
PS_OUT_BACKBUFFER PS_TONE_MAPPING(PS_IN In)
|
||||
@@ -1127,7 +1158,7 @@ PS_OUT_SSAO_AMBIENT_OCCLUSION PS_SSAO_AMBIENT_OCCLUSION(PS_IN In)
|
||||
fIsOccluded *= fRangeCheck;
|
||||
fOcclusion += fIsOccluded;
|
||||
}
|
||||
fOcclusion = (1.f - (fOcclusion / g_iKernelSize) * fRatio);
|
||||
fOcclusion = saturate(1.f - (fOcclusion * g_fSSAOStrength / g_iKernelSize) * fRatio);
|
||||
Out.fOcclusion = fOcclusion ;
|
||||
|
||||
return Out;
|
||||
|
||||
@@ -567,7 +567,7 @@ technique11 DefaultTechnique
|
||||
pass ShadowPass // 1
|
||||
{
|
||||
SetRasterizerState(RS_Default);
|
||||
SetDepthStencilState(DSS_Default, 0);
|
||||
SetDepthStencilState(DSS_Default_Less, 0);
|
||||
SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
|
||||
VertexShader = compile vs_5_0 VS_MAIN_SHADOW();
|
||||
GeometryShader = NULL;
|
||||
|
||||
@@ -820,7 +820,7 @@ technique11 MeshTechnique11
|
||||
pass ShadowPass
|
||||
{
|
||||
SetRasterizerState(RS_Default);
|
||||
SetDepthStencilState(DSS_Default, 0);
|
||||
SetDepthStencilState(DSS_Default_Less, 0);
|
||||
SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
|
||||
VertexShader = compile vs_5_0 VS_MAIN_SHADOW();
|
||||
GeometryShader = NULL;
|
||||
|
||||
@@ -249,7 +249,7 @@ technique11 NorTexTechnique11
|
||||
pass ShadowPass // 3
|
||||
{
|
||||
SetRasterizerState(RS_Default);
|
||||
SetDepthStencilState(DSS_Default, 0);
|
||||
SetDepthStencilState(DSS_Default_Less, 0);
|
||||
SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
|
||||
VertexShader = compile vs_5_0 VS_MAIN_SHADOW();
|
||||
GeometryShader = NULL;
|
||||
|
||||
@@ -77,6 +77,13 @@ DepthStencilState DSS_None
|
||||
DepthWriteMask = zero;
|
||||
};
|
||||
|
||||
DepthStencilState DSS_Default_Less
|
||||
{
|
||||
DepthEnable = true;
|
||||
DepthWriteMask = all;
|
||||
DepthFunc = less;
|
||||
};
|
||||
|
||||
DepthStencilState DSS_Effect
|
||||
{
|
||||
DepthEnable = true;
|
||||
|
||||
@@ -11,7 +11,6 @@ float g_fFar;
|
||||
float g_fShadowFar_NEAR;
|
||||
float g_fShadowFar_MIDDDLE;
|
||||
float g_fShadowFar_FAR;
|
||||
float g_fPreShadowFar;
|
||||
float g_fCascadeSplitRatioNear;
|
||||
float g_fCascadeSplitRatioFar;
|
||||
uint g_iMaxShadowWidth;
|
||||
@@ -27,6 +26,7 @@ float g_fFarBlurStart;
|
||||
float g_fFarBlurEnd;
|
||||
float g_fDOFBlurMultiplier;
|
||||
float g_fSSAO_BIAS;
|
||||
float g_fSSAOStrength;
|
||||
|
||||
Texture2D g_Texture;
|
||||
Texture2D g_SSAONoiseTexture;
|
||||
@@ -77,6 +77,7 @@ vector g_vLightSpecular;
|
||||
|
||||
float g_fFogDensity;
|
||||
float g_fFogPow;
|
||||
bool g_bFogVisible;
|
||||
vector g_vFogColor;
|
||||
|
||||
float g_fWeights_32[32] =
|
||||
@@ -220,10 +221,10 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
|
||||
|
||||
float2 uv = In.vTexcoord;
|
||||
|
||||
float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
|
||||
float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1.f);
|
||||
float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
|
||||
float fAmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
|
||||
float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1.f);
|
||||
float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
|
||||
float fSSAO_AmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
|
||||
float fViewZ = vDepth.y * g_fFar;
|
||||
|
||||
@@ -279,12 +280,12 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
|
||||
}
|
||||
else // basic Lighting(phong blinn) // if you were here, you miss some assets.
|
||||
{
|
||||
Out.vShade = g_vLightDiffuse * saturate(max(dot(normalize(g_vLightDir.xyz) * -1.f, vNormal), 0.f) + (fAmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient));
|
||||
Out.vShade = g_vLightDiffuse * saturate(max(dot(normalize(g_vLightDir.xyz) * -1.f, vNormal), 0.f) + (fSSAO_AmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient));
|
||||
Out.vSpecular = (g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(vToView * -1.f, vToLight), 0.f), 50.f);
|
||||
|
||||
Out.vSpecular.a = 0.f;
|
||||
return Out;
|
||||
}
|
||||
float fTotalOcclusion = saturate(fOcclusion * fAmbientOcclusion);
|
||||
float fTotalOcclusion = saturate(fOcclusion * fSSAO_AmbientOcclusion);
|
||||
|
||||
{ // 수치조정 // 디렉셔널
|
||||
float fMinRoughness = 0.05f;
|
||||
@@ -302,7 +303,7 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
|
||||
float3 vFinalSpecular = PBR_Out.vSpecular * g_vLightSpecular.rgb;
|
||||
|
||||
Out.vShade = float4(vFinalDiffuse, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 0.f);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -343,7 +344,7 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
|
||||
float fLightDistance = length(vFinalLightPosition - vWorldPosition.xyz);
|
||||
float3 vToView = normalize(g_vCamPosition.xyz - vWorldPosition.xyz); // 픽셀에서 카메라로
|
||||
float3 vToLight = normalize(vFinalLightPosition - vWorldPosition.xyz); // 픽셀에서 라이트로
|
||||
float fAmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
float fSSAO_AmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
|
||||
if (g_bUsePowerLightAttenuation)
|
||||
{
|
||||
@@ -358,7 +359,7 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
|
||||
if (fAttenuation <= 0.f)
|
||||
{
|
||||
Out.vShade = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 0.f);
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -391,13 +392,13 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
|
||||
}
|
||||
else // basic Lighting(phong blinn) // if you were here, you miss some assets.
|
||||
{
|
||||
Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vToLight * -1.f, vNormal), 0.f) + (fAmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient)));
|
||||
Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vToLight * -1.f, vNormal), 0.f) + (fSSAO_AmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient)));
|
||||
Out.vSpecular = fAttenuation * ((g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(vToView * -1.f, vToLight), 0.f), 50.f));
|
||||
|
||||
Out.vSpecular.a = 0.f;
|
||||
return Out;
|
||||
}
|
||||
|
||||
float fTotalOcclusion = saturate(fOcclusion * fAmbientOcclusion);
|
||||
float fTotalOcclusion = saturate(fOcclusion * fSSAO_AmbientOcclusion);
|
||||
|
||||
{ // 수치조정 // 점광원
|
||||
float fMinRoughness = 0.05f;
|
||||
@@ -415,7 +416,7 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
|
||||
float3 vFinalSpecular = PBR_Out.vSpecular * g_vLightSpecular.rgb;
|
||||
|
||||
Out.vShade = float4(vFinalDiffuse, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 0.f);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -430,7 +431,7 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
|
||||
float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1.f);
|
||||
float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
|
||||
float fAmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
float fSSAO_AmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
|
||||
float fViewZ = vDepth.y * g_fFar;
|
||||
|
||||
@@ -471,7 +472,7 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
if (fAttenuation <= 0.f)
|
||||
{
|
||||
Out.vShade = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 0.f);
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -482,7 +483,7 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
if (fCosAngle < g_fSpotOuterAngle)
|
||||
{
|
||||
Out.vShade = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 0.f);
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -519,12 +520,12 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
}
|
||||
else // basic Lighting(phong blinn) // if you were here, you miss some assets.
|
||||
{
|
||||
Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vToLight * -1.f, vNormal), 0.f) + (fAmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient)));
|
||||
Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vToLight * -1.f, vNormal), 0.f) + (fSSAO_AmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient)));
|
||||
Out.vSpecular = fAttenuation * ((g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(vToView * -1.f, vToLight), 0.f), 50.f));
|
||||
|
||||
Out.vSpecular.a = 0.f;
|
||||
return Out;
|
||||
}
|
||||
float fTotalOcclusion = saturate(fOcclusion * fAmbientOcclusion);
|
||||
float fTotalOcclusion = saturate(fOcclusion * fSSAO_AmbientOcclusion);
|
||||
|
||||
{ // 수치조정 // 점광원
|
||||
float fMinRoughness = 0.05f;
|
||||
@@ -542,7 +543,7 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
float3 vFinalSpecular = PBR_Out.vSpecular * g_vLightSpecular.rgb;
|
||||
|
||||
Out.vShade = float4(vFinalDiffuse, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 0.f);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -560,23 +561,23 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
{
|
||||
PS_OUT_BACKBUFFER Out;
|
||||
|
||||
vector vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
if (0.f == vDiffuse.a) { discard; }
|
||||
|
||||
vector vShade = g_ShadeTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
vector vSpecular = g_SpecularTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vShade = g_ShadeTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
float4 vSpecular = g_SpecularTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
vSpecular.a = 0.f;
|
||||
Out.vBackBuffer = vDiffuse * vShade + vSpecular;
|
||||
|
||||
|
||||
vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
float fViewZ = vDepthDesc.y * g_fFar;
|
||||
|
||||
|
||||
vector vPosition, vPreShadowPosition;
|
||||
float4 vPosition, vPreShadowPosition;
|
||||
|
||||
/* (로컬위치 * 월드 * 뷰 * 투영 / w) -> (로컬위치 * 월드) */
|
||||
vPosition.x = In.vTexcoord.x * 2.f - 1.f;
|
||||
@@ -607,7 +608,7 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
/* 광원의 NDC에서 샘플링 */
|
||||
float fVisibility_Dynamic_Near = ShadowVisibility_hwPCF(g_ShadowNearTexture, vNearShadowPos, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.x);
|
||||
float fVisibility_Dynamic_Middle = ShadowVisibility_hwPCF(g_ShadowMiddleTexture, vMiddleShadowPos, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.y);
|
||||
float fVisibility_Dynamic_Far = ShadowVisibility_hwPCF(g_ShadowFarTexture, vFarShadowPos, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.z);
|
||||
//float fVisibility_Dynamic_Far = ShadowVisibility_hwPCF(g_ShadowFarTexture, vFarShadowPos, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.z);
|
||||
float fVisibility_Static = ShadowVisibility_hwPCF(g_PreShadowTexture, vPreShadowPosition, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.w);
|
||||
|
||||
////////////////////////////
|
||||
@@ -620,20 +621,31 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
// 경계 주변 부드럽게 할 비중
|
||||
float fCascadeBlend_NearToMiddle = smoothstep(g_fCascadeSplitRatioNear - fShadowCascadeBlendWidthRatio,
|
||||
g_fCascadeSplitRatioNear + fShadowCascadeBlendWidthRatio, fDepthRatio);
|
||||
float fCascadeBlend_MiddleToFar = smoothstep(g_fCascadeSplitRatioFar - fShadowCascadeBlendWidthRatio,
|
||||
g_fCascadeSplitRatioFar + fShadowCascadeBlendWidthRatio, fDepthRatio);
|
||||
//float fCascadeBlend_MiddleToFar = smoothstep(g_fCascadeSplitRatioFar - fShadowCascadeBlendWidthRatio,
|
||||
// g_fCascadeSplitRatioFar + fShadowCascadeBlendWidthRatio, fDepthRatio);
|
||||
|
||||
// Near -> Middle
|
||||
float fVisibilityDynamic = lerp(fVisibility_Dynamic_Near, fVisibility_Dynamic_Middle, fCascadeBlend_NearToMiddle);
|
||||
// Middle -> Far 경계 부드럽게
|
||||
fVisibilityDynamic = lerp(fVisibilityDynamic, fVisibility_Dynamic_Far, fCascadeBlend_MiddleToFar);
|
||||
|
||||
// PreShadow(Static)로 넘어가는 구간(원하는 대로 조절)
|
||||
float fStaticShadowBlendStartRatio = 0.70f;
|
||||
float fStaticShadowBlendEndRatio = 0.95f;
|
||||
|
||||
float fStaticShadowBlendWeight = smoothstep(fStaticShadowBlendStartRatio, fStaticShadowBlendEndRatio, fDepthRatio);
|
||||
float fVisibilityCombined = lerp(fVisibilityDynamic, fVisibility_Static, fStaticShadowBlendWeight);
|
||||
//fVisibilityDynamic = lerp(fVisibilityDynamic, fVisibility_Dynamic_Far, fCascadeBlend_MiddleToFar);
|
||||
|
||||
|
||||
// 1번째 방법
|
||||
// Dynamic->Static 부드럽게 전환
|
||||
//float fVisibilityCombinedLogical = min(fVisibilityDynamic, fVisibility_Static);
|
||||
//float fStaticShadowBlendStartRatio = g_fCascadeSplitRatioFar;
|
||||
//float fStaticShadowBlendWidthRatio = 0.05f;
|
||||
//float fStaticShadowBlendEndRatio = min(1.0f, fStaticShadowBlendStartRatio + fStaticShadowBlendWidthRatio);
|
||||
//float fStaticShadowBlendWeight = smoothstep(fStaticShadowBlendStartRatio, fStaticShadowBlendEndRatio, fDepthRatio);
|
||||
//float fVisibilityCombined = lerp(fVisibilityDynamic, fVisibilityCombinedLogical, fStaticShadowBlendWeight);
|
||||
|
||||
// 2번째 방법
|
||||
// Dynamic * Static 항상 최소곱
|
||||
//float fVisibilityCombined = saturate(fVisibilityDynamic * fVisibility_Static);
|
||||
|
||||
// 3번째 방법
|
||||
// Dynamic , Static 최소값만 취함
|
||||
float fVisibilityCombined = min(fVisibilityDynamic, fVisibility_Static);
|
||||
|
||||
// 최소 밝기
|
||||
float fMinShadowBrightness = 0.25f;
|
||||
@@ -644,7 +656,7 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
|
||||
////////////////////////////
|
||||
// 블러 추가
|
||||
float4 vColor = 0.f;
|
||||
float3 vColor = { 0.f, 0.f, 0.f };
|
||||
|
||||
/* (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 ) -> (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 * (/w) */
|
||||
float2 vTexcoord;
|
||||
@@ -656,10 +668,10 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
vTexcoord.x = In.vTexcoord.x;
|
||||
vTexcoord.y = In.vTexcoord.y + (float) i / g_vResolution.y;
|
||||
|
||||
vColor += g_fWeights_128[i + 63] * g_BlurXTexture.Sample(BorderZeroSampler, vTexcoord);
|
||||
vColor += g_fWeights_128[i + 63] * g_BlurXTexture.Sample(BorderZeroSampler, vTexcoord).rgb;
|
||||
}
|
||||
|
||||
Out.vBackBuffer += vColor;
|
||||
Out.vBackBuffer.rgb += vColor;
|
||||
Out.vEnvironment = Out.vBackBuffer;
|
||||
|
||||
return Out;
|
||||
@@ -839,14 +851,15 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In)
|
||||
{
|
||||
PS_OUT_BLUR_X Out;
|
||||
|
||||
vector vDepthDesc;
|
||||
float2 vTexcoord;
|
||||
float4 vDepthDesc = float4(0.f, 0.f, 0.f, 1.f);
|
||||
float3 vColor = float3(0.f, 0.f, 0.f);
|
||||
float2 vTexcoord = In.vTexcoord;
|
||||
float fSampleViewZ;
|
||||
float4 vColor = 0.f;
|
||||
float fBlurAmount = 0.0f;
|
||||
|
||||
float4 vCenter = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vOriginal = g_BlurTexture.Sample(BorderZeroSampler, In.vTexcoord);
|
||||
float4 vCenter = g_DepthTexture.Sample(DefaultSampler, vTexcoord);
|
||||
float4 vOriginal = g_BlurTexture.Sample(PointSampler, vTexcoord);
|
||||
float fOriginalAlpha = vOriginal.a;
|
||||
float fCenterViewZ = vCenter.y * g_fFar;
|
||||
|
||||
float fTerrain = (1.f / 255.f);
|
||||
@@ -880,7 +893,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In)
|
||||
|
||||
vDepthDesc = g_DepthTexture.Sample(DefaultSampler, vTexcoord);
|
||||
|
||||
if (false == AlmostEqual3(vDepthDesc.a, fTerrain))
|
||||
if (false == AlmostEqual3(vDepthDesc.w, fTerrain))
|
||||
{ // 터레인셀이 아니면 스킵
|
||||
continue;
|
||||
}
|
||||
@@ -890,7 +903,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In)
|
||||
continue;
|
||||
}
|
||||
|
||||
vColor += g_fWeights_32[i + 16] * g_BlurTexture.Sample(BorderZeroSampler, vTexcoord);
|
||||
vColor += g_fWeights_32[i + 16] * g_BlurTexture.Sample(BorderZeroSampler, vTexcoord).rgb;
|
||||
fAcc += g_fWeights_32[i + 16];
|
||||
}
|
||||
|
||||
@@ -902,10 +915,23 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In)
|
||||
}
|
||||
else
|
||||
{
|
||||
vColor.xyz /= fAcc;
|
||||
vColor /= fAcc;
|
||||
}
|
||||
|
||||
Out.vBlurX = vColor;
|
||||
float fOriginalLumen = length(vOriginal.rgb); // 원본 빛양을 보존
|
||||
float fBlurLumen = length(vColor);
|
||||
|
||||
float fLumenScale = 1.0f;
|
||||
if (fBlurLumen > FLT_EPSILON3)
|
||||
{
|
||||
fLumenScale = fOriginalLumen / fBlurLumen;
|
||||
}
|
||||
float3 vBlurAdjusted = vColor * fLumenScale;
|
||||
|
||||
float fBlendAmount = saturate(fBlurAmount * g_fDOFBlurMultiplier);
|
||||
float3 vFinalColor = lerp(vOriginal.rgb, vBlurAdjusted, fBlendAmount);
|
||||
|
||||
Out.vBlurX = float4(vColor, fOriginalAlpha);
|
||||
Out.vBlurWeight = fAcc;
|
||||
|
||||
return Out;
|
||||
@@ -914,14 +940,16 @@ PS_OUT_BACKBUFFER PS_MAIN_POSTCOMBINED(PS_IN In)
|
||||
{
|
||||
PS_OUT_BACKBUFFER Out;
|
||||
|
||||
vector vDepthDesc;
|
||||
float2 vTexcoord;
|
||||
float4 vDepthDesc = float4(0.f, 0.f, 0.f, 1.f);
|
||||
float3 vColor = float3(0.f, 0.f, 0.f);
|
||||
float2 vTexcoord = In.vTexcoord;
|
||||
float fSampleViewZ;
|
||||
float4 vColor = 0.f;
|
||||
float fBlurAmount = 0.0f;
|
||||
|
||||
float4 vOriginal = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vCenter = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vCenter = g_DepthTexture.Sample(DefaultSampler, vTexcoord);
|
||||
float4 vOriginal = g_DiffuseTexture.Sample(PointSampler, vTexcoord);
|
||||
float4 vXBlur = g_BlurTexture.Sample(BorderZeroSampler, vTexcoord);
|
||||
float fOriginalAlpha = vOriginal.a;
|
||||
float fCenterViewZ = vCenter.y * g_fFar;
|
||||
|
||||
float fTerrain = (1.f / 255.f);
|
||||
@@ -933,16 +961,16 @@ PS_OUT_BACKBUFFER PS_MAIN_POSTCOMBINED(PS_IN In)
|
||||
}
|
||||
|
||||
if (fCenterViewZ > g_fFocusDistance)
|
||||
{
|
||||
{
|
||||
// 현재 셀이 초점거리보다 멀면 블러
|
||||
// 블러되는 양은 (현재 셀의 거리가 얼마나 더 멀리 있냐) // END보다 멀면 최대치이므로 saturate
|
||||
float fValue = saturate((fCenterViewZ - g_fFarBlurStart) / (g_fFarBlurEnd - g_fFarBlurStart));
|
||||
fBlurAmount = fValue; // 0~1
|
||||
}
|
||||
|
||||
if (fBlurAmount <= FLT_EPSILON3)
|
||||
if (fBlurAmount <= FLT_EPSILON3)
|
||||
{
|
||||
// 최소치 이내면 블러 스킵
|
||||
// 최소치 이내면 블러 안함
|
||||
Out.vBackBuffer = vOriginal;
|
||||
Out.vEnvironment = 0.0f;
|
||||
return Out;
|
||||
@@ -956,7 +984,7 @@ PS_OUT_BACKBUFFER PS_MAIN_POSTCOMBINED(PS_IN In)
|
||||
|
||||
vDepthDesc = g_DepthTexture.Sample(DefaultSampler, vTexcoord);
|
||||
|
||||
if (false == AlmostEqual3(vDepthDesc.a, fTerrain))
|
||||
if (false == AlmostEqual3(vDepthDesc.w, fTerrain))
|
||||
{ // 터레인셀이 아니면 스킵
|
||||
continue;
|
||||
}
|
||||
@@ -966,7 +994,7 @@ PS_OUT_BACKBUFFER PS_MAIN_POSTCOMBINED(PS_IN In)
|
||||
continue;
|
||||
}
|
||||
|
||||
vColor += g_fWeights_32[i + 16] * g_BlurTexture.Sample(BorderZeroSampler, vTexcoord);
|
||||
vColor += g_fWeights_32[i + 16] * g_BlurTexture.Sample(BorderZeroSampler, vTexcoord).rgb;
|
||||
fAcc += g_fWeights_32[i + 16];
|
||||
}
|
||||
if (fAcc <= FLT_EPSILON3)
|
||||
@@ -974,28 +1002,27 @@ PS_OUT_BACKBUFFER PS_MAIN_POSTCOMBINED(PS_IN In)
|
||||
Out.vBackBuffer = vOriginal;
|
||||
Out.vEnvironment = 0.0f;
|
||||
return Out;
|
||||
return Out;
|
||||
}
|
||||
else
|
||||
{
|
||||
vColor.xyz /= fAcc;
|
||||
vColor /= fAcc;
|
||||
}
|
||||
|
||||
float fOriginalLumen = length(vOriginal.rgb);
|
||||
float fBlurLumen = length(vColor.rgb);
|
||||
float fOriginalLumen = length(vOriginal.rgb); // 원본 빛양을 보존
|
||||
float fBlurLumen = length(vColor);
|
||||
|
||||
float fLumenScale = 1.0f;
|
||||
if (fBlurLumen > 1e-4f)
|
||||
if (fBlurLumen > FLT_EPSILON3)
|
||||
{
|
||||
fLumenScale = fOriginalLumen / fBlurLumen;
|
||||
}
|
||||
float3 vBlurMatched = vColor.rgb * fLumenScale;
|
||||
float3 vBlurAdjusted = vColor * fLumenScale;
|
||||
|
||||
float fBlendAmount = saturate(fBlurAmount * g_fDOFBlurMultiplier);
|
||||
float3 finalColor = lerp(vOriginal.rgb, vBlurMatched, fBlendAmount);
|
||||
float3 vFinalColor = lerp(vOriginal.rgb, vBlurAdjusted, fBlendAmount);
|
||||
|
||||
Out.vBackBuffer = float4(finalColor.xyz, vOriginal.a);
|
||||
Out.vEnvironment = 0.f;
|
||||
Out.vBackBuffer = float4(vColor, fOriginalAlpha);
|
||||
Out.vEnvironment = fAcc;
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -1023,26 +1050,30 @@ PS_OUT_FLT4_SINGLE PS_MAIN_FOG(PS_IN In)
|
||||
{
|
||||
PS_OUT_FLT4_SINGLE Out;
|
||||
|
||||
vector vColor = g_OriginalTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
vector vFinalColor;
|
||||
float fViewZ = vDepthDesc.y * g_fFar;
|
||||
|
||||
float fRatio;
|
||||
|
||||
|
||||
fRatio = pow(1.f - saturate(exp(-1.f * vDepthDesc.y * g_fFogDensity)), g_fFogPow);
|
||||
|
||||
vFinalColor = lerp(vColor, g_vFogColor, fRatio);
|
||||
vFinalColor.a = 1.f;
|
||||
|
||||
if (1.f == vDepthDesc.y)
|
||||
float4 vColor = g_OriginalTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
if (true == g_bFogVisible)
|
||||
{
|
||||
vFinalColor = float4(g_vFogColor);
|
||||
}
|
||||
Out.vFirstTarget = vFinalColor;
|
||||
float4 vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float fOriginalAlpha = vColor.a;
|
||||
float fViewZ = vDepthDesc.y * g_fFar;
|
||||
|
||||
float4 vFinalColor;
|
||||
float fRatio = pow(1.f - saturate(exp(-1.f * vDepthDesc.y * g_fFogDensity)), g_fFogPow);
|
||||
|
||||
vFinalColor = lerp(vColor, g_vFogColor, fRatio);
|
||||
|
||||
if (1.f == vDepthDesc.y)
|
||||
{
|
||||
vFinalColor = float4(g_vFogColor);
|
||||
}
|
||||
vFinalColor.a = 1.f; // fOriginalAlpha;
|
||||
Out.vFirstTarget = vFinalColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
vColor.a = 1.f;
|
||||
Out.vFirstTarget = vColor;
|
||||
}
|
||||
return Out;
|
||||
}
|
||||
PS_OUT_BACKBUFFER PS_TONE_MAPPING(PS_IN In)
|
||||
@@ -1127,7 +1158,7 @@ PS_OUT_SSAO_AMBIENT_OCCLUSION PS_SSAO_AMBIENT_OCCLUSION(PS_IN In)
|
||||
fIsOccluded *= fRangeCheck;
|
||||
fOcclusion += fIsOccluded;
|
||||
}
|
||||
fOcclusion = (1.f - (fOcclusion / g_iKernelSize) * fRatio);
|
||||
fOcclusion = saturate(1.f - (fOcclusion * g_fSSAOStrength / g_iKernelSize) * fRatio);
|
||||
Out.fOcclusion = fOcclusion ;
|
||||
|
||||
return Out;
|
||||
|
||||
@@ -24,6 +24,7 @@ HRESULT CFog::Bind_FogValue(CShader* pShader)
|
||||
pShader->Bind_RawValue("g_fFogDensity", &m_fFogDensity, sizeof(_float));
|
||||
pShader->Bind_RawValue("g_fFogPow", &m_fFogPow, sizeof(_float));
|
||||
pShader->Bind_RawValue("g_vFogColor", &m_vFogColor, sizeof(_float4));
|
||||
pShader->Bind_RawValue("g_bFogVisible", &m_bVisible, sizeof(_bool));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -32,11 +33,13 @@ HRESULT CFog::Bind_FogValue(CShader* pShader)
|
||||
pShader->Bind_RawValue("g_fFogDensity", &fValue, sizeof(_float));
|
||||
pShader->Bind_RawValue("g_fFogPow", &fValue, sizeof(_float));
|
||||
pShader->Bind_RawValue("g_vFogColor", &vColor, sizeof(_float4));
|
||||
pShader->Bind_RawValue("g_bFogVisible", &m_bVisible, sizeof(_bool));
|
||||
}
|
||||
#else
|
||||
pShader->Bind_RawValue("g_fFogDensity", &m_fFogDensity, sizeof(_float));
|
||||
pShader->Bind_RawValue("g_fFogPow", &m_fFogPow, sizeof(_float));
|
||||
pShader->Bind_RawValue("g_vFogColor", &m_vFogColor, sizeof(_float4));
|
||||
pShader->Bind_RawValue("g_bFogVisible", &m_bVisible, sizeof(_bool));
|
||||
#endif // _DEBUG
|
||||
|
||||
return S_OK;
|
||||
|
||||
@@ -679,9 +679,14 @@ HRESULT CGameInstance::Add_RenderGroup(RENDER eRenderGroup, CGameObject* pRender
|
||||
return m_pRenderer->Add_RenderGroup(eRenderGroup, pRenderObject);
|
||||
}
|
||||
|
||||
void CGameInstance::Render_PreShadow()
|
||||
void CGameInstance::Render_PreShadow(const _float4x4& ViewMatrix, const _float4x4& ProjMatrix)
|
||||
{
|
||||
return m_pRenderer->Render_PreShadow();
|
||||
return m_pRenderer->Render_PreShadow(ViewMatrix, ProjMatrix);
|
||||
}
|
||||
|
||||
HRESULT CGameInstance::Bind_PreShadowMatrix(CShader* pShader, const _char* pConstants, D3DTS eType)
|
||||
{
|
||||
return m_pRenderer->Bind_PreShadowMatrix(pShader, pConstants, eType);
|
||||
}
|
||||
|
||||
void CGameInstance::Set_Transform(D3DTS eState, _fmatrix TransformStateMatrix)
|
||||
@@ -1074,65 +1079,110 @@ ID3D11ShaderResourceView* CGameInstance::Add_Resource(const _char* pFilePath)
|
||||
|
||||
bool CGameInstance::Key_Pressing(int _iKey)
|
||||
{
|
||||
//if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow))) {
|
||||
#ifndef _DEBUG
|
||||
return m_pKey_Manager->Key_Pressing(_iKey);
|
||||
#endif // !_DEBUG
|
||||
#ifdef _DEBUG
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow)OPTIONAL_TRUE_KEYINPUTGUICHECK)) {
|
||||
return m_pKey_Manager->Key_Pressing(_iKey);
|
||||
//}
|
||||
}
|
||||
#endif // _DEBUG
|
||||
return false;
|
||||
}
|
||||
bool CGameInstance::Key_Up(int _iKey)
|
||||
{
|
||||
//if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow))) {
|
||||
#ifndef _DEBUG
|
||||
return m_pKey_Manager->Key_Up(_iKey);
|
||||
#endif // !_DEBUG
|
||||
#ifdef _DEBUG
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow)OPTIONAL_TRUE_KEYINPUTGUICHECK)) {
|
||||
return m_pKey_Manager->Key_Up(_iKey);
|
||||
//}
|
||||
}
|
||||
#endif // _DEBUG
|
||||
return false;
|
||||
}
|
||||
bool CGameInstance::Key_Down(int _iKey)
|
||||
{
|
||||
//if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow))) {
|
||||
#ifndef _DEBUG
|
||||
return m_pKey_Manager->Key_Down(_iKey);
|
||||
#endif // !_DEBUG
|
||||
#ifdef _DEBUG
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow)OPTIONAL_TRUE_KEYINPUTGUICHECK)) {
|
||||
return m_pKey_Manager->Key_Down(_iKey);
|
||||
//}
|
||||
}
|
||||
#endif // _DEBUG
|
||||
return false;
|
||||
}
|
||||
_bool CGameInstance::Mouse_Pressing(int _iKey)
|
||||
{
|
||||
//if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow))) {
|
||||
#ifndef _DEBUG
|
||||
return m_pKey_Manager->Mouse_Pressing(_iKey);
|
||||
#endif // !_DEBUG
|
||||
#ifdef _DEBUG
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow)OPTIONAL_TRUE_KEYINPUTGUICHECK)) {
|
||||
return m_pKey_Manager->Mouse_Pressing(_iKey);
|
||||
//}
|
||||
}
|
||||
#endif // _DEBUG
|
||||
return false;
|
||||
}
|
||||
_bool CGameInstance::Mouse_Up(int _iKey)
|
||||
{
|
||||
//if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow))) {
|
||||
#ifndef _DEBUG
|
||||
return m_pKey_Manager->Mouse_Up(_iKey);
|
||||
#endif // !_DEBUG
|
||||
#ifdef _DEBUG
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow)OPTIONAL_TRUE_KEYINPUTGUICHECK)) {
|
||||
return m_pKey_Manager->Mouse_Up(_iKey);
|
||||
//}
|
||||
}
|
||||
#endif // _DEBUG
|
||||
return false;
|
||||
}
|
||||
_bool CGameInstance::Mouse_Down(int _iKey)
|
||||
{
|
||||
//if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow))) {
|
||||
#ifndef _DEBUG
|
||||
return m_pKey_Manager->Mouse_Down(_iKey);
|
||||
#endif // !_DEBUG
|
||||
#ifdef _DEBUG
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow)OPTIONAL_TRUE_KEYINPUTGUICHECK)) {
|
||||
return m_pKey_Manager->Mouse_Down(_iKey);
|
||||
//}
|
||||
}
|
||||
#endif // _DEBUG
|
||||
return false;
|
||||
}
|
||||
_bool CGameInstance::Mouse_StartMove()
|
||||
{
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow))) {
|
||||
#ifndef _DEBUG
|
||||
return m_pKey_Manager->Mouse_StartMove();
|
||||
#endif // !_DEBUG
|
||||
#ifdef _DEBUG
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow)OPTIONAL_TRUE_KEYINPUTGUICHECK)) {
|
||||
return m_pKey_Manager->Mouse_StartMove();
|
||||
}
|
||||
#endif // _DEBUG
|
||||
return false;
|
||||
}
|
||||
_bool CGameInstance::Mouse_Moving()
|
||||
{
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow))) {
|
||||
#ifndef _DEBUG
|
||||
return m_pKey_Manager->Mouse_Moving();
|
||||
#endif // !_DEBUG
|
||||
#ifdef _DEBUG
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow)OPTIONAL_TRUE_KEYINPUTGUICHECK)) {
|
||||
return m_pKey_Manager->Mouse_Moving();
|
||||
}
|
||||
#endif // _DEBUG
|
||||
return false;
|
||||
}
|
||||
_bool CGameInstance::Mouse_StopMove()
|
||||
{
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow))) {
|
||||
#ifndef _DEBUG
|
||||
return m_pKey_Manager->Mouse_StopMove();
|
||||
#endif // !_DEBUG
|
||||
#ifdef _DEBUG
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow)OPTIONAL_TRUE_KEYINPUTGUICHECK)) {
|
||||
return m_pKey_Manager->Mouse_StopMove();
|
||||
}
|
||||
#endif // _DEBUG
|
||||
return false;
|
||||
}
|
||||
_float3 CGameInstance::Get_MouseMove()
|
||||
|
||||
@@ -74,21 +74,20 @@ pair<_bool, _ubyte> CPipeLine::IsIn_ShadowViewFrustum(_fvector vWorldCenter, _fl
|
||||
// 월드 센터를 셰도우뷰 센터로 바꿈
|
||||
_vector vShadowViewCenter = XMVectorSetW(XMVector3Rotate(vWorldCenter, XMLoadFloat4(&m_vShadowInvDirectionalRPYQuat)), 1.f);
|
||||
|
||||
_float fSafeRadius = fRadius; // 인스턴싱된 객체 고려해서 좀 더 넓게 탐색
|
||||
_float fSafeRadius = (fRadius + m_fSafe_RadiusMargin) * m_fSafe_RadiusMultiplier; // 그림자임을 고려해서 객체 부피보다 좀 더 넓게 탐색
|
||||
|
||||
for (_uint iCascadeIndex = 0; iCascadeIndex < ENUM_CLASS(SHADOW::END); ++iCascadeIndex) {
|
||||
const _float4* pTargetPlanes = nullptr;
|
||||
if (iCascadeIndex == 2) {
|
||||
continue;
|
||||
// 게임 특성 상 Far가 너무 멀어서 프리베이크랑 차이가 안남
|
||||
pTargetPlanes = m_vFarShadowViewBoxPlane;
|
||||
}
|
||||
if (iCascadeIndex == 0) {
|
||||
pTargetPlanes = m_vNearShadowViewBoxPlane;
|
||||
fSafeRadius = fRadius;
|
||||
}
|
||||
if (iCascadeIndex == 1) {
|
||||
pTargetPlanes = m_vMiddleShadowViewBoxPlane;
|
||||
fSafeRadius = fRadius;
|
||||
}
|
||||
if (iCascadeIndex == 2) {
|
||||
pTargetPlanes = m_vFarShadowViewBoxPlane;
|
||||
fSafeRadius = fRadius;
|
||||
}
|
||||
|
||||
_bool bIsInside = true;
|
||||
@@ -171,6 +170,9 @@ HRESULT CPipeLine::Bind_Shadow_Resource(CShader* pShader, const _char* pConstant
|
||||
else if (0 < ((_ubyte)eShadowType & (_ubyte)SHADOW::SHADOW_FAR)) {
|
||||
iPass = 2;
|
||||
}
|
||||
else if (0 < ((_ubyte)eShadowType & (_ubyte)SHADOW::SHADOW_PRE)) {
|
||||
return m_pGameInstance->Bind_PreShadowMatrix(pShader, pConstantName, eType);
|
||||
}
|
||||
assert(iPass != UINT_MAX);
|
||||
|
||||
return pShader->Bind_Matrix(pConstantName, &m_ShadowTransformStateMatrices[iPass][ENUM_CLASS(eType)]);
|
||||
@@ -303,6 +305,15 @@ void CPipeLine::Make_LightBoxes()
|
||||
if (iIndex == 1) targetPlanes = m_vMiddleShadowViewBoxPlane;
|
||||
if (iIndex == 2) targetPlanes = m_vFarShadowViewBoxPlane;
|
||||
|
||||
fMinX += m_vShadowBoxMarginMin.x;
|
||||
fMaxX += m_vShadowBoxMarginMax.x;
|
||||
fMinY += m_vShadowBoxMarginMin.y;
|
||||
fMaxY += m_vShadowBoxMarginMax.y;
|
||||
fMinZ += m_vShadowBoxMarginMin.z;
|
||||
fMaxZ += m_vShadowBoxMarginMax.z;
|
||||
|
||||
Adjust_ShadowTexcel(fMinX, fMinY, fMaxX, fMaxY, g_iMaxShadowWidth, g_iMaxShadowHeight);
|
||||
|
||||
targetPlanes[0] = _float4(-1.f, 0.f, 0.f, fMinX); // Left
|
||||
targetPlanes[1] = _float4(1.f, 0.f, 0.f, -fMaxX); // Right
|
||||
targetPlanes[2] = _float4(0.f, -1.f, 0.f, fMinY); // Bottom
|
||||
@@ -310,7 +321,6 @@ void CPipeLine::Make_LightBoxes()
|
||||
targetPlanes[4] = _float4(0.f, 0.f, -1.f, fMinZ); // Near
|
||||
targetPlanes[5] = _float4(0.f, 0.f, 1.f, -fMaxZ); // Far
|
||||
|
||||
|
||||
XMStoreFloat4x4(&m_ShadowTransformStateMatrices[iIndex][ENUM_CLASS(D3DTS::VIEW)], ViewMatrix);
|
||||
XMStoreFloat4x4(&m_ShadowTransformStateMatrices[iIndex][ENUM_CLASS(D3DTS::VIEW_INV)], ViewInvMatrix);
|
||||
|
||||
@@ -376,6 +386,31 @@ void CPipeLine::Update_ShadowDepthNdcZ()
|
||||
}
|
||||
}
|
||||
|
||||
// Out으로 _float4를 새롭게 메모리로 받고 다시 밖에서 할당할 바에 레퍼런스로 쓰는게 더 나은듯
|
||||
// 카메라 미세 흔들림으로 인한 그림자 튐 보정
|
||||
void CPipeLine::Adjust_ShadowTexcel(_float& fMinX, _float& fMinY, _float& fMaxX, _float& fMaxY, _uint iShadowWidth, _uint iShadowHeight)
|
||||
{
|
||||
_float fCascadeWidth = (fMaxX - fMinX);
|
||||
_float fCascadeHeight = (fMaxY - fMinY);
|
||||
|
||||
_float fTexelSizeX = fCascadeWidth / (_float)(iShadowWidth);
|
||||
_float fTexelSizeY = fCascadeHeight / (_float)(iShadowHeight);
|
||||
|
||||
// 박스 xy 중심
|
||||
_float fCascadeCenterX = (fMinX + fMaxX) * 0.5f;
|
||||
_float fCascadeCenterY = (fMinY + fMaxY) * 0.5f;
|
||||
{
|
||||
fCascadeCenterX = floorf(fCascadeCenterX / fTexelSizeX) * fTexelSizeX;
|
||||
fCascadeCenterY = floorf(fCascadeCenterY / fTexelSizeY) * fTexelSizeY;
|
||||
}
|
||||
|
||||
// 박스 중심으로 min/max 보정
|
||||
fMinX = fCascadeCenterX - fCascadeWidth * 0.5f;
|
||||
fMaxX = fCascadeCenterX + fCascadeWidth * 0.5f;
|
||||
fMinY = fCascadeCenterY - fCascadeHeight * 0.5f;
|
||||
fMaxY = fCascadeCenterY + fCascadeHeight * 0.5f;
|
||||
}
|
||||
|
||||
ID3D11ShaderResourceView* CPipeLine::Find_GlobalShaderResourceView(const _tchar* wszKeyGlobalSRV)
|
||||
{
|
||||
auto iter = m_mapGlobalSRV.find(wszKeyGlobalSRV);
|
||||
@@ -415,22 +450,42 @@ void CPipeLine::Describe_Entity()
|
||||
_bool bModified = { false };
|
||||
_float fNear = m_fShadowNearBoxRatio;
|
||||
_float fFar = m_fShadowFarBoxRatio;
|
||||
_float fSafe_RadiusMultiplier = m_fSafe_RadiusMultiplier;
|
||||
_float fSafe_RadiusMargin = m_fSafe_RadiusMargin;
|
||||
_float4 vShadowBias = m_vShadowBias;
|
||||
_float3 vShadowBoxMarginMin = m_vShadowBoxMarginMin;
|
||||
_float3 vShadowBoxMarginMax = m_vShadowBoxMarginMax;
|
||||
if (GUI::DragFloat("m_fShadowNearBoxRatio", &fNear, 0.01f, 0.01f, 0.999f, "%.2f")) {
|
||||
bModified = true;
|
||||
}
|
||||
if (GUI::DragFloat("m_fShadowFarBoxRatio", &fFar, 0.01f, 0.01f, 0.999f, "%.2f")) {
|
||||
bModified = true;
|
||||
}
|
||||
if (GUI::DragFloat("m_fSafe_RadiusMultiplier", &fSafe_RadiusMultiplier, 0.01f, 1.f, 3.f, "%.2f")) {
|
||||
bModified = true;
|
||||
}
|
||||
if (GUI::DragFloat("m_fSafe_RadiusMargin", &fSafe_RadiusMargin, 1.f, 10.f, 40.f, "%.2f")) {
|
||||
bModified = true;
|
||||
}
|
||||
GUI::PushItemWidth(150.f);
|
||||
if (GUI::DragFloat4("ShadowBiasNMFS", (_float*)&vShadowBias, 0.0001f, 0.0001f, 1.f, "%.4f")) {
|
||||
bModified = true;
|
||||
}
|
||||
if (GUI::SliderFloat3("fShadowBoxMarginMin", (_float*)&vShadowBoxMarginMin, -100.F, 100.f, "%.1f")) {
|
||||
bModified = true;
|
||||
}
|
||||
if (GUI::SliderFloat3("fShadowBoxMarginMax", (_float*)&vShadowBoxMarginMax, -100.F, 100.f, "%.1f")) {
|
||||
bModified = true;
|
||||
}
|
||||
GUI::PushItemWidth(80.f);
|
||||
if (true == bModified) {
|
||||
m_fShadowNearBoxRatio = fNear;
|
||||
m_fShadowFarBoxRatio = fFar;
|
||||
m_vShadowBias = vShadowBias;
|
||||
m_fSafe_RadiusMultiplier = fSafe_RadiusMultiplier;
|
||||
m_fSafe_RadiusMargin = fSafe_RadiusMargin;
|
||||
m_vShadowBoxMarginMin = vShadowBoxMarginMin;
|
||||
m_vShadowBoxMarginMax = vShadowBoxMarginMax;
|
||||
}
|
||||
}
|
||||
GUI::End();
|
||||
|
||||
@@ -58,17 +58,14 @@ void CRenderer::Render()
|
||||
#endif
|
||||
}
|
||||
|
||||
void CRenderer::Render_PreShadow()
|
||||
void CRenderer::Render_PreShadow(const _float4x4& ViewMatrix, const _float4x4& ProjMatrix)
|
||||
{
|
||||
if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_PreShadow"), m_pPreShadowDSV))) {
|
||||
return;
|
||||
}
|
||||
|
||||
const _float4x4* pMatrices = m_pGameInstance->Get_ShadowMatricesPtr(0);
|
||||
m_PreShadowFar = m_pGameInstance->Get_ShadowBoxFar(0);
|
||||
for (int i = 0; i < ENUM_CLASS(D3DTS::END); ++i) {
|
||||
m_PreShadowMatrices[i] = pMatrices[i];
|
||||
}
|
||||
m_PreShadowView = ViewMatrix;
|
||||
m_PreShadowProj = ProjMatrix;
|
||||
|
||||
D3D11_VIEWPORT ViewPortOldDesc;
|
||||
D3D11_VIEWPORT ViewPortDesc;
|
||||
@@ -78,8 +75,8 @@ void CRenderer::Render_PreShadow()
|
||||
{
|
||||
ViewPortDesc.TopLeftX = 0;
|
||||
ViewPortDesc.TopLeftY = 0;
|
||||
ViewPortDesc.Width = (_float)g_iMaxShadowWidth;
|
||||
ViewPortDesc.Height = (_float)g_iMaxShadowHeight;
|
||||
ViewPortDesc.Width = (_float)g_iPreShadowWidth;
|
||||
ViewPortDesc.Height = (_float)g_iPreShadowHeight;
|
||||
ViewPortDesc.MinDepth = 0.f;
|
||||
ViewPortDesc.MaxDepth = 1.f;
|
||||
}
|
||||
@@ -89,7 +86,7 @@ void CRenderer::Render_PreShadow()
|
||||
for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::PRESHADOW)])
|
||||
{
|
||||
if (nullptr != pRenderObject) {
|
||||
if (FAILED(pRenderObject->Render_Shadow(SHADOW::END))) {
|
||||
if (FAILED(pRenderObject->Render_Shadow(SHADOW::SHADOW_PRE))) {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
@@ -105,6 +102,20 @@ void CRenderer::Render_PreShadow()
|
||||
m_pContext->RSSetViewports(iNumViewOldPort, &ViewPortOldDesc);
|
||||
}
|
||||
|
||||
HRESULT CRenderer::Bind_PreShadowMatrix(class CShader* pShader, const _char* pConstants, D3DTS eType)
|
||||
{
|
||||
if (D3DTS::VIEW == eType) {
|
||||
if (FAILED(pShader->Bind_Matrix(pConstants, &m_PreShadowView))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
} else if (D3DTS::PROJ == eType) {
|
||||
if (FAILED(pShader->Bind_Matrix(pConstants, &m_PreShadowProj))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CRenderer::Render_Occlusion()
|
||||
{
|
||||
COMPUTE_TIMEDELTA("Timer_Render_Occlusion");
|
||||
@@ -387,13 +398,10 @@ void CRenderer::Render_Combined()
|
||||
if (FAILED(m_pGameInstance->Bind_Shadow_Resource(m_pShader, "g_LightProjMatrix_FAR", D3DTS::PROJ, SHADOW::SHADOW_FAR))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_fPreShadowFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
|
||||
if (FAILED(m_pShader->Bind_Matrix("g_PreShadowLightViewMatrix", &m_PreShadowView))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pShader->Bind_Matrix("g_PreShadowLightViewMatrix", &m_PreShadowMatrices[ENUM_CLASS(D3DTS::VIEW)]))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pShader->Bind_Matrix("g_PreShadowLightProjMatrix", &m_PreShadowMatrices[ENUM_CLASS(D3DTS::PROJ)]))) {
|
||||
if (FAILED(m_pShader->Bind_Matrix("g_PreShadowLightProjMatrix", &m_PreShadowProj))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -447,7 +455,7 @@ void CRenderer::Render_Combined()
|
||||
void CRenderer::Render_EnvironmentPostProcess()
|
||||
{
|
||||
COMPUTE_TIMEDELTA("Timer_Render_EnvironmentPostProcess");
|
||||
if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_ENV_Blur_X")))) {
|
||||
if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_ENV_Blur_X")))) { // Target_ENV_Blur_X
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -519,7 +527,9 @@ void CRenderer::Render_Fog()
|
||||
COMPUTE_TIMEDELTA("Timer_Render_Fog");
|
||||
m_pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float));
|
||||
|
||||
m_pGameInstance->Bind_FogValue(m_pShader);
|
||||
if (FAILED(m_pGameInstance->Bind_FogValue(m_pShader))) { // 여기서 포그에서 쓰는 상수들 바인딩 해줌
|
||||
assert(false);
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Fog"), m_pShader, "g_OriginalTexture"))) {
|
||||
return;
|
||||
@@ -706,6 +716,11 @@ void CRenderer::Render_SSAO()
|
||||
assert(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_fSSAOStrength", &m_fSSAOStrength, sizeof(_float)))) {
|
||||
assert(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
{
|
||||
// Bind_Targets
|
||||
|
||||
@@ -234,15 +234,6 @@ HRESULT CRenderer::Initialize()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* Target_ENV_Blur */
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_ENV_Blur"), (_uint)Viewport.Width, (_uint)Viewport.Height,
|
||||
DXGI_FORMAT_R16G16B16A16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 0.0f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_ENV_Blur_Weight"), (_uint)Viewport.Width, (_uint)Viewport.Height,
|
||||
DXGI_FORMAT_R16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 1.0f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* Target_ENV_Blur_X */
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_ENV_Blur_X"), (_uint)Viewport.Width, (_uint)Viewport.Height,
|
||||
@@ -253,6 +244,11 @@ HRESULT CRenderer::Initialize()
|
||||
DXGI_FORMAT_R16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 1.0f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
/* Target_ENV_Blur_Weight */
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_ENV_Blur_Weight"), (_uint)Viewport.Width, (_uint)Viewport.Height,
|
||||
DXGI_FORMAT_R16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 1.0f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* Target_SSAO_AmbientOcclusion */
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_SSAO_AmbientOcclusion"), (_uint)Viewport.Width, (_uint)Viewport.Height,
|
||||
@@ -426,14 +422,6 @@ HRESULT CRenderer::Initialize()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* MRT_ENV_Blur */
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_ENV_Blur"), TEXT("Target_ENV_Blur")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_ENV_Blur"), TEXT("Target_ENV_Blur_Weight")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* MRT_Bloom */
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_Bloom"), TEXT("Target_Bloom_Input")))) {
|
||||
return E_FAIL;
|
||||
@@ -477,6 +465,9 @@ HRESULT CRenderer::Initialize()
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_Fog"), TEXT("Target_Fog")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_Fog"), TEXT("Target_ENV_Blur_Weight")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
/* MRT_Distortion */
|
||||
@@ -581,7 +572,6 @@ void CRenderer::Describe_Entitiy()
|
||||
{
|
||||
GUI::Begin("SYSTEM", 0, IMGUI_GLOBAL_BEGIN_FLAG);
|
||||
if (GUI::CollapsingHeader("RENDERER")) {
|
||||
GUI::PushItemWidth(80);
|
||||
if (GUI::CollapsingHeader("PostProcessing_Bloom"))
|
||||
{
|
||||
GUI::BeginChild("PostProcessing_Bloom");
|
||||
@@ -616,6 +606,7 @@ void CRenderer::Describe_Entitiy()
|
||||
GUI::BeginChild("SSAO_Setting", ImVec2(0, 0), true);
|
||||
GUI::DragFloat("fSSAORadius ", &m_fSSAO_Radius, 0.001f, -3.f, 3.f, "%.5f");
|
||||
GUI::DragFloat("fSSAO_BIAS", &m_fSSAO_BIAS, 0.001f, -2.f, 2.f, "%.5f");
|
||||
GUI::DragFloat("fSSAOStrength", &m_fSSAOStrength, 0.01f, 1.f, 4.f, "%.5f");
|
||||
GUI::EndChild();
|
||||
}
|
||||
if (GUI::CollapsingHeader("ToneMapping")) {
|
||||
@@ -624,6 +615,8 @@ void CRenderer::Describe_Entitiy()
|
||||
GUI::SliderFloat("m_fExposure", &m_fExposure, 0.5f, 2.f, "%.3f");
|
||||
GUI::EndChild();
|
||||
}
|
||||
if (GUI::CollapsingHeader("End_Padding")) {
|
||||
}
|
||||
}
|
||||
GUI::End();
|
||||
}
|
||||
|
||||
@@ -488,12 +488,14 @@ void CTransform::Describe_Entity()
|
||||
GUI::DragFloat4("Look", (_float*)(&m_WorldMatrix._31), 1.f, 0.f, 0.f, "%.3f");
|
||||
GUI::DragFloat4("Pos", (_float*)(&m_WorldMatrix._41), 1.f, 0.f, 0.f, "%.3f");
|
||||
|
||||
|
||||
|
||||
_vector vRotRPY = Get_RollPitchYawVector();
|
||||
static _float3 s_vRotation = {};
|
||||
|
||||
if(GUI::InputFloat3("Rotation", (_float*)&s_vRotation))
|
||||
XMStoreFloat3(&s_vRotation, vRotRPY);
|
||||
_float3 vDegrees = { XMConvertToDegrees(s_vRotation.x),XMConvertToDegrees(s_vRotation.y),XMConvertToDegrees(s_vRotation.z) };
|
||||
if(GUI::InputFloat3("Rotation", (_float*)&vDegrees))
|
||||
{
|
||||
Rotation(s_vRotation.x, s_vRotation.y, s_vRotation.z);
|
||||
Rotation(XMConvertToRadians(vDegrees.x), XMConvertToRadians(vDegrees.y), XMConvertToRadians(vDegrees.z));
|
||||
}
|
||||
|
||||
GUI::TreePop();
|
||||
|
||||
@@ -15,7 +15,9 @@ enum class SHADOW : _ubyte {
|
||||
SHADOW_NEAR = 1 << 0
|
||||
, SHADOW_MIDDLE = 1 << 1
|
||||
, SHADOW_FAR = 1 << 2
|
||||
, END = 3
|
||||
, SHADOW_PRE = 1 << 3
|
||||
////////////////
|
||||
, END = 3 // 케스케이드 셰도우 한정
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -21,24 +21,31 @@
|
||||
#define ASSERT_JINHO(expression)
|
||||
#define ASSERT_HYUNBIN(expression)
|
||||
#define ASSERT_INHYUK(expression)
|
||||
#define OPTIONAL_TRUE_KEYINPUTGUICHECK
|
||||
|
||||
#ifdef 기무리
|
||||
#undef ASSERT_NURI
|
||||
#define ASSERT_NURI(expression) assert(expression)
|
||||
//#define OPTIONAL_TRUE_KEYINPUTGUICHECK ||true
|
||||
#elif 진우
|
||||
#undef ASSERT_JINWOO
|
||||
#define ASSERT_JINWOO(expression) assert(expression)
|
||||
#define OPTIONAL_TRUE_KEYINPUTGUICHECK ||true
|
||||
#elif gimch
|
||||
#undef ASSERT_JINHO
|
||||
#define ASSERT_JINHO(expression) assert(expression)
|
||||
#define OPTIONAL_TRUE_KEYINPUTGUICHECK ||true
|
||||
#elif Bin
|
||||
#undef ASSERT_HYUNBIN
|
||||
#define ASSERT_HYUNBIN(expression) assert(expression)
|
||||
#define OPTIONAL_TRUE_KEYINPUTGUICHECK ||true
|
||||
#elif 인혁
|
||||
#undef ASSERT_INHYUK
|
||||
#define ASSERT_INHYUK(expression) assert(expression)
|
||||
#define OPTIONAL_TRUE_KEYINPUTGUICHECK ||true
|
||||
#endif
|
||||
|
||||
|
||||
#pragma endregion
|
||||
|
||||
|
||||
@@ -101,6 +108,9 @@
|
||||
#define SSAO_SAMPLE_NUMBER 64
|
||||
#define TIMER_SHORT_LERP 0.16f
|
||||
|
||||
constexpr unsigned int g_iPreShadowWidth = 16384;
|
||||
constexpr unsigned int g_iPreShadowHeight = 9216;
|
||||
|
||||
constexpr unsigned int g_iMaxShadowWidth = 16384;
|
||||
constexpr unsigned int g_iMaxShadowHeight = 9216;
|
||||
//constexpr unsigned int g_iMaxShadowWidth = 4096;
|
||||
|
||||
@@ -101,7 +101,8 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
|
||||
#pragma region RENDERER
|
||||
HRESULT Add_RenderGroup(RENDER eRenderGroup, class CGameObject* pRenderObject);
|
||||
void Render_PreShadow();
|
||||
void Render_PreShadow(const _float4x4& ViewMatrix, const _float4x4& ProjMatrix);
|
||||
HRESULT Bind_PreShadowMatrix(class CShader* pShader, const _char* pConstants, D3DTS eType);
|
||||
#pragma endregion
|
||||
|
||||
#pragma region ASSET_MANAGER
|
||||
|
||||
@@ -57,7 +57,12 @@ class CPipeLine final : public CBase
|
||||
_float4 m_vCamPosition = {};
|
||||
|
||||
_float m_fShadowNearBoxRatio = { 0.07f };
|
||||
_float m_fShadowFarBoxRatio = { 0.60f };
|
||||
_float m_fShadowFarBoxRatio = { 0.15f };
|
||||
_float m_fSafe_RadiusMultiplier = { 2.3f };
|
||||
_float m_fSafe_RadiusMargin = { 10.f };
|
||||
_float3 m_vShadowBoxMarginMin = { 0.f, 0.f, -25.f };
|
||||
_float3 m_vShadowBoxMarginMax = { 0.f, 0.f, 25.f };
|
||||
|
||||
_float4 m_vShadowBias = { 0.0018f, 0.0018f, 0.0018f, 0.0018f };
|
||||
|
||||
_float4 m_vOriginalRenderFrustumPoints[8] = {};
|
||||
@@ -84,6 +89,7 @@ class CPipeLine final : public CBase
|
||||
void Make_LightBoxes();
|
||||
void Get_CascadePoints8(const _float4* shadowViewPoints16, _uint cascadeIndex, _float4* outPoints8); //
|
||||
void Update_ShadowDepthNdcZ();
|
||||
void Adjust_ShadowTexcel(_float& fMinX, _float& fMinY, _float& fMaxX, _float& fMaxY, _uint iShadowWidth, _uint iShadowHeight);
|
||||
ID3D11ShaderResourceView* Find_GlobalShaderResourceView(const _tchar* wszKeyGlobalSRV);
|
||||
|
||||
public:
|
||||
|
||||
@@ -13,7 +13,8 @@ class CRenderer final : public CBase
|
||||
public:
|
||||
void Render();
|
||||
HRESULT Add_RenderGroup(RENDER eRenderGroup, class CGameObject* pRenderObject);
|
||||
void Render_PreShadow();
|
||||
void Render_PreShadow(const _float4x4& ViewMatrix, const _float4x4& ProjMatrix);
|
||||
HRESULT Bind_PreShadowMatrix(class CShader* pShader, const _char* pConstants, D3DTS eType);
|
||||
|
||||
#ifdef _DEBUG
|
||||
private:
|
||||
@@ -49,11 +50,11 @@ class CRenderer final : public CBase
|
||||
ID3D11Texture2D* m_pSSAO_NoiseTexture = { nullptr };
|
||||
ID3D11Buffer* m_pGlobalStaticCB = { nullptr };
|
||||
|
||||
_float m_PreShadowFar = {};
|
||||
_float4x4 m_PreShadowMatrices[ENUM_CLASS(D3DTS::END)] = {};
|
||||
_float4x4 m_PreShadowView = {};
|
||||
_float4x4 m_PreShadowProj = {};
|
||||
|
||||
/* TunningParam */
|
||||
_int m_iToneMappingType = { 0 };
|
||||
_int m_iToneMappingType = { 2 };
|
||||
_float m_fExposure = { 0.7f };
|
||||
|
||||
// Bloom
|
||||
@@ -63,13 +64,14 @@ class CRenderer final : public CBase
|
||||
// DOF Environment
|
||||
_float m_fDOF_ENV_CutThreshold = { 0.1350f };
|
||||
_float m_fDOF_ENV_FocusDistance = { 31.1f };
|
||||
_float m_fDOF_ENV_StartDistance = { 53.1f };
|
||||
_float m_fDOF_ENV_MaxEnd = { 360.f };
|
||||
_float m_fDOF_ENV_StartDistance = { 130.f };
|
||||
_float m_fDOF_ENV_MaxEnd = { 350.f };
|
||||
_float m_fDOF_ENV_AmountRadius = { 1.f };
|
||||
|
||||
// SSAO
|
||||
_float m_fSSAO_Radius = { 1.6300f };
|
||||
_float m_fSSAO_BIAS = { 0.234f };
|
||||
_float m_fSSAO_Radius = { 1.6300f };
|
||||
_float m_fSSAO_BIAS = { 0.234f };
|
||||
_float m_fSSAOStrength = { 2.83f };
|
||||
|
||||
SSAO_GEOMETRY_HEMISPHERE m_tagSSAOGeometry = {};
|
||||
SSAO_GEOMETRYDIRECTIONS_RANDOM_REAL m_tagSSAOGeometryDirections = {};
|
||||
|
||||
@@ -73,7 +73,7 @@ class ENGINE_DLL CTransform final :
|
||||
void Rotation(_float3& vRadian);
|
||||
void Rotation(_fvector vRPY);
|
||||
|
||||
// Up, Down 벡터를 바라보게 하면 터짐
|
||||
// Up, Down 벡터를 바라보게 하면 터짐, w에 1 있어야함
|
||||
void LookAt(_fvector vAt);
|
||||
void LookAt_Lerp(_fvector vAt, _float fTimeDelta, _float fSpeed);
|
||||
void LookAt_Horizontal(_fvector vAt);
|
||||
|
||||
Reference in New Issue
Block a user