ComputerGraphik TU WIEN
Public Member Functions | Protected Attributes | Private Attributes | List of all members
Tessellation Class Reference

Implementation of tessellation, abstract class. More...

#include <tessellation.hpp>

Inheritance diagram for Tessellation:
SceneObject ParticleSystemGPU

Public Member Functions

 Tessellation (const std::string &name, Scene *scene=0, Model *model=0, const glm::mat4 &modelMatrix=glm::mat4(1))
 
virtual ~Tessellation ()
 
void draw () const
 
bool animate (double time)
 
void update (double deltaT)
 
void setShader (Shader *val)
 
GLuint getDispTexture () const
 
unsigned int getTessLevelIn () const
 
unsigned int getTessLevelOut () const
 
void setTessLevelIn (unsigned int val)
 
void setTessLevelOut (unsigned int val)
 
- Public Member Functions inherited from SceneObject
 SceneObject (std::shared_ptr< SceneObject > &effectParent, const glm::mat4 &modelMatrix=glm::mat4(1))
 
 SceneObject (const std::string &name, Scene *scene=0, Model *model=0, const glm::mat4 &modelMatrix=glm::mat4(1))
 
virtual ~SceneObject ()
 
ModelgetModel () const
 
ShadergetShader () const
 
glm::mat4 getModelMatrix () const
 
glm::mat4 getGlobalModelMatrix () const
 
std::string getName () const
 
std::shared_ptr< SceneObjectgetParent () const
 
void setAnimationTime (double time)
 
bool setAnimation (const Animation &anim)
 
bool delChild (size_t idx)
 
bool getChild (size_t idx, std::shared_ptr< SceneObject > &child) const
 
bool addChild (std::shared_ptr< SceneObject > &child)
 
bool remEffect (const std::string &name)
 
SceneObjectgetEffect (const std::string &name) const
 
bool addEffect (const std::string &name, std::unique_ptr< SceneObject > &effect)
 
bool doNotRender ()
 
bool getIsVolSun ()
 
virtual void reset ()
 

Protected Attributes

GLuint dispTexture
 
unsigned int tessLevelIn
 
unsigned int tessLevelOut
 
- Protected Attributes inherited from SceneObject
GLuint vao
 
Scenescene
 
Modelmodel
 
Shadershader
 
glm::mat4 modelMatrix
 
std::string name
 
std::weak_ptr< SceneObjectparent
 
std::vector< std::shared_ptr< SceneObject > > childs
 
std::map< std::string, std::unique_ptr< SceneObject > > effectChilds
 
size_t animIDX
 
Animation animation
 
bool norender
 
bool isVolSun
 

Private Attributes

float dispTime
 

Additional Inherited Members

- Public Types inherited from SceneObject
typedef std::vector< std::pair< double, glm::mat4 > > Animation
 

Detailed Description

Implementation of tessellation, abstract class.

Author
Adam

For the rendering of animated flying bullets effect, tessellation was implemented using the Tessellation Shader. Since this effect is part of the GPU Particle System, this section will have some references on particles. The Vertex Shader is only a pass-through shader. In the Tessellation Control Shader, the inner and outer tessellation level can be set. The visualization of this two variable on triangles can be see on following image:

tess.png
StackOverflow - Tessellation Shader - OpenGL

Using the life of a particle, the vertices of the object are scaled. For this purpose, level-of-detail is used, where larger objects will have more vertices generated. The value of tessellation levels are computed using the life of a particle. The effect uses triangles to tessellate, therefore Barycentric coordinates are received in the Tessellation Evaluation Shader. The vertices are computed by interpolating the Barycentric coordinates of the tessellated values with the control points. Then they are normalized to transform the cube model into a sphere. If quads would be tessellated, interpolation would be necessary only for normals. Displacement mapping is used in order to modify the shape of the sphere. To achieve a simple animation a 3D texture is used, which stores layers of Gaussian functions with increasing sigma value. The coordinates of the texture is the usual u, v and the third coordinate is the life of the particle. The positions are translated along the normal in local space to achieve displacement. To improve the normals of the displaced surface a Geometry Shader is used, where the tessellated normals are interpolated with the normal of the face, where the normal of the face is the cross product of two vectors computed from the displaced vertices. Finally the Fragment Shader of the OmniShadow effect is used. To achieve shadows with OmniShadow, only a simplified Tessellation Evaluation Shader is necessary for rendering the tessellation effect within the OmniShadow effect.

See also
https://www.opengl.org/wiki/Tessellation

Constructor & Destructor Documentation

Tessellation::Tessellation ( const std::string &  name,
Scene scene = 0,
Model model = 0,
const glm::mat4 &  modelMatrix = glm::mat4(1) 
)
Tessellation::~Tessellation ( )
virtual

Member Function Documentation

bool Tessellation::animate ( double  time)
virtual

Reimplemented from SceneObject.

void Tessellation::draw ( ) const
virtual

Reimplemented from SceneObject.

GLuint Tessellation::getDispTexture ( ) const
inline
unsigned int Tessellation::getTessLevelIn ( ) const
inline
unsigned int Tessellation::getTessLevelOut ( ) const
inline
void Tessellation::setShader ( Shader val)
virtual

Reimplemented from SceneObject.

void Tessellation::setTessLevelIn ( unsigned int  val)
inline
void Tessellation::setTessLevelOut ( unsigned int  val)
inline
void Tessellation::update ( double  deltaT)
virtual

Reimplemented from SceneObject.

Member Data Documentation

GLuint Tessellation::dispTexture
protected

Displacement texture.

float Tessellation::dispTime
private

Global animation time.

unsigned int Tessellation::tessLevelIn
protected

Inner tessellation level.

unsigned int Tessellation::tessLevelOut
protected

Outer tessellation level.


The documentation for this class was generated from the following files: