6.5.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit ae6e0d00 authored by schultezub's avatar schultezub

added shadow intensity property to SimpleRaycaster

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@304 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent 099ffa57
...@@ -78,7 +78,7 @@ namespace TUMVis { ...@@ -78,7 +78,7 @@ namespace TUMVis {
break; break;
} }
// avoid expensive context-switches for contexts without oending jobs. // avoid expensive context-switches for contexts without pending jobs.
if (a->second->empty()) if (a->second->empty())
continue; continue;
......
...@@ -39,11 +39,13 @@ namespace TUMVis { ...@@ -39,11 +39,13 @@ namespace TUMVis {
: RaycastingProcessor(canvasSize, "modules/vis/simpleraycaster.frag", true) : RaycastingProcessor(canvasSize, "modules/vis/simpleraycaster.frag", true)
, _targetImageID("targetImageID", "Output Image", "", DataNameProperty::WRITE) , _targetImageID("targetImageID", "Output Image", "", DataNameProperty::WRITE)
, _enableShadowing("EnableShadowing", "Enable Hard Shadows", false, InvalidationLevel::INVALID_SHADER) , _enableShadowing("EnableShadowing", "Enable Hard Shadows", false, InvalidationLevel::INVALID_SHADER)
, _shadowIntensity("ShadowIntensity", "Shadow Intensity", .5f, .0f, 1.f)
{ {
addDecorator(new ProcessorDecoratorShading()); addDecorator(new ProcessorDecoratorShading());
addProperty(&_enableShadowing);
addProperty(&_targetImageID); addProperty(&_targetImageID);
addProperty(&_enableShadowing);
addProperty(&_shadowIntensity);
decoratePropertyCollection(this); decoratePropertyCollection(this);
// TODO: remove hack // TODO: remove hack
...@@ -63,6 +65,9 @@ namespace TUMVis { ...@@ -63,6 +65,9 @@ namespace TUMVis {
GLenum buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 , GL_COLOR_ATTACHMENT2 }; GLenum buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 , GL_COLOR_ATTACHMENT2 };
glDrawBuffers(3, buffers); glDrawBuffers(3, buffers);
if (_enableShadowing.getValue())
_shader->setUniform("_shadowIntensity", _shadowIntensity.getValue());
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glDepthFunc(GL_ALWAYS); glDepthFunc(GL_ALWAYS);
QuadRdr.renderQuad(); QuadRdr.renderQuad();
......
...@@ -57,6 +57,10 @@ uniform vec3 _cameraPosition; ...@@ -57,6 +57,10 @@ uniform vec3 _cameraPosition;
uniform float _samplingStepSize; uniform float _samplingStepSize;
#ifdef ENABLE_SHADOWING
uniform float _shadowIntensity;
#endif
// TODO: copy+paste from Voreen - eliminate or improve. // TODO: copy+paste from Voreen - eliminate or improve.
const float SAMPLING_BASE_INTERVAL_RCP = 200.0; const float SAMPLING_BASE_INTERVAL_RCP = 200.0;
...@@ -104,7 +108,7 @@ vec4 performRaycasting(in vec3 entryPoint, in vec3 exitPoint, in vec2 texCoords) ...@@ -104,7 +108,7 @@ vec4 performRaycasting(in vec3 entryPoint, in vec3 exitPoint, in vec2 texCoords)
|| any(greaterThan(position, vec3(1.0, 1.0, 1.0))); || any(greaterThan(position, vec3(1.0, 1.0, 1.0)));
} }
// apply shadow to color // apply shadow to color
color.rgb *= (1.0 - shadowFactor); color.rgb *= (1.0 - shadowFactor * _shadowIntensity);
} }
#endif #endif
......
...@@ -65,6 +65,7 @@ namespace TUMVis { ...@@ -65,6 +65,7 @@ namespace TUMVis {
DataNameProperty _targetImageID; ///< image ID for output image DataNameProperty _targetImageID; ///< image ID for output image
BoolProperty _enableShadowing; BoolProperty _enableShadowing;
FloatProperty _shadowIntensity;
protected: protected:
/// \see RaycastingProcessor::processImpl() /// \see RaycastingProcessor::processImpl()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment