mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-16 01:24:36 +00:00
Better exposure of shadow parameters
This commit is contained in:
parent
d594e7d304
commit
d73f2eca96
@ -2,7 +2,7 @@ uniform mat4 mvpl;
|
||||
uniform sampler2D shadowMap;
|
||||
uniform float texSize;
|
||||
varying vec4 shadowCoord;
|
||||
|
||||
uniform float shadowIntensity; // 1.0 black, 0, transparent
|
||||
|
||||
vec4 shadowCoordPostW;
|
||||
float chebyshevUpperBound( float distance) {
|
||||
@ -29,5 +29,7 @@ void main() {
|
||||
if (shadow > 0.4)
|
||||
discard;
|
||||
|
||||
gl_FragColor = vec4(vec3(0.0), 0.5 - shadow);
|
||||
}
|
||||
// gl_FragColor = vec4(vec3(0.0), 0.5 - shadow);
|
||||
gl_FragColor = vec4(vec3(0.0), (shadowIntensity-shadow));
|
||||
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ uniform mat4 mvpl;
|
||||
uniform sampler2D shadowMap;
|
||||
uniform float texSize;
|
||||
varying vec4 shadowCoord;
|
||||
uniform float shadowIntensity; // 1.0 black, 0, transparent
|
||||
|
||||
|
||||
vec4 shadowCoordPostW;
|
||||
@ -36,5 +37,7 @@ void main() {
|
||||
// gl_FragColor = vec4(0.0,0.0,0.0, 0.0);
|
||||
// }
|
||||
else
|
||||
gl_FragColor = vec4(vec3(0.0), 0.5 - shadow);
|
||||
}
|
||||
// gl_FragColor = vec4(vec3(0.0), 0.5 - shadow);
|
||||
gl_FragColor = vec4(vec3(0.0), (shadowIntensity-shadow));
|
||||
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ void DecorateShadowPlugin::initGlobalParameterSet(QAction *action, RichParameter
|
||||
"Shader used to perform shadow mapping decoration",
|
||||
"Shadow mapping method")
|
||||
);
|
||||
parset.addParam(new RichFloat(this->DecorateShadowIntensity(),0.3,"Shadow Intensity","Shadow Intensity"));
|
||||
parset.addParam(new RichDynamicFloat(this->DecorateShadowIntensity(),0.3,0,1.0f,"Shadow Intensity","Shadow Intensity"));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -86,15 +86,15 @@ bool DecorateShadowPlugin::startDecorate(QAction* action, MeshDocument& m, RichP
|
||||
}
|
||||
switch (parset->getEnum(DecorateShadowMethod())){
|
||||
case SH_MAP:
|
||||
this->_decoratorSH = new ShadowMapping(parset->getFloat(this->DecorateShadowIntensity()));
|
||||
this->_decoratorSH = new ShadowMapping(parset->getDynamicFloat(this->DecorateShadowIntensity()));
|
||||
break;
|
||||
|
||||
case SH_MAP_VSM:
|
||||
this->_decoratorSH = new VarianceShadowMapping(parset->getFloat(this->DecorateShadowIntensity()));
|
||||
this->_decoratorSH = new VarianceShadowMapping(parset->getDynamicFloat(this->DecorateShadowIntensity()));
|
||||
break;
|
||||
|
||||
case SH_MAP_VSM_BLUR:
|
||||
this->_decoratorSH = new VarianceShadowMappingBlur(parset->getFloat(this->DecorateShadowIntensity()));
|
||||
this->_decoratorSH = new VarianceShadowMappingBlur(parset->getDynamicFloat(this->DecorateShadowIntensity()));
|
||||
break;
|
||||
|
||||
default: assert(0);
|
||||
|
||||
@ -117,6 +117,9 @@ void VarianceShadowMapping::runShader(MeshDocument& md, GLArea* gla){
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, this->_shadowMap);
|
||||
|
||||
GLuint shadowIntensityLoc = glGetUniformLocation(this->_shadowMappingProgram, "shadowIntensity");
|
||||
glUniform1f(shadowIntensityLoc, this->_intensity);
|
||||
|
||||
GLuint loc = glGetUniformLocation(this->_shadowMappingProgram, "shadowMap");
|
||||
glUniform1i(loc, 0);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
@ -158,6 +158,9 @@ void VarianceShadowMappingBlur::runShader(MeshDocument& md, GLArea* gla){
|
||||
GLuint matrixLoc = glGetUniformLocation(this->_shadowMappingProgram, "mvpl");
|
||||
glUniformMatrix4fv(matrixLoc, 1, 0, mvpl.V());
|
||||
|
||||
GLuint shadowIntensityLoc = glGetUniformLocation(this->_shadowMappingProgram, "shadowIntensity");
|
||||
glUniform1f(shadowIntensityLoc, this->_intensity);
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, this->_blurV);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user