alpha composition effect setting moved to renderer
This commit is contained in:
@@ -119,6 +119,7 @@ You can use the Renderer with the following functions, all of which are in the g
|
||||
- SetEnvironmentMap(Texture cubemap)
|
||||
- SetColorGrading(Texture texture2D)
|
||||
- HairParticleSettings(opt int lod0, opt int lod1, opt int lod2)
|
||||
- SetAlphaCompositionEnabled(opt bool enabled)
|
||||
- SetShadowProps2D(int resolution, int count, int softShadowQuality)
|
||||
- SetShadowPropsCube(int resolution, int count)
|
||||
- SetDebugPartitionTreeEnabled(bool enabled)
|
||||
@@ -500,7 +501,6 @@ It inherits functions from Renderable2DComponent, so it can render a 2D overlay.
|
||||
- SetPreferredThreadingCount(int value)
|
||||
- SetTessellationEnabled(bool value)
|
||||
- SetMSAASampleCount(int count)
|
||||
- SetHairParticleAlphaCompositionEnabled(bool value)
|
||||
- SetStereogramEnabled(bool value)
|
||||
- SetSharpenFilterEnabled(bool value)
|
||||
- SetSharpenFilterAmount(bool value)
|
||||
|
||||
@@ -14,7 +14,7 @@ RendererWindow::RendererWindow(wiGUI* gui, Renderable3DComponent* component) : G
|
||||
wiRenderer::SetToDrawGridHelper(true);
|
||||
|
||||
rendererWindow = new wiWindow(GUI, "Renderer Window");
|
||||
rendererWindow->SetSize(XMFLOAT2(640, 930));
|
||||
rendererWindow->SetSize(XMFLOAT2(640, 960));
|
||||
rendererWindow->SetEnabled(true);
|
||||
GUI->AddWidget(rendererWindow);
|
||||
|
||||
@@ -183,6 +183,15 @@ RendererWindow::RendererWindow(wiGUI* gui, Renderable3DComponent* component) : G
|
||||
rendererWindow->AddWidget(advancedRefractionsCheckBox);
|
||||
advancedRefractionsCheckBox->SetEnabled(wiRenderer::GetDevice()->CheckCapability(wiGraphicsTypes::GraphicsDevice::GRAPHICSDEVICE_CAPABILITY_UNORDEREDACCESSTEXTURE_LOAD_FORMAT_EXT));
|
||||
|
||||
alphaCompositionCheckBox = new wiCheckBox("Alpha Composition: ");
|
||||
alphaCompositionCheckBox->SetTooltip("Enable Alpha Composition. Enables softer alpha blending on partly solid geometry (eg. vegetation) but rendering performance will be slower.");
|
||||
alphaCompositionCheckBox->SetPos(XMFLOAT2(x, y += step));
|
||||
alphaCompositionCheckBox->OnClick([=](wiEventArgs args) {
|
||||
wiRenderer::SetAlphaCompositionEnabled(args.bValue);
|
||||
});
|
||||
alphaCompositionCheckBox->SetCheck(wiRenderer::GetAlphaCompositionEnabled());
|
||||
rendererWindow->AddWidget(alphaCompositionCheckBox);
|
||||
|
||||
|
||||
pickTypeObjectCheckBox = new wiCheckBox("Pick Objects: ");
|
||||
pickTypeObjectCheckBox->SetTooltip("Enable if you want to pick objects with the pointer");
|
||||
|
||||
@@ -38,6 +38,7 @@ public:
|
||||
wiCheckBox* debugLightCullingCheckBox;
|
||||
wiCheckBox* tessellationCheckBox;
|
||||
wiCheckBox* advancedRefractionsCheckBox;
|
||||
wiCheckBox* alphaCompositionCheckBox;
|
||||
wiCheckBox* envProbesCheckBox;
|
||||
wiCheckBox* gridHelperCheckBox;
|
||||
wiCheckBox* pickTypeObjectCheckBox;
|
||||
|
||||
@@ -13,12 +13,6 @@ using namespace wiGraphicsTypes;
|
||||
DeferredRenderableComponent::DeferredRenderableComponent()
|
||||
{
|
||||
Renderable3DComponent::setProperties();
|
||||
|
||||
setSSREnabled(false);
|
||||
setSSAOEnabled(false);
|
||||
setHairParticleAlphaCompositionEnabled(false);
|
||||
|
||||
setPreferredThreadingCount(0);
|
||||
}
|
||||
DeferredRenderableComponent::~DeferredRenderableComponent()
|
||||
{
|
||||
|
||||
@@ -50,7 +50,6 @@ Luna<DeferredRenderableComponent_BindLua>::FunctionType DeferredRenderableCompon
|
||||
lunamethod(Renderable3DComponent_BindLua, SetStereogramEnabled),
|
||||
lunamethod(Renderable3DComponent_BindLua, SetEyeAdaptionEnabled),
|
||||
lunamethod(Renderable3DComponent_BindLua, SetTessellationEnabled),
|
||||
lunamethod(Renderable3DComponent_BindLua, SetHairParticleAlphaCompositionEnabled),
|
||||
lunamethod(Renderable3DComponent_BindLua, SetSharpenFilterEnabled),
|
||||
lunamethod(Renderable3DComponent_BindLua, SetSharpenFilterAmount),
|
||||
|
||||
|
||||
@@ -51,7 +51,6 @@ Luna<ForwardRenderableComponent_BindLua>::FunctionType ForwardRenderableComponen
|
||||
lunamethod(Renderable3DComponent_BindLua, SetEyeAdaptionEnabled),
|
||||
lunamethod(Renderable3DComponent_BindLua, SetTessellationEnabled),
|
||||
lunamethod(Renderable3DComponent_BindLua, SetMSAASampleCount),
|
||||
lunamethod(Renderable3DComponent_BindLua, SetHairParticleAlphaCompositionEnabled),
|
||||
lunamethod(Renderable3DComponent_BindLua, SetSharpenFilterEnabled),
|
||||
lunamethod(Renderable3DComponent_BindLua, SetSharpenFilterAmount),
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@ private:
|
||||
bool stereogramEnabled;
|
||||
bool eyeAdaptionEnabled;
|
||||
bool tessellationEnabled;
|
||||
bool hairParticleAlphaComposition;
|
||||
bool sharpenFilterEnabled;
|
||||
|
||||
UINT msaaSampleCount;
|
||||
@@ -112,7 +111,6 @@ public:
|
||||
inline bool getStereogramEnabled() { return stereogramEnabled; }
|
||||
inline bool getEyeAdaptionEnabled() { return eyeAdaptionEnabled; }
|
||||
inline bool getTessellationEnabled() { return tessellationEnabled && wiRenderer::GetDevice()->CheckCapability(wiGraphicsTypes::GraphicsDevice::GRAPHICSDEVICE_CAPABILITY_TESSELLATION); }
|
||||
inline bool getHairParticleAlphaCompositionEnabled() { return hairParticleAlphaComposition; }
|
||||
inline bool getSharpenFilterEnabled() { return sharpenFilterEnabled && getSharpenFilterAmount() > 0; }
|
||||
|
||||
inline UINT getMSAASampleCount() { return msaaSampleCount; }
|
||||
@@ -151,8 +149,6 @@ public:
|
||||
inline void setStereogramEnabled(bool value) { stereogramEnabled = value; }
|
||||
inline void setEyeAdaptionEnabled(bool value) { eyeAdaptionEnabled = value; }
|
||||
inline void setTessellationEnabled(bool value) { tessellationEnabled = value; }
|
||||
// Render hair particle systems in two passes to achieve smooth alpha blending (tiledforward only yet)
|
||||
inline void setHairParticleAlphaCompositionEnabled(bool value) { hairParticleAlphaComposition = value; }
|
||||
inline void setSharpenFilterEnabled(bool value) { sharpenFilterEnabled = value; }
|
||||
|
||||
inline void setMSAASampleCount(UINT value) { msaaSampleCount = value; ResizeBuffers(); }
|
||||
|
||||
@@ -52,7 +52,6 @@ Luna<Renderable3DComponent_BindLua>::FunctionType Renderable3DComponent_BindLua:
|
||||
lunamethod(Renderable3DComponent_BindLua, SetEyeAdaptionEnabled),
|
||||
lunamethod(Renderable3DComponent_BindLua, SetTessellationEnabled),
|
||||
lunamethod(Renderable3DComponent_BindLua, SetMSAASampleCount),
|
||||
lunamethod(Renderable3DComponent_BindLua, SetHairParticleAlphaCompositionEnabled),
|
||||
lunamethod(Renderable3DComponent_BindLua, SetSharpenFilterEnabled),
|
||||
lunamethod(Renderable3DComponent_BindLua, SetSharpenFilterAmount),
|
||||
|
||||
@@ -351,21 +350,6 @@ int Renderable3DComponent_BindLua::SetMSAASampleCount(lua_State* L)
|
||||
wiLua::SError(L, "SetMSAASampleCount(int value) not enough arguments!");
|
||||
return 0;
|
||||
}
|
||||
int Renderable3DComponent_BindLua::SetHairParticleAlphaCompositionEnabled(lua_State* L)
|
||||
{
|
||||
if (component == nullptr)
|
||||
{
|
||||
wiLua::SError(L, "SetHairParticleAlphaCompositionEnabled(bool value) component is null!");
|
||||
return 0;
|
||||
}
|
||||
if (wiLua::SGetArgCount(L) > 0)
|
||||
{
|
||||
((Renderable3DComponent*)component)->setHairParticleAlphaCompositionEnabled(wiLua::SGetBool(L, 1));
|
||||
}
|
||||
else
|
||||
wiLua::SError(L, "SetHairParticleAlphaCompositionEnabled(bool value) not enough arguments!");
|
||||
return 0;
|
||||
}
|
||||
int Renderable3DComponent_BindLua::SetSharpenFilterEnabled(lua_State* L)
|
||||
{
|
||||
if (component == nullptr)
|
||||
|
||||
@@ -35,7 +35,6 @@ public:
|
||||
int SetEyeAdaptionEnabled(lua_State* L);
|
||||
int SetTessellationEnabled(lua_State* L);
|
||||
int SetMSAASampleCount(lua_State* L);
|
||||
int SetHairParticleAlphaCompositionEnabled(lua_State* L);
|
||||
int SetSharpenFilterEnabled(lua_State* L);
|
||||
int SetSharpenFilterAmount(lua_State* L);
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ using namespace wiGraphicsTypes;
|
||||
TiledDeferredRenderableComponent::TiledDeferredRenderableComponent()
|
||||
{
|
||||
DeferredRenderableComponent::setProperties();
|
||||
setHairParticleAlphaCompositionEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,10 +36,6 @@ void TiledDeferredRenderableComponent::RenderScene(GRAPHICSTHREAD threadID)
|
||||
|
||||
rtGBuffer.Activate(threadID, 0, 0, 0, 0);
|
||||
{
|
||||
if (getHairParticleAlphaCompositionEnabled())
|
||||
{
|
||||
wiRenderer::SetAlphaRef(0.25f, threadID);
|
||||
}
|
||||
wiRenderer::GetDevice()->BindResource(PS, getReflectionsEnabled() ? rtReflection.GetTexture() : wiTextureHelper::getInstance()->getTransparent(), TEXSLOT_RENDERABLECOMPONENT_REFLECTION, threadID);
|
||||
wiRenderer::DrawWorld(wiRenderer::getCamera(), getTessellationEnabled(), threadID, SHADERTYPE_DEFERRED, getHairParticlesEnabled(), true);
|
||||
}
|
||||
@@ -205,7 +200,7 @@ void TiledDeferredRenderableComponent::RenderTransparentScene(wiRenderTarget& re
|
||||
wiRenderer::GetDevice()->BindResource(PS, getReflectionsEnabled() ? rtReflection.GetTexture() : wiTextureHelper::getInstance()->getTransparent(), TEXSLOT_RENDERABLECOMPONENT_REFLECTION, threadID);
|
||||
wiRenderer::GetDevice()->BindResource(PS, refractionRT.GetTexture(), TEXSLOT_RENDERABLECOMPONENT_REFRACTION, threadID);
|
||||
wiRenderer::GetDevice()->BindResource(PS, rtWaterRipple.GetTexture(), TEXSLOT_RENDERABLECOMPONENT_WATERRIPPLES, threadID);
|
||||
wiRenderer::DrawWorldTransparent(wiRenderer::getCamera(), SHADERTYPE_TILEDFORWARD, threadID, getHairParticlesEnabled() && getHairParticleAlphaCompositionEnabled(), true);
|
||||
wiRenderer::DrawWorldTransparent(wiRenderer::getCamera(), SHADERTYPE_TILEDFORWARD, threadID, getHairParticlesEnabled(), true);
|
||||
|
||||
wiProfiler::GetInstance().EndRange(); // Transparent Scene
|
||||
}
|
||||
|
||||
@@ -11,9 +11,6 @@ using namespace wiGraphicsTypes;
|
||||
TiledForwardRenderableComponent::TiledForwardRenderableComponent()
|
||||
{
|
||||
ForwardRenderableComponent::setProperties();
|
||||
setShadowsEnabled(true);
|
||||
setHairParticleAlphaCompositionEnabled(true);
|
||||
//setMSAASampleCount(8);
|
||||
}
|
||||
TiledForwardRenderableComponent::~TiledForwardRenderableComponent()
|
||||
{
|
||||
@@ -31,10 +28,6 @@ void TiledForwardRenderableComponent::RenderScene(GRAPHICSTHREAD threadID)
|
||||
wiProfiler::GetInstance().BeginRange("Z-Prepass", wiProfiler::DOMAIN_GPU, threadID);
|
||||
rtMain.Activate(threadID, 0, 0, 0, 0, true); // depth prepass
|
||||
{
|
||||
if (getHairParticleAlphaCompositionEnabled())
|
||||
{
|
||||
wiRenderer::SetAlphaRef(0.25f, threadID);
|
||||
}
|
||||
wiRenderer::DrawWorld(wiRenderer::getCamera(), getTessellationEnabled(), threadID, SHADERTYPE_DEPTHONLY, getHairParticlesEnabled(), true);
|
||||
}
|
||||
wiProfiler::GetInstance().EndRange(threadID);
|
||||
@@ -129,7 +122,7 @@ void TiledForwardRenderableComponent::RenderTransparentScene(wiRenderTarget& ref
|
||||
wiRenderer::GetDevice()->BindResource(PS, getReflectionsEnabled() ? rtReflection.GetTexture() : wiTextureHelper::getInstance()->getTransparent(), TEXSLOT_RENDERABLECOMPONENT_REFLECTION, threadID);
|
||||
wiRenderer::GetDevice()->BindResource(PS, refractionRT.GetTexture(), TEXSLOT_RENDERABLECOMPONENT_REFRACTION, threadID);
|
||||
wiRenderer::GetDevice()->BindResource(PS, rtWaterRipple.GetTexture(), TEXSLOT_RENDERABLECOMPONENT_WATERRIPPLES, threadID);
|
||||
wiRenderer::DrawWorldTransparent(wiRenderer::getCamera(), SHADERTYPE_TILEDFORWARD, threadID, getHairParticlesEnabled() && getHairParticleAlphaCompositionEnabled(), true);
|
||||
wiRenderer::DrawWorldTransparent(wiRenderer::getCamera(), SHADERTYPE_TILEDFORWARD, threadID, getHairParticlesEnabled(), true);
|
||||
|
||||
wiProfiler::GetInstance().EndRange(threadID); // Transparent Scene
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ Luna<TiledForwardRenderableComponent_BindLua>::FunctionType TiledForwardRenderab
|
||||
lunamethod(Renderable3DComponent_BindLua, SetEyeAdaptionEnabled),
|
||||
lunamethod(Renderable3DComponent_BindLua, SetTessellationEnabled),
|
||||
lunamethod(Renderable3DComponent_BindLua, SetMSAASampleCount),
|
||||
lunamethod(Renderable3DComponent_BindLua, SetHairParticleAlphaCompositionEnabled),
|
||||
lunamethod(Renderable3DComponent_BindLua, SetSharpenFilterEnabled),
|
||||
lunamethod(Renderable3DComponent_BindLua, SetSharpenFilterAmount),
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ float wiRenderer::GAMMA = 2.2f;
|
||||
int wiRenderer::SHADOWRES_2D = 1024, wiRenderer::SHADOWRES_CUBE = 256, wiRenderer::SHADOWCOUNT_2D = 5 + 3 + 3, wiRenderer::SHADOWCOUNT_CUBE = 5, wiRenderer::SOFTSHADOWQUALITY_2D = 2;
|
||||
bool wiRenderer::HAIRPARTICLEENABLED=true,wiRenderer::EMITTERSENABLED=true;
|
||||
bool wiRenderer::TRANSPARENTSHADOWSENABLED = true;
|
||||
bool wiRenderer::ALPHACOMPOSITIONENABLED = false;
|
||||
bool wiRenderer::wireRender = false, wiRenderer::debugSpheres = false, wiRenderer::debugBoneLines = false, wiRenderer::debugPartitionTree = false, wiRenderer::debugEmitters = false, wiRenderer::freezeCullingCamera = false
|
||||
, wiRenderer::debugEnvProbes = false, wiRenderer::debugForceFields = false, wiRenderer::gridHelper = false, wiRenderer::voxelHelper = false, wiRenderer::requestReflectionRendering = false, wiRenderer::advancedLightCulling = true
|
||||
, wiRenderer::advancedRefractions = false;
|
||||
@@ -5325,6 +5326,11 @@ void wiRenderer::DrawWorld(Camera* camera, bool tessellation, GRAPHICSTHREAD thr
|
||||
|
||||
if (grass)
|
||||
{
|
||||
if (GetAlphaCompositionEnabled())
|
||||
{
|
||||
// cut off most transparent areas
|
||||
SetAlphaRef(0.25f, threadID);
|
||||
}
|
||||
for (wiHairParticle* hair : culling.culledHairParticleSystems)
|
||||
{
|
||||
hair->Draw(camera, shaderType, false, threadID);
|
||||
@@ -5358,8 +5364,9 @@ void wiRenderer::DrawWorldTransparent(Camera* camera, SHADERTYPE shaderType, GRA
|
||||
ocean->Render(camera, renderTime, threadID);
|
||||
}
|
||||
|
||||
if (grass)
|
||||
if (grass && GetAlphaCompositionEnabled())
|
||||
{
|
||||
// transparent passes can only render hair when alpha composition is enabled
|
||||
for (wiHairParticle* hair : culling.culledHairParticleSystems)
|
||||
{
|
||||
hair->Draw(camera, shaderType, true, threadID);
|
||||
|
||||
@@ -110,6 +110,7 @@ public:
|
||||
static XMFLOAT2 temporalAAJitter, temporalAAJitterPrev;
|
||||
static float RESOLUTIONSCALE;
|
||||
static bool TRANSPARENTSHADOWSENABLED;
|
||||
static bool ALPHACOMPOSITIONENABLED;
|
||||
|
||||
static void SetShadowProps2D(int resolution, int count, int softShadowQuality);
|
||||
static void SetShadowPropsCube(int resolution, int count);
|
||||
@@ -355,6 +356,8 @@ public:
|
||||
static bool GetDebugLightCulling() { return debugLightCulling; }
|
||||
static void SetAdvancedLightCulling(bool enabled) { advancedLightCulling = enabled; }
|
||||
static bool GetAdvancedLightCulling() { return advancedLightCulling; }
|
||||
static void SetAlphaCompositionEnabled(bool enabled) { ALPHACOMPOSITIONENABLED = enabled; }
|
||||
static bool GetAlphaCompositionEnabled() { return ALPHACOMPOSITIONENABLED; }
|
||||
static void SetOcclusionCullingEnabled(bool enabled); // also inits query pool!
|
||||
static bool GetOcclusionCullingEnabled() { return occlusionCulling; }
|
||||
static void SetLDSSkinningEnabled(bool enabled) { ldsSkinningEnabled = enabled; }
|
||||
|
||||
@@ -396,6 +396,15 @@ namespace wiRenderer_BindLua
|
||||
wiHairParticle::Settings(lod0, lod1, lod2);
|
||||
return 0;
|
||||
}
|
||||
int SetAlphaCompositionEnabled(lua_State* L)
|
||||
{
|
||||
int argc = wiLua::SGetArgCount(L);
|
||||
if (argc > 0)
|
||||
{
|
||||
wiRenderer::SetAlphaCompositionEnabled(wiLua::SGetBool(L, 1));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int SetShadowProps2D(lua_State* L)
|
||||
{
|
||||
int argc = wiLua::SGetArgCount(L);
|
||||
@@ -706,6 +715,7 @@ namespace wiRenderer_BindLua
|
||||
wiLua::GetGlobal()->RegisterFunc("SetEnvironmentMap", SetEnvironmentMap);
|
||||
wiLua::GetGlobal()->RegisterFunc("SetColorGrading", SetColorGrading);
|
||||
wiLua::GetGlobal()->RegisterFunc("HairParticleSettings", HairParticleSettings);
|
||||
wiLua::GetGlobal()->RegisterFunc("SetAlphaCompositionEnabled", SetAlphaCompositionEnabled);
|
||||
wiLua::GetGlobal()->RegisterFunc("SetShadowProps2D", SetShadowProps2D);
|
||||
wiLua::GetGlobal()->RegisterFunc("SetShadowPropsCube", SetShadowPropsCube);
|
||||
wiLua::GetGlobal()->RegisterFunc("SetDebugBoxesEnabled", SetDebugBoxesEnabled);
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace wiVersion
|
||||
// minor features, major updates
|
||||
const int minor = 16;
|
||||
// minor bug fixes, alterations, refactors, updates
|
||||
const int revision = 23;
|
||||
const int revision = 24;
|
||||
|
||||
|
||||
long GetVersion()
|
||||
|
||||
Reference in New Issue
Block a user