diff --git a/Editor/ViewManager.cpp b/Editor/ViewManager.cpp index 44fc8c7d2..76de16e27 100644 --- a/Editor/ViewManager.cpp +++ b/Editor/ViewManager.cpp @@ -91,8 +91,8 @@ void ViewManager::ParticleView::draw(boo::IGraphicsCommandQueue *gfxQ) boo::SWindowRect windowRect = m_vm.m_mainWindow->getWindowFrame(); float aspect = windowRect.size[0] / float(windowRect.size[1]); - CGraphics::SetPerspective(55.0, aspect, 1.f, 15.f); - CGraphics::SetFog(ERglFogMode::PerspExp, 10.f, 15.f, zeus::CColor::skRed); + CGraphics::SetPerspective(55.0, aspect, 0.1f, 1000.f); + CGraphics::SetFog(ERglFogMode::PerspExp, 7.f, 15.f, zeus::CColor::skRed); //CGraphics::SetFog(ERglFogMode::PerspExp, 10.f + std::sin(m_theta) * 5.f, 15.f + std::sin(m_theta) * 5.f, zeus::CColor::skRed); zeus::CFrustum frustum; frustum.updatePlanes(CGraphics::g_GXModelView, zeus::SProjPersp(55.0, aspect, 0.1f, 1000.f)); diff --git a/Runtime/Graphics/CGraphics.cpp b/Runtime/Graphics/CGraphics.cpp index cbe9d29cb..03880000e 100644 --- a/Runtime/Graphics/CGraphics.cpp +++ b/Runtime/Graphics/CGraphics.cpp @@ -71,16 +71,14 @@ void CGraphics::SetFog(ERglFogMode mode, float startz, float endz, const zeus::C { if (mode == ERglFogMode::None) { - g_Fog.m_start = 1.f; + g_Fog.m_start = 4096.f; } else { - float projRange = g_Proj.x18_far - g_Proj.x14_near; float userRange = endz - startz; - g_Fog.m_color = color; - g_Fog.m_start = (startz - g_Proj.x14_near) / projRange; - g_Fog.m_rangeScale = projRange / userRange; + g_Fog.m_start = startz; + g_Fog.m_rangeScale = 1.f / userRange; } } diff --git a/Runtime/Graphics/CGraphics.hpp b/Runtime/Graphics/CGraphics.hpp index 6cf003a5c..d249a2233 100644 --- a/Runtime/Graphics/CGraphics.hpp +++ b/Runtime/Graphics/CGraphics.hpp @@ -188,8 +188,8 @@ public: struct CFogState { zeus::CColor m_color; - float m_rangeScale = 4096.f; - float m_start = 1.f; + float m_rangeScale = 1.f; + float m_start = 4096.f; }; static CProjectionState g_Proj; diff --git a/Runtime/Graphics/Shaders/CModelShadersGLSL.cpp b/Runtime/Graphics/Shaders/CModelShadersGLSL.cpp index e52a91422..044fd81fa 100644 --- a/Runtime/Graphics/Shaders/CModelShadersGLSL.cpp +++ b/Runtime/Graphics/Shaders/CModelShadersGLSL.cpp @@ -54,8 +54,7 @@ static const char* LightingGLSL = static const char* MainPostGLSL = "vec4 MainPostFunc(vec4 colorIn)\n" "{\n" -" float fogZ = (vtf.mvPos.z - fog.start) * fog.rangeScale;\n" -" return vec4(fogZ, fogZ, fogZ, 1.0);\n" +" float fogZ = (-vtf.mvPos.z - fog.start) * fog.rangeScale;\n" " return mix(fog.color, colorIn, clamp(exp2(-8.0 * fogZ), 0.0, 1.0));\n" "}\n" "\n"; diff --git a/hecl b/hecl index 200706dc9..16eaa99c0 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 200706dc92e9a458b18da295eff60f9711964556 +Subproject commit 16eaa99c0af151404fc431f9adc76fc4739e86fc