Radium Engine  1.5.20
Loading...
Searching...
No Matches
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

 VolumetricMaterial (const std::string &name)
 
 ~VolumetricMaterial () override
 
void updateGL () override
 Update the OpenGL states used by the ShaderParameterProvider.
 
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
virtual ~Material ()=default
 
const std::stringgetInstanceName () const
 
const std::stringgetMaterialName () const
 
void setMaterialAspect (const MaterialAspect &aspect)
 
const MaterialAspectgetMaterialAspect () const
 Get the aspect (MAT_OPAQUE or MAT_TRANSPARENT) of the material.
 
std::list< std::stringgetPropertyList () const override
 Get the list of properties the material migh use in a shader.
 
virtual void setColoredByVertexAttrib (bool state)
 Makes the Material take its base color from the VERTEX_COLOR attribute of the rendered geometry.
 
virtual bool isColoredByVertexAttrib () const
 Indicates if the material takes the VERTEX_COLOR attribute into account.
 
void needUpdate ()
 Mark the Material as needing update before the next OpenGL call.
 
- Public Member Functions inherited from Ra::Engine::Data::ShaderParameterProvider
virtual RenderParametersgetParameters ()
 
virtual const RenderParametersgetParameters () const
 
- Public Member Functions inherited from Ra::Engine::Data::ParameterSetEditingInterface

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 }
 Identifies the type of the material. More...
 
- Protected Member Functions inherited from Ra::Engine::Data::Material
 Material (const std::string &instanceName, const std::string &materialName, MaterialAspect aspect=MaterialAspect::MAT_OPAQUE)
 Creates a named material with the given aspect.
 
void setMaterialName (std::string newName)
 Change the material name.
 
bool isDirty ()
 Return dirty state.
 
void setDirty ()
 Set dirty state to true.
 
void setClean ()
 Set dirty state to false.
 

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
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.

◆ updateFromParameters()

void Ra::Engine::Data::VolumetricMaterial::updateFromParameters ( )
overridevirtual

Update the attributes of the ShaderParameterProvider to their actual values stored in the renderParameters.

Reimplemented from Ra::Engine::Data::ShaderParameterProvider.

Definition at line 32 of file VolumetricMaterial.cpp.

◆ updateGL()

void Ra::Engine::Data::VolumetricMaterial::updateGL ( )
overridevirtual

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.

Implements Ra::Engine::Data::ShaderParameterProvider.

Definition at line 25 of file VolumetricMaterial.cpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_g

Scalar Ra::Engine::Data::VolumetricMaterial::m_g { 0_ra }

phase function assymetry factor, default to 0

Definition at line 84 of file VolumetricMaterial.hpp.

◆ 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 92 of file VolumetricMaterial.hpp.

◆ m_scale

Scalar Ra::Engine::Data::VolumetricMaterial::m_scale { 1_ra }

Scale factor applied to the absorption and scattering coefficients.

Definition at line 86 of file VolumetricMaterial.hpp.

◆ m_sigma_a

Core::Utils::Color Ra::Engine::Data::VolumetricMaterial::m_sigma_a { 0.0011_ra, 0.0024_ra, 0.014_ra }

Absorption coefficient, default to Air (0.0011, 0.0024, 0.014)

Definition at line 80 of file VolumetricMaterial.hpp.

◆ m_sigma_s

Core::Utils::Color Ra::Engine::Data::VolumetricMaterial::m_sigma_s { 2.55_ra, 3.21_ra, 3.77_ra }

Scattering coefficient, default to Air (2.55, 3.21, 3.77)

Definition at line 82 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 89 of file VolumetricMaterial.hpp.


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