diff --git a/WickedEngine/Editor.cpp b/WickedEngine/Editor.cpp index d466988ef..4858fb38b 100644 --- a/WickedEngine/Editor.cpp +++ b/WickedEngine/Editor.cpp @@ -1038,7 +1038,7 @@ void EditorComponent::Compose() { for (auto& y : x->lights) { - float dist = wiMath::Distance(y->translation, wiRenderer::getCamera()->translation) * 0.1f; + float dist = wiMath::Distance(y->translation, wiRenderer::getCamera()->translation) * 0.08f; wiImageEffects fx; fx.pos = y->translation; diff --git a/WickedEngine/Renderable2DComponent.cpp b/WickedEngine/Renderable2DComponent.cpp index 720665fbb..6b90ec2cb 100644 --- a/WickedEngine/Renderable2DComponent.cpp +++ b/WickedEngine/Renderable2DComponent.cpp @@ -84,7 +84,7 @@ void Renderable2DComponent::Render() { rtFinal.Activate(GRAPHICSTHREAD_IMMEDIATE, 0.0f, 0.0f, 0.0f, 0); - + wiRenderer::GetDevice()->EventBegin(L"Sprite Layers"); for (auto& x : layers) { for (auto& y : x.entities) @@ -99,6 +99,7 @@ void Renderable2DComponent::Render() } } } + wiRenderer::GetDevice()->EventEnd(); GetGUI().Render(); diff --git a/WickedEngine/Renderable3DComponent.cpp b/WickedEngine/Renderable3DComponent.cpp index b46946ac0..0360f8e19 100644 --- a/WickedEngine/Renderable3DComponent.cpp +++ b/WickedEngine/Renderable3DComponent.cpp @@ -244,6 +244,7 @@ void Renderable3DComponent::RenderSecondaryScene(wiRenderTarget& mainRT, wiRende if (getLightShaftsEnabled() && XMVectorGetX(XMVector3Dot(wiRenderer::GetSunPosition(), wiRenderer::getCamera()->GetAt())) > 0) { + wiRenderer::GetDevice()->EventBegin(L"Light Shafts", threadID); wiRenderer::GetDevice()->UnBindResources(TEXSLOT_ONDEMAND0, TEXSLOT_ONDEMAND_COUNT, threadID); rtSun[0].Activate(threadID, mainRT.depth); { wiRenderer::DrawSun(threadID); @@ -258,6 +259,7 @@ void Renderable3DComponent::RenderSecondaryScene(wiRenderTarget& mainRT, wiRende wiImage::Draw(rtSun[0].GetTexture(), fxs, threadID); } } + wiRenderer::GetDevice()->EventEnd(); } if (getEmittedParticlesEnabled()) @@ -274,6 +276,7 @@ void Renderable3DComponent::RenderSecondaryScene(wiRenderTarget& mainRT, wiRende } rtSceneCopy.Activate(threadID, 0, 0, 0, 0); { + wiRenderer::GetDevice()->EventBegin(L"Refraction Target"); fx.blendFlag = BLENDMODE_OPAQUE; fx.presentFullScreen = true; wiImage::Draw(shadedSceneRT.GetTexture(), fx, threadID); @@ -282,17 +285,21 @@ void Renderable3DComponent::RenderSecondaryScene(wiRenderTarget& mainRT, wiRende // first draw light volumes to refraction target wiRenderer::DrawVolumeLights(wiRenderer::getCamera(), threadID); } + wiRenderer::GetDevice()->EventEnd(); } wiRenderer::GetDevice()->UnBindResources(TEXSLOT_ONDEMAND0, TEXSLOT_ONDEMAND_COUNT, threadID); shadedSceneRT.Set(threadID, mainRT.depth); { RenderTransparentScene(rtSceneCopy, threadID); + wiRenderer::DrawTrails(threadID, rtSceneCopy.GetTexture()); if (getVolumeLightsEnabled()) { // second draw volume lights on top of transparent scene wiRenderer::DrawVolumeLights(wiRenderer::getCamera(), threadID); } + + wiRenderer::GetDevice()->EventBegin(L"Contribute Emitters"); fx.presentFullScreen = true; fx.blendFlag = BLENDMODE_ALPHA; if (getEmittedParticlesEnabled()) { @@ -303,9 +310,14 @@ void Renderable3DComponent::RenderSecondaryScene(wiRenderTarget& mainRT, wiRende if (getEmittedParticlesEnabled()) { wiImage::Draw(rtParticleAdditive.GetTexture(), fx, threadID); } + wiRenderer::GetDevice()->EventEnd(); + + wiRenderer::GetDevice()->EventBegin(L"Contribute LightShafts"); if (getLightShaftsEnabled()) { wiImage::Draw(rtSun.back().GetTexture(), fx, threadID); } + wiRenderer::GetDevice()->EventEnd(); + if (getLensFlareEnabled()) { if (!wiRenderer::IsWireRender()) @@ -374,17 +386,19 @@ void Renderable3DComponent::RenderComposition(wiRenderTarget& shadedSceneRT, wiR } if (getMotionBlurEnabled()) { + wiRenderer::GetDevice()->EventBegin(L"Motion Blur", threadID); rtMotionBlur.Activate(threadID); fx.process.setMotionBlur(true); fx.blendFlag = BLENDMODE_OPAQUE; fx.presentFullScreen = false; wiImage::Draw(shadedSceneRT.GetTexture(), fx, threadID); fx.process.clear(); + wiRenderer::GetDevice()->EventEnd(); } + wiRenderer::GetDevice()->EventBegin(L"Tone Mapping", threadID); fx.blendFlag = BLENDMODE_OPAQUE; - rtFinal[0].Activate(threadID); fx.process.setToneMap(true); if (getEyeAdaptionEnabled()) @@ -404,10 +418,12 @@ void Renderable3DComponent::RenderComposition(wiRenderTarget& shadedSceneRT, wiR wiImage::Draw(shadedSceneRT.GetTexture(), fx, threadID); } fx.process.clear(); + wiRenderer::GetDevice()->EventEnd(); if (getDepthOfFieldEnabled()) { + wiRenderer::GetDevice()->EventBegin(L"Depth Of Field", threadID); // downsample + blur rtDof[0].Activate(threadID); fx.blur = getDepthOfFieldStrength(); @@ -429,23 +445,28 @@ void Renderable3DComponent::RenderComposition(wiRenderTarget& shadedSceneRT, wiR fx.setMaskMap(nullptr); //fx.setDepthMap(nullptr); fx.process.clear(); + wiRenderer::GetDevice()->EventEnd(); } rtFinal[1].Activate(threadID, mainRT.depth); + wiRenderer::GetDevice()->EventBegin(L"FXAA", threadID); fx.process.setFXAA(getFXAAEnabled()); if (getDepthOfFieldEnabled()) wiImage::Draw(rtDof[2].GetTexture(), fx, threadID); else wiImage::Draw(rtFinal[0].GetTexture(), fx, threadID); fx.process.clear(); + wiRenderer::GetDevice()->EventEnd(); + wiRenderer::GetDevice()->EventBegin(L"Debug Geometry", threadID); wiRenderer::DrawDebugGridHelper(wiRenderer::getCamera(), threadID); wiRenderer::DrawDebugEnvProbes(wiRenderer::getCamera(), threadID); wiRenderer::DrawDebugBoneLines(wiRenderer::getCamera(), threadID); wiRenderer::DrawDebugLines(wiRenderer::getCamera(), threadID); wiRenderer::DrawDebugBoxes(wiRenderer::getCamera(), threadID); wiRenderer::DrawTranslators(wiRenderer::getCamera(), threadID); + wiRenderer::GetDevice()->EventEnd(); } void Renderable3DComponent::RenderColorGradedComposition(){ @@ -455,15 +476,18 @@ void Renderable3DComponent::RenderColorGradedComposition(){ if (getStereogramEnabled()) { + wiRenderer::GetDevice()->EventBegin(L"Stereogram"); fx.presentFullScreen = false; fx.process.clear(); fx.process.setStereogram(true); wiImage::Draw(wiTextureHelper::getInstance()->getRandom64x64(), fx); + wiRenderer::GetDevice()->EventEnd(); return; } if (getColorGradingEnabled()) { + wiRenderer::GetDevice()->EventBegin(L"Color Graded Composition"); fx.quality = QUALITY_BILINEAR; if (wiRenderer::GetColorGrading() != nullptr){ fx.process.setColorGrade(true); @@ -477,10 +501,12 @@ void Renderable3DComponent::RenderColorGradedComposition(){ } else { + wiRenderer::GetDevice()->EventBegin(L"Composition"); fx.presentFullScreen = true; } wiImage::Draw(rtFinal[1].GetTexture(), fx); + wiRenderer::GetDevice()->EventEnd(); } diff --git a/WickedEngine/Resource/directional_light.dds b/WickedEngine/Resource/directional_light.dds index 713f9ceb4..98af465b4 100644 Binary files a/WickedEngine/Resource/directional_light.dds and b/WickedEngine/Resource/directional_light.dds differ diff --git a/WickedEngine/Resource/pointlight.dds b/WickedEngine/Resource/pointlight.dds index 6f05bcaa7..4628de2d2 100644 Binary files a/WickedEngine/Resource/pointlight.dds and b/WickedEngine/Resource/pointlight.dds differ diff --git a/WickedEngine/Resource/spotlight.dds b/WickedEngine/Resource/spotlight.dds index 3c82f09f4..6fa001b46 100644 Binary files a/WickedEngine/Resource/spotlight.dds and b/WickedEngine/Resource/spotlight.dds differ diff --git a/WickedEngine/objectPS_forward_dirlight_water.hlsl b/WickedEngine/objectPS_forward_dirlight_water.hlsl index 55a4cc41d..362c30b68 100644 --- a/WickedEngine/objectPS_forward_dirlight_water.hlsl +++ b/WickedEngine/objectPS_forward_dirlight_water.hlsl @@ -20,8 +20,8 @@ float4 main(PixelInputType input) : SV_TARGET float2 bumpColor0=0; float2 bumpColor1=0; float2 bumpColor2=0; - bumpColor0 = 2.0f * xNormalMap.Sample(sampler_objectshader,input.tex - g_xMat_texMulAdd.ww).rg - 1.0f; - bumpColor1 = 2.0f * xNormalMap.Sample(sampler_objectshader,input.tex + g_xMat_texMulAdd.zw).rg - 1.0f; + bumpColor0 = 2.0f * xNormalMap.Sample(sampler_objectshader,UV - g_xMat_texMulAdd.ww).rg - 1.0f; + bumpColor1 = 2.0f * xNormalMap.Sample(sampler_objectshader,UV + g_xMat_texMulAdd.zw).rg - 1.0f; bumpColor2 = xWaterRipples.Sample(sampler_objectshader,ScreenCoord).rg; bumpColor= float3( bumpColor0+bumpColor1+bumpColor2,1 ) * g_xMat_refractionIndex; N = normalize(lerp(N, mul(normalize(bumpColor), TBN), g_xMat_normalMapStrength)); diff --git a/WickedEngine/objectPS_tiledforward_water.hlsl b/WickedEngine/objectPS_tiledforward_water.hlsl index 4e8d83ef3..3b3266b6c 100644 --- a/WickedEngine/objectPS_tiledforward_water.hlsl +++ b/WickedEngine/objectPS_tiledforward_water.hlsl @@ -20,8 +20,8 @@ float4 main(PixelInputType input) : SV_TARGET float2 bumpColor0 = 0; float2 bumpColor1 = 0; float2 bumpColor2 = 0; - bumpColor0 = 2.0f * xNormalMap.Sample(sampler_objectshader,input.tex - g_xMat_texMulAdd.ww).rg - 1.0f; - bumpColor1 = 2.0f * xNormalMap.Sample(sampler_objectshader,input.tex + g_xMat_texMulAdd.zw).rg - 1.0f; + bumpColor0 = 2.0f * xNormalMap.Sample(sampler_objectshader,UV - g_xMat_texMulAdd.ww).rg - 1.0f; + bumpColor1 = 2.0f * xNormalMap.Sample(sampler_objectshader,UV + g_xMat_texMulAdd.zw).rg - 1.0f; bumpColor2 = xWaterRipples.Sample(sampler_objectshader,ScreenCoord).rg; bumpColor = float3(bumpColor0 + bumpColor1 + bumpColor2,1) * g_xMat_refractionIndex; N = normalize(lerp(N, mul(normalize(bumpColor), TBN), g_xMat_normalMapStrength)); diff --git a/WickedEngine/wiGUI.cpp b/WickedEngine/wiGUI.cpp index 4c25df8eb..5a4291820 100644 --- a/WickedEngine/wiGUI.cpp +++ b/WickedEngine/wiGUI.cpp @@ -44,6 +44,7 @@ void wiGUI::Update() void wiGUI::Render() { + wiRenderer::GetDevice()->EventBegin(L"GUI"); for (auto&x : widgets) { x->Render(this); @@ -55,6 +56,7 @@ void wiGUI::Render() scissor[0].right = (LONG)(wiRenderer::GetDevice()->GetScreenWidth()); scissor[0].top = (LONG)(0); wiRenderer::GetDevice()->SetScissorRects(1, scissor, GetGraphicsThread()); + wiRenderer::GetDevice()->EventEnd(); } void wiGUI::AddWidget(wiWidget* widget) diff --git a/WickedEngine/wiRenderer.cpp b/WickedEngine/wiRenderer.cpp index d2bd11022..408937590 100644 --- a/WickedEngine/wiRenderer.cpp +++ b/WickedEngine/wiRenderer.cpp @@ -1798,11 +1798,13 @@ void wiRenderer::ManageWaterRipples(){ ) waterRipples.pop_front(); } -void wiRenderer::DrawWaterRipples(GRAPHICSTHREAD threadID){ - //wiImage::BatchBegin(threadID); +void wiRenderer::DrawWaterRipples(GRAPHICSTHREAD threadID) +{ + GetDevice()->EventBegin(L"Water Ripples"); for(wiSprite* i:waterRipples){ i->DrawNormal(threadID); } + GetDevice()->EventEnd(); } void wiRenderer::DrawDebugSpheres(Camera* camera, GRAPHICSTHREAD threadID) diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index 3688687e2..cc9c485e5 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -7,7 +7,7 @@ namespace wiVersion // minor features, major updates const int minor = 9; // minor bug fixes, alterations, refactors, updates - const int revision = 23; + const int revision = 24; long GetVersion()