updated water shaders;

added some render event annotations;
updated editor;
This commit is contained in:
turanszkij
2016-10-22 00:11:31 +02:00
parent d2578f3782
commit fc34c359ef
11 changed files with 41 additions and 10 deletions
+1 -1
View File
@@ -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;
+2 -1
View File
@@ -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();
+27 -1
View File
@@ -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();
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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));
@@ -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));
+2
View File
@@ -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)
+4 -2
View File
@@ -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)
+1 -1
View File
@@ -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()