Radium Engine  1.5.0
Ra::Engine::Data::VolumetricMaterial Class Referencefinal

#include <Engine/Data/VolumetricMaterial.hpp>

+ Inheritance diagram for Ra::Engine::Data::VolumetricMaterial:
+ Collaboration diagram for Ra::Engine::Data::VolumetricMaterial:

Public Member Functions

EIGEN_MAKE_ALIGNED_OPERATOR_NEW VolumetricMaterial (const std::string &name)
 
 ~VolumetricMaterial () override
 
void updateGL () override
 Update the OpenGL states used by the ShaderParameterProvider. These state could be the ones from an associated material (textures, precomputed tables or whatever data associated to the material) or some parameters that are specific to the provider semantic.
 
void updateFromParameters () override
 Update the attributes of the ShaderParameterProvider to their actual values stored in the renderParameters.
 
bool isTransparent () const override
 
void setTexture (Texture *texture)
 
TexturegetTexture () const
 
nlohmann::json getParametersMetadata () const override
 
- Public Member Functions inherited from Ra::Engine::Data::Material
const std::string & getInstanceName () const
 
const std::string & getMaterialName () const
 
void setMaterialAspect (const MaterialAspect &aspect)
 
const MaterialAspectgetMaterialAspect () const
 
std::list< std::string > getPropertyList () const override
 
virtual void setColoredByVertexAttrib (bool)
 Makes the Material take its base color from the VERTEX_COLOR attribute of the rendered geometry. More...
 
virtual bool isColoredByVertexAttrib () const
 Indicates if the material takes the VERTEX_COLOR attribute into account.
 
void needUpdate ()
 
- Public Member Functions inherited from Ra::Engine::Data::ShaderParameterProvider
virtual RenderParametersgetParameters ()
 
virtual const RenderParametersgetParameters () const
 

Static Public Member Functions

static void registerMaterial ()
 
static void unregisterMaterial ()
 
- Static Public Member Functions inherited from Ra::Engine::Data::ParameterSetEditingInterface
static void loadMetaData (const std::string &basename, nlohmann::json &destination)
 Load the ParameterSet description.
 

Public Attributes

Core::Utils::Color m_sigma_a { 0.0011_ra, 0.0024_ra, 0.014_ra }
 Absorption coefficient, default to Air (0.0011, 0.0024, 0.014)
 
Core::Utils::Color m_sigma_s { 2.55_ra, 3.21_ra, 3.77_ra }
 Scattering coefficient, default to Air (2.55, 3.21, 3.77)
 
Scalar m_g { 0_ra }
 phase function assymetry factor, default to 0
 
Scalar m_scale { 1_ra }
 Scale factor applied to the absorption and scattering coefficients.
 
Scalar m_stepsize { -1_ra }
 
Core::Transform m_modelToMedium { Core::Transform::Identity() }
 

Additional Inherited Members

- Public Types inherited from Ra::Engine::Data::Material
enum class  MaterialAspect { MAT_OPAQUE , MAT_TRANSPARENT , MAT_DENSITY }
 
- Protected Member Functions inherited from Ra::Engine::Data::Material
 Material (const std::string &instanceName, const std::string &materialName, MaterialAspect aspect=MaterialAspect::MAT_OPAQUE)
 
void setMaterialName (std::string newName)
 
- Protected Attributes inherited from Ra::Engine::Data::Material
std::string m_instanceName {}
 Material instance name.
 
MaterialAspect m_aspect { MaterialAspect::MAT_OPAQUE }
 Material aspect.
 
bool m_isDirty { true }
 

Detailed Description

Implementation of a simple Volumetric Material. Based on a 3D texture defining the density distribution in the volume, perform ray-marching and absorption based rendering of the volume..

Todo:
This material does not implement the MaterialGLSL interface. Shader compositing is not allowed.

Definition at line 24 of file VolumetricMaterial.hpp.

Constructor & Destructor Documentation

◆ VolumetricMaterial()

Ra::Engine::Data::VolumetricMaterial::VolumetricMaterial ( const std::string &  name)
explicit

Construct a named VolumetricMaterial

Parameters
nameThe name of the material

Definition at line 20 of file VolumetricMaterial.cpp.

◆ ~VolumetricMaterial()

Ra::Engine::Data::VolumetricMaterial::~VolumetricMaterial ( )
override

Destructor.

Note
The material does not have ownership on its texture. This destructor do not delete the associated textures.

Definition at line 23 of file VolumetricMaterial.cpp.

Member Function Documentation

◆ getParametersMetadata()

nlohmann::json Ra::Engine::Data::VolumetricMaterial::getParametersMetadata ( ) const
inlineoverridevirtual

Get a json containing metadata about the parameters of the material.

Returns
the metadata in json format

Implements Ra::Engine::Data::ParameterSetEditingInterface.

Definition at line 117 of file VolumetricMaterial.hpp.

◆ getTexture()

Texture * Ra::Engine::Data::VolumetricMaterial::getTexture ( ) const
inline

Get the texture associated to the given semantic.

Parameters
semantic
Returns
the corresponding texture

Definition at line 113 of file VolumetricMaterial.hpp.

◆ isTransparent()

bool Ra::Engine::Data::VolumetricMaterial::isTransparent ( ) const
overridevirtual

Test if material is transperent.

Returns
true if the material is transparent

Reimplemented from Ra::Engine::Data::Material.

Definition at line 58 of file VolumetricMaterial.cpp.

◆ registerMaterial()

void Ra::Engine::Data::VolumetricMaterial::registerMaterial ( )
static

Register the material in the material library. After registration, the material could be instantiated by any Radium system, renderer, plugin, ...

Definition at line 62 of file VolumetricMaterial.cpp.

+ Here is the call graph for this function:

◆ setTexture()

void Ra::Engine::Data::VolumetricMaterial::setTexture ( Texture texture)
inline

Add an already existing texture to control the specified BSDF parameter.

Parameters
semanticThe texture semantic
textureThe texture to use

Definition at line 109 of file VolumetricMaterial.hpp.

◆ unregisterMaterial()

void Ra::Engine::Data::VolumetricMaterial::unregisterMaterial ( )
static

Remove the material from the material library. After removal, the material is no more available, ...

Definition at line 120 of file VolumetricMaterial.cpp.

Member Data Documentation

◆ m_modelToMedium

Core::Transform Ra::Engine::Data::VolumetricMaterial::m_modelToMedium { Core::Transform::Identity() }

Transformation matrix to go from the associated geometry frame to the canonical [0, 1]^3 density domain

Definition at line 93 of file VolumetricMaterial.hpp.

◆ m_stepsize

Scalar Ra::Engine::Data::VolumetricMaterial::m_stepsize { -1_ra }

Step size for ray-marching rendering. If negative whane rendering, interpreted as 1/textureDim.

Definition at line 90 of file VolumetricMaterial.hpp.


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