OpenSceneGraph 3.6.5
SoftShadowMap
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSGSHADOW_SOFTSHADOWMAP
15#define OSGSHADOW_SOFTSHADOWMAP 1
16
17#include <osg/Camera>
18#include <osg/Material>
19#include <osg/MatrixTransform>
20#include <osg/LightSource>
21
22#include <osgShadow/ShadowMap>
23
24namespace osgShadow {
25
28{
29 public :
31
33
35
39 void setSoftnessWidth(float softnessWidth);
40
42 float getSoftnessWidth() const { return _softnessWidth; }
43
49 void setJitteringScale(float jitteringScale);
50
52 float getJitteringScale() const { return _jitteringScale; }
53
55 void setJitterTextureUnit(unsigned int jitterTextureUnit);
56
58 unsigned int getJitterTextureUnit() const { return _jitterTextureUnit; }
59
60
66 void setBias(float bias) { setPolygonOffset(osg::Vec2(bias,0)); }
67
69 float getBias() const { return getPolygonOffset().x(); }
70
71
72 protected:
73 virtual ~SoftShadowMap(void) {};
74
79
84 unsigned int _jitterTextureUnit;
85
86
87
88};
89
90}
91
92#endif
Vec2f Vec2
Definition Vec2:21
The osgShadow library is a NodeKit that extends the core scene graph to add support for a range of sh...
Definition ConvexPolyhedron:33
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
Stores a set of modes and attributes which represent a set of OpenGL state.
Definition StateSet:46
void setPolygonOffset(const osg::Vec2 &polyOffset)
set the polygon offset used initially
const osg::Vec2 & getPolygonOffset() const
get the used polygon offset
Definition ShadowMap:46
void createUniforms()
Create the managed Uniforms.
META_Object(osgShadow, SoftShadowMap)
float _jitteringScale
Definition SoftShadowMap:83
float getJitteringScale() const
Get the value used for jittering scale in the shader.
Definition SoftShadowMap:52
SoftShadowMap(const SoftShadowMap &es, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
osg::ref_ptr< osg::Uniform > _jitteringScaleUniform
Definition SoftShadowMap:81
void setJitterTextureUnit(unsigned int jitterTextureUnit)
Set the texture unit that the jitter texture will be applied on.
void initJittering(osg::StateSet *ss)
void setJitteringScale(float jitteringScale)
Set the values for jittering scale the shader will use.
float _softnessWidth
Definition SoftShadowMap:82
unsigned int _jitterTextureUnit
Definition SoftShadowMap:84
float getBias() const
Return the bias value.
Definition SoftShadowMap:69
void setBias(float bias)
Add a small bias to the z-value, this can reduce shadow acne problem.
Definition SoftShadowMap:66
unsigned int getJitterTextureUnit() const
Get the texture unit that the jitter texture will be applied on.
Definition SoftShadowMap:58
float getSoftnessWidth() const
Get the value used for width of the soft penumbra in the shader.
Definition SoftShadowMap:42
virtual ~SoftShadowMap(void)
Definition SoftShadowMap:73
osg::ref_ptr< osg::Uniform > _softnessWidthUniform
Definition SoftShadowMap:80
void setSoftnessWidth(float softnessWidth)
Set the values for width of the soft penumbra the shader will use.
#define OSGSHADOW_EXPORT
Definition Export:39

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.