hairparticle fade fix

This commit is contained in:
Turanszki Janos
2019-11-10 10:01:23 +00:00
parent b8addef21d
commit 83dee7d9db
10 changed files with 45 additions and 23 deletions
+15
View File
@@ -138,6 +138,20 @@ HairParticleWindow::HairParticleWindow(wiGUI* gui) : GUI(gui)
randomSeedSlider->SetTooltip("Set hair system-wide random seed value. This will affect hair patch placement randomization.");
hairWindow->AddWidget(randomSeedSlider);
viewDistanceSlider = new wiSlider(0, 1000, 100, 10000, "View distance: ");
viewDistanceSlider->SetSize(XMFLOAT2(360, 30));
viewDistanceSlider->SetPos(XMFLOAT2(x, y += step));
viewDistanceSlider->OnSlide([&](wiEventArgs args) {
auto hair = GetHair();
if (hair != nullptr)
{
hair->viewDistance = args.fValue;
}
});
viewDistanceSlider->SetEnabled(false);
viewDistanceSlider->SetTooltip("Set view distance. After this, particles will be faded out.");
hairWindow->AddWidget(viewDistanceSlider);
hairWindow->Translate(XMFLOAT3(200, 50, 0));
hairWindow->SetVisible(false);
@@ -166,6 +180,7 @@ void HairParticleWindow::SetEntity(Entity entity)
countSlider->SetValue((float)hair->strandCount);
segmentcountSlider->SetValue((float)hair->segmentCount);
randomSeedSlider->SetValue((float)hair->randomSeed);
viewDistanceSlider->SetValue(hair->viewDistance);
}
else
{
+1
View File
@@ -36,6 +36,7 @@ public:
wiSlider* countSlider;
wiSlider* segmentcountSlider;
wiSlider* randomSeedSlider;
wiSlider* viewDistanceSlider;
};
+8 -3
View File
@@ -76,9 +76,6 @@ void MainComponent::Initialize()
wiInitializer::InitializeComponentsAsync();
wiLua::GetGlobal()->RegisterObject(MainComponent_BindLua::className, "main", new MainComponent_BindLua(this));
wiLua::GetGlobal()->RunFile("startup.lua");
}
void MainComponent::ActivatePath(RenderPath* component, float fadeSeconds, wiColor fadeColor)
@@ -122,6 +119,14 @@ void MainComponent::Run()
return;
}
static bool startup_script = false;
if (!startup_script)
{
startup_script = true;
wiLua::GetGlobal()->RegisterObject(MainComponent_BindLua::className, "main", new MainComponent_BindLua(this));
wiLua::GetGlobal()->RunFile("startup.lua");
}
wiProfiler::BeginFrame();
deltaTime = float(std::max(0.0, timer.elapsed() / 1000.0));
+8 -2
View File
@@ -207,6 +207,14 @@ void RenderPath3D_Deferred::Render() const
device->RenderPassEnd(cmd);
}
});
cmd = device->BeginCommandList();
wiJobSystem::Execute(ctx, [this, device, cmd] {
wiRenderer::UpdateCameraCB(wiRenderer::GetCamera(), cmd);
wiRenderer::BindCommonResources(cmd);
RenderSSS(cmd);
@@ -214,8 +222,6 @@ void RenderPath3D_Deferred::Render() const
RenderSSR(rtDeferred, rtGBuffer[1], cmd);
wiRenderer::BindCommonResources(cmd);
DownsampleDepthBuffer(cmd);
RenderLightShafts(cmd);
+8 -1
View File
@@ -70,13 +70,20 @@ void RenderPath3D_TiledDeferred::Render() const
wiRenderer::ComputeTiledLightCulling(
depthBuffer_Copy,
cmd,
cmd,
&rtGBuffer[0],
&rtGBuffer[1],
&rtGBuffer[2],
&lightbuffer_diffuse,
&lightbuffer_specular
);
});
cmd = device->BeginCommandList();
wiJobSystem::Execute(ctx, [this, device, cmd] {
wiRenderer::UpdateCameraCB(wiRenderer::GetCamera(), cmd);
wiRenderer::BindCommonResources(cmd);
RenderSSS(cmd);
@@ -1,12 +1,10 @@
#include "globals.hlsli"
#include "hairparticleHF.hlsli"
void main(VertexToPixel PSIn)
void main(VertexToPixel input)
{
#ifdef GRASS_FADE_DITHER
clip(dither(PSIn.pos.xy) - PSIn.fade);
#endif
clip(dither(input.pos.xy) - input.fade);
float4 color = texture_0.Sample(sampler_linear_clamp,PSIn.tex);
float4 color = texture_0.Sample(sampler_linear_clamp,input.tex);
ALPHATEST(color.a)
}
@@ -4,9 +4,7 @@
GBUFFEROutputType main(VertexToPixel input)
{
#ifdef GRASS_FADE_DITHER
clip(dither(input.pos.xy) - input.fade);
#endif
float4 color = texture_0.Sample(sampler_linear_clamp, input.tex);
color.rgb = DEGAMMA(color.rgb);
-4
View File
@@ -4,10 +4,6 @@
GBUFFEROutputType_Thin main(VertexToPixel input)
{
#ifdef GRASS_FADE_DITHER
clip(dither(input.pos.xy) - input.fade);
#endif
float4 color = texture_0.Sample(sampler_linear_clamp, input.tex);
color.rgb = DEGAMMA(color.rgb);
color.rgb *= input.color;
+1 -5
View File
@@ -255,6 +255,7 @@ void wiHairParticle::LoadShaders()
desc.numRTs = 2;
desc.RTFormats[0] = wiRenderer::RTFormat_hdr;
desc.RTFormats[1] = wiRenderer::RTFormat_gbuffer_1;
desc.dss = &dss_equal; // opaque
break;
case RENDERPASS_DEFERRED:
desc.numRTs = 5;
@@ -267,11 +268,6 @@ void wiHairParticle::LoadShaders()
break;
}
if (i == RENDERPASS_TILEDFORWARD)
{
desc.dss = &dss_equal; // opaque
}
if (j == 1)
{
desc.dss = &dss_rejectopaque_keeptransparent; // transparent
+1 -1
View File
@@ -9,7 +9,7 @@ namespace wiVersion
// minor features, major updates
const int minor = 31;
// minor bug fixes, alterations, refactors, updates
const int revision = 8;
const int revision = 9;
long GetVersion()