diff --git a/WickedEngine/DeferredRenderableComponent.cpp b/WickedEngine/DeferredRenderableComponent.cpp index 0f83a8ab4..19c5322a9 100644 --- a/WickedEngine/DeferredRenderableComponent.cpp +++ b/WickedEngine/DeferredRenderableComponent.cpp @@ -155,6 +155,37 @@ void DeferredRenderableComponent::RenderScene(wiRenderer::DeviceContext context) wiRenderer::DrawDebugBoxes(wiRenderer::getCamera(), context); } + //if (getSSSEnabled()) + //{ + // wiImage::BatchBegin(context, STENCILREF_SKIN); + // fx.quality = QUALITY_BILINEAR; + // fx.sampleFlag = SAMPLEMODE_CLAMP; + // fx.setDepthMap(rtLinearDepth.shaderResource.back()); + // for (int i = 0; i::FunctionType DeferredRenderableCompon lunamethod(Renderable3DComponent_BindLua, SetVolumeLightsEnabled), lunamethod(Renderable3DComponent_BindLua, SetLightShaftsEnabled), lunamethod(Renderable3DComponent_BindLua, SetLensFlareEnabled), + lunamethod(Renderable3DComponent_BindLua, SetMotionBlurEnabled), + lunamethod(Renderable3DComponent_BindLua, SetSSSEnabled), { NULL, NULL } }; Luna::PropertyType DeferredRenderableComponent_BindLua::properties[] = { diff --git a/WickedEngine/ForwardRenderableComponent_BindLua.cpp b/WickedEngine/ForwardRenderableComponent_BindLua.cpp index 07b9bfdce..24b3d5835 100644 --- a/WickedEngine/ForwardRenderableComponent_BindLua.cpp +++ b/WickedEngine/ForwardRenderableComponent_BindLua.cpp @@ -28,6 +28,8 @@ Luna::FunctionType ForwardRenderableComponen lunamethod(Renderable3DComponent_BindLua, SetVolumeLightsEnabled), lunamethod(Renderable3DComponent_BindLua, SetLightShaftsEnabled), lunamethod(Renderable3DComponent_BindLua, SetLensFlareEnabled), + lunamethod(Renderable3DComponent_BindLua, SetMotionBlurEnabled), + lunamethod(Renderable3DComponent_BindLua, SetSSSEnabled), { NULL, NULL } }; Luna::PropertyType ForwardRenderableComponent_BindLua::properties[] = { diff --git a/WickedEngine/Renderable3DComponent.cpp b/WickedEngine/Renderable3DComponent.cpp index a434087cb..d287658bc 100644 --- a/WickedEngine/Renderable3DComponent.cpp +++ b/WickedEngine/Renderable3DComponent.cpp @@ -45,6 +45,8 @@ void Renderable3DComponent::setProperties() setVolumeLightsEnabled(true); setLightShaftsEnabled(true); setLensFlareEnabled(true); + setMotionBlurEnabled(true); + setSSSEnabled(true); setPreferredThreadingCount(0); } @@ -56,6 +58,9 @@ void Renderable3DComponent::Initialize() rtSSR.Initialize( (UINT)(wiRenderer::GetScreenWidth() * getSSRQuality()), (UINT)(wiRenderer::GetScreenHeight() * getSSRQuality()) , 1, false, 1, 0, DXGI_FORMAT_R16G16B16A16_FLOAT); + rtMotionBlur.Initialize( + (UINT)(wiRenderer::GetScreenWidth()), (UINT)(wiRenderer::GetScreenHeight()) + , 1, false, 1, 0, DXGI_FORMAT_R16G16B16A16_FLOAT); rtLinearDepth.Initialize( wiRenderer::GetScreenWidth(), wiRenderer::GetScreenHeight() , 1, false, 1, 0, DXGI_FORMAT_R32_FLOAT @@ -104,9 +109,14 @@ void Renderable3DComponent::Initialize() rtSSAO.resize(3); for (unsigned int i = 0; i rtSun, rtBloom, rtSSAO; + vector rtSun, rtBloom, rtSSAO, rtSSS; wiDepthTarget dtDepthCopy; vector workerThreads; @@ -90,6 +93,8 @@ public: bool getVolumeLightsEnabled(){ return volumeLightsEnabled; } bool getLightShaftsEnabled(){ return lightShaftsEnabled; } bool getLensFlareEnabled(){ return lensFlareEnabled; } + bool getMotionBlurEnabled(){ return motionBlurEnabled; } + bool getSSSEnabled(){ return sssEnabled; } unsigned short getThreadingCount(){ return workerThreads.size(); } @@ -119,6 +124,8 @@ public: void setVolumeLightsEnabled(bool value){ volumeLightsEnabled = value; } void setLightShaftsEnabled(bool value){ lightShaftsEnabled = value; } void setLensFlareEnabled(bool value){ lensFlareEnabled = value; } + void setMotionBlurEnabled(bool value){ motionBlurEnabled = value; } + void setSSSEnabled(bool value){ sssEnabled = value; } virtual void setPreferredThreadingCount(unsigned short value); diff --git a/WickedEngine/Renderable3DComponent_BindLua.cpp b/WickedEngine/Renderable3DComponent_BindLua.cpp index 75dd81bb5..2c6bb69ad 100644 --- a/WickedEngine/Renderable3DComponent_BindLua.cpp +++ b/WickedEngine/Renderable3DComponent_BindLua.cpp @@ -29,6 +29,8 @@ Luna::FunctionType Renderable3DComponent_BindLua: lunamethod(Renderable3DComponent_BindLua, SetVolumeLightsEnabled), lunamethod(Renderable3DComponent_BindLua, SetLightShaftsEnabled), lunamethod(Renderable3DComponent_BindLua, SetLensFlareEnabled), + lunamethod(Renderable3DComponent_BindLua, SetMotionBlurEnabled), + lunamethod(Renderable3DComponent_BindLua, SetSSSEnabled), { NULL, NULL } }; Luna::PropertyType Renderable3DComponent_BindLua::properties[] = { @@ -206,6 +208,32 @@ int Renderable3DComponent_BindLua::SetLensFlareEnabled(lua_State* L) wiLua::SError(L, "SetLensFlareEnabled(bool value) not enough arguments!"); return 0; } +int Renderable3DComponent_BindLua::SetMotionBlurEnabled(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetMotionBlurEnabled(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 1) + ((Renderable3DComponent*)component)->setMotionBlurEnabled(wiLua::SGetBool(L, 2)); + else + wiLua::SError(L, "SetMotionBlurEnabled(bool value) not enough arguments!"); + return 0; +} +int Renderable3DComponent_BindLua::SetSSSEnabled(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetSSSEnabled(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 1) + ((Renderable3DComponent*)component)->setSSSEnabled(wiLua::SGetBool(L, 2)); + else + wiLua::SError(L, "SetSSSEnabled(bool value) not enough arguments!"); + return 0; +} void Renderable3DComponent_BindLua::Bind() diff --git a/WickedEngine/Renderable3DComponent_BindLua.h b/WickedEngine/Renderable3DComponent_BindLua.h index d56ed74c1..ca18e51e0 100644 --- a/WickedEngine/Renderable3DComponent_BindLua.h +++ b/WickedEngine/Renderable3DComponent_BindLua.h @@ -27,6 +27,8 @@ public: int SetVolumeLightsEnabled(lua_State* L); int SetLightShaftsEnabled(lua_State* L); int SetLensFlareEnabled(lua_State* L); + int SetMotionBlurEnabled(lua_State* L); + int SetSSSEnabled(lua_State* L); static void Bind(); }; diff --git a/WickedEngine/effectVS10.hlsl b/WickedEngine/effectVS10.hlsl index 4a4f7d466..a31d8714e 100644 --- a/WickedEngine/effectVS10.hlsl +++ b/WickedEngine/effectVS10.hlsl @@ -55,7 +55,7 @@ PixelInputType main(Input input) Out.ReflectionMapSamplingPos = mul(pos, xRefViewProjection ); - Out.vel = mul( mul(vel.xyz,(float3x3)WORLD), xViewProjection ).xyz; + Out.vel = mul( vel.xyz, xViewProjection ).xyz; Out.ao = input.nor.w; diff --git a/WickedEngine/skyPS.hlsl b/WickedEngine/skyPS.hlsl index b793d10ba..166951993 100644 --- a/WickedEngine/skyPS.hlsl +++ b/WickedEngine/skyPS.hlsl @@ -13,7 +13,7 @@ float4 main(VSOut PSIn):SV_TARGET float3 sun = 0; float3 col = 0; [branch]if(xFx.x==0){ - col = lerp(xHorizon.rgb,enviroTex.SampleLevel( texSampler,nor,0 ).rgb,saturate(nor.y/0.3f)); + col = /*lerp( xHorizon.rgb,*/ enviroTex.SampleLevel( texSampler,nor,0 ).rgb/*, saturate(nor.y/0.3f) )*/; sun = clamp(pow(dot(xSun,nor),256)*xSunColor.rgb, 0, inf); } else{