Adding the check for Obscurrance

This commit is contained in:
samcake 2016-07-18 18:11:51 -07:00
parent 80587ca8a3
commit 34f2a96888
10 changed files with 45 additions and 10 deletions

View file

@ -98,6 +98,10 @@ void evalLightingAmbient(out vec3 diffuse, out vec3 specular, Light light, vec3
} }
<@endif@> <@endif@>
if (!(isObscuranceEnabled() > 0.0)) {
obscurance = 1.0;
}
float lightEnergy = obscurance * getLightAmbientIntensity(light); float lightEnergy = obscurance * getLightAmbientIntensity(light);
if (isAlbedoEnabled() > 0.0) { if (isAlbedoEnabled() > 0.0) {

View file

@ -49,7 +49,14 @@ void LightingModel::setBackground(bool enable) {
bool LightingModel::isBackgroundEnabled() const { bool LightingModel::isBackgroundEnabled() const {
return (bool)_parametersBuffer.get<Parameters>().enableBackground; return (bool)_parametersBuffer.get<Parameters>().enableBackground;
} }
void LightingModel::setObscurance(bool enable) {
if (enable != isObscuranceEnabled()) {
_parametersBuffer.edit<Parameters>().enableObscurance = (float)enable;
}
}
bool LightingModel::isObscuranceEnabled() const {
return (bool)_parametersBuffer.get<Parameters>().enableObscurance;
}
void LightingModel::setScattering(bool enable) { void LightingModel::setScattering(bool enable) {
if (enable != isScatteringEnabled()) { if (enable != isScatteringEnabled()) {
@ -136,6 +143,8 @@ void MakeLightingModel::configure(const Config& config) {
_lightingModel->setLightmap(config.enableLightmap); _lightingModel->setLightmap(config.enableLightmap);
_lightingModel->setBackground(config.enableBackground); _lightingModel->setBackground(config.enableBackground);
_lightingModel->setObscurance(config.enableObscurance);
_lightingModel->setScattering(config.enableScattering); _lightingModel->setScattering(config.enableScattering);
_lightingModel->setDiffuse(config.enableDiffuse); _lightingModel->setDiffuse(config.enableDiffuse);
_lightingModel->setSpecular(config.enableSpecular); _lightingModel->setSpecular(config.enableSpecular);

View file

@ -36,6 +36,9 @@ public:
void setBackground(bool enable); void setBackground(bool enable);
bool isBackgroundEnabled() const; bool isBackgroundEnabled() const;
void setObscurance(bool enable);
bool isObscuranceEnabled() const;
void setScattering(bool enable); void setScattering(bool enable);
bool isScatteringEnabled() const; bool isScatteringEnabled() const;
void setDiffuse(bool enable); void setDiffuse(bool enable);
@ -46,6 +49,7 @@ public:
void setAlbedo(bool enable); void setAlbedo(bool enable);
bool isAlbedoEnabled() const; bool isAlbedoEnabled() const;
void setAmbientLight(bool enable); void setAmbientLight(bool enable);
bool isAmbientLightEnabled() const; bool isAmbientLightEnabled() const;
void setDirectionalLight(bool enable); void setDirectionalLight(bool enable);
@ -77,13 +81,16 @@ protected:
float enableSpecular{ 1.0f }; float enableSpecular{ 1.0f };
float enableAlbedo{ 1.0f }; float enableAlbedo{ 1.0f };
float enableAmbientLight{ 1.0f }; float enableAmbientLight{ 1.0f };
float enableDirectionalLight{ 1.0f }; float enableDirectionalLight{ 1.0f };
float enablePointLight{ 1.0f }; float enablePointLight{ 1.0f };
float enableSpotLight{ 1.0f }; float enableSpotLight{ 1.0f };
float showLightContour{ 0.0f }; // false by default float showLightContour{ 0.0f }; // false by default
glm::vec3 spares{ 0.0f }; float enableObscurance{ 1.0f };
glm::vec2 spares{ 0.0f };
Parameters() {} Parameters() {}
}; };
@ -103,6 +110,8 @@ class MakeLightingModelConfig : public render::Job::Config {
Q_PROPERTY(bool enableLightmap MEMBER enableLightmap NOTIFY dirty) Q_PROPERTY(bool enableLightmap MEMBER enableLightmap NOTIFY dirty)
Q_PROPERTY(bool enableBackground MEMBER enableBackground NOTIFY dirty) Q_PROPERTY(bool enableBackground MEMBER enableBackground NOTIFY dirty)
Q_PROPERTY(bool enableObscurance MEMBER enableObscurance NOTIFY dirty)
Q_PROPERTY(bool enableScattering MEMBER enableScattering NOTIFY dirty) Q_PROPERTY(bool enableScattering MEMBER enableScattering NOTIFY dirty)
Q_PROPERTY(bool enableDiffuse MEMBER enableDiffuse NOTIFY dirty) Q_PROPERTY(bool enableDiffuse MEMBER enableDiffuse NOTIFY dirty)
Q_PROPERTY(bool enableSpecular MEMBER enableSpecular NOTIFY dirty) Q_PROPERTY(bool enableSpecular MEMBER enableSpecular NOTIFY dirty)
@ -122,7 +131,7 @@ public:
bool enableEmissive{ true }; bool enableEmissive{ true };
bool enableLightmap{ true }; bool enableLightmap{ true };
bool enableBackground{ true }; bool enableBackground{ true };
bool enableObscurance{ true };
bool enableScattering{ true }; bool enableScattering{ true };
bool enableDiffuse{ true }; bool enableDiffuse{ true };

View file

@ -17,7 +17,7 @@ struct LightingModel {
vec4 _UnlitEmissiveLightmapBackground; vec4 _UnlitEmissiveLightmapBackground;
vec4 _ScatteringDiffuseSpecularAlbedo; vec4 _ScatteringDiffuseSpecularAlbedo;
vec4 _AmbientDirectionalPointSpot; vec4 _AmbientDirectionalPointSpot;
vec4 _ShowContour; vec4 _ShowContourObscuranceSpare2;
}; };
uniform lightingModelBuffer { uniform lightingModelBuffer {
@ -36,6 +36,9 @@ float isLightmapEnabled() {
float isBackgroundEnabled() { float isBackgroundEnabled() {
return lightingModel._UnlitEmissiveLightmapBackground.w; return lightingModel._UnlitEmissiveLightmapBackground.w;
} }
float isObscuranceEnabled() {
return lightingModel._ShowContourObscuranceSpare2.y;
}
float isScatteringEnabled() { float isScatteringEnabled() {
return lightingModel._ScatteringDiffuseSpecularAlbedo.x; return lightingModel._ScatteringDiffuseSpecularAlbedo.x;
@ -64,9 +67,10 @@ float isSpotEnabled() {
} }
float isShowLightContour() { float isShowLightContour() {
return lightingModel._ShowContour.x; return lightingModel._ShowContourObscuranceSpare2.x;
} }
<@endfunc@> <@endfunc@>
<$declareLightingModel()$> <$declareLightingModel()$>

View file

@ -326,8 +326,8 @@ SurfaceGeometryPass::SurfaceGeometryPass() {
void SurfaceGeometryPass::configure(const Config& config) { void SurfaceGeometryPass::configure(const Config& config) {
if (config.depthThreshold != getCurvatureDepthThreshold()) { if ((config.depthThreshold * 100.0f) != getCurvatureDepthThreshold()) {
_parametersBuffer.edit<Parameters>().curvatureInfo.x = config.depthThreshold; _parametersBuffer.edit<Parameters>().curvatureInfo.x = config.depthThreshold * 100.0f;
} }
if (config.basisScale != getCurvatureBasisScale()) { if (config.basisScale != getCurvatureBasisScale()) {

View file

@ -146,7 +146,7 @@ class SurfaceGeometryPassConfig : public render::Job::Config {
public: public:
SurfaceGeometryPassConfig() : render::Job::Config(true) {} SurfaceGeometryPassConfig() : render::Job::Config(true) {}
float depthThreshold{ 0.005f }; // meters float depthThreshold{ 5.0f }; // centimeters
float basisScale{ 1.0f }; float basisScale{ 1.0f };
float curvatureScale{ 10.0f }; float curvatureScale{ 10.0f };
int resolutionLevel{ 0 }; int resolutionLevel{ 0 };

View file

@ -374,3 +374,5 @@ void BlurGaussianDepthAware::run(const SceneContextPointer& sceneContext, const
batch.setUniformBuffer(BlurTask_ParamsSlot, nullptr); batch.setUniformBuffer(BlurTask_ParamsSlot, nullptr);
}); });
} }

View file

@ -156,7 +156,6 @@ protected:
BlurInOutResource _inOutResources; BlurInOutResource _inOutResources;
}; };
} }
#endif // hifi_render_BlurTask_h #endif // hifi_render_BlurTask_h

View file

@ -38,6 +38,7 @@ Column {
spacing: 10 spacing: 10
Repeater { Repeater {
model: [ model: [
"Obscurance:LightingModel:enableObscurance",
"Scattering:LightingModel:enableScattering", "Scattering:LightingModel:enableScattering",
"Diffuse:LightingModel:enableDiffuse", "Diffuse:LightingModel:enableDiffuse",
"Specular:LightingModel:enableSpecular", "Specular:LightingModel:enableSpecular",

View file

@ -18,9 +18,16 @@ Column {
spacing: 10 spacing: 10
Column{ Column{
ConfigSlider {
label: qsTr("Depth Threshold [cm]")
integral: false
config: Render.getConfig("SurfaceGeometry")
property: "depthThreshold"
max: 5.0
min: 0.0
}
Repeater { Repeater {
model: [ model: [
"Depth Threshold:depthThreshold:0.05:false",
"Basis Scale:basisScale:2.0:false", "Basis Scale:basisScale:2.0:false",
"Curvature Scale:curvatureScale:100.0:false", "Curvature Scale:curvatureScale:100.0:false",
"Downscale:resolutionLevel:4:true" "Downscale:resolutionLevel:4:true"