cgv
|
simple class to hold the material properties of a phong material More...
#include <textured_surface_material.h>
Public Member Functions | |
textured_surface_material (const std::string &_name="default", BrdfType _brdf_type=BrdfType(BT_STRAUSS_DIFFUSE+BT_STRAUSS), color_type _diffuse_reflectance=0.5f, float _roughness=0.5f, float _metalness=0.0f, float _ambient_occlusion=1.0f, color_type _emission=color_type(0, 0, 0), float _transparency=0.0f, const std::complex< float > &_propagation_slow_down=std::complex< float >(1.5f, 0.0f), float _roughness_anisotropy=0.0f, float _roughness_orientation=0.0f, color_type _specular_reflectance=color_type(1, 1, 1), float _bump_scale=0.1f) | |
define default material | |
textured_surface_material (const obj_material &obj_mat) | |
convert obj material | |
void | set_name (std::string o) |
set the name of the material | |
const std::string & | get_name () const |
return name value | |
std::string & | ref_name () |
return reference to name value | |
void | set_sRGBA_textures (bool do_set=true) |
set whether textures are interpreted in sRGB format | |
bool | get_sRGBA_textures () const |
return whether textures are interpreted in sRGB format | |
bool & | ref_sRGBA_textures () |
return reference to whether textures are interpreted in sRGB format | |
unsigned | get_nr_image_files () const |
return number of image files | |
int | add_image_file (const std::string &file_name) |
add a new image and return its index | |
std::string | get_image_file_name (int i) const |
return the name of the i-th image file | |
void | set_image_file_name (int i, std::string image_file_name) |
set the image file name of i-th image file | |
std::string & | ref_image_file_name (int i) |
return reference to image file name of i-th image file | |
virtual size_t | get_nr_textures () const |
virtual method to query number of textures | |
void | set_diffuse_index (int i) |
int | get_diffuse_index () const |
int & | ref_diffuse_index () |
void | set_roughness_index (int i) |
int | get_roughness_index () const |
int & | ref_roughness_index () |
void | set_metalness_index (int i) |
int | get_metalness_index () const |
int & | ref_metalness_index () |
void | set_ambient_index (int i) |
int | get_ambient_index () const |
int & | ref_ambient_index () |
void | set_emission_index (int i) |
int | get_emission_index () const |
int & | ref_emission_index () |
void | set_transparency_index (int i) |
int | get_transparency_index () const |
int & | ref_transparency_index () |
void | set_specular_index (int i) |
int | get_specular_index () const |
int & | ref_specular_index () |
void | set_normal_index (int i) |
int | get_normal_index () const |
int & | ref_normal_index () |
void | set_bump_index (int i) |
int | get_bump_index () const |
int & | ref_bump_index () |
void | set_bump_scale (float bs) |
set scale of bumps | |
float | get_bump_scale () const |
return bump scale | |
float & | ref_bump_scale () |
return reference to bump scale | |
![]() | |
surface_material (BrdfType _brdf_type=BrdfType(BT_STRAUSS_DIFFUSE+BT_STRAUSS), color_type _diffuse_reflectance=color_type(0.5f, 0.5f, 0.5f), float _roughness=0.5f, float _metalness=0.0f, float _ambient_occlusion=1.0f, color_type _emission=color_type(0, 0, 0), float _transparency=0.0f, const std::complex< float > &_propagation_slow_down=std::complex< float >(1.5f, 0.0f), float _roughness_anisotropy=0.0f, float _roughness_orientation=0.0f, color_type _specular_reflectance=color_type(1, 1, 1)) | |
construct default material | |
void | set_brdf_type (BrdfType brdf_type) |
BrdfType | get_brdf_type () const |
BrdfType & | ref_brdf_type () |
void | set_ambient_occlusion (float ambient_occlusion) |
float | get_ambient_occlusion () const |
float & | ref_ambient_occlusion () |
void | set_diffuse_reflectance (color_type diffuse_reflectance) |
color_type | get_diffuse_reflectance () const |
color_type & | ref_diffuse_reflectance () |
void | set_specular_reflectance (color_type specular_reflectance) |
color_type | get_specular_reflectance () const |
color_type & | ref_specular_reflectance () |
void | set_emission (color_type emission) |
color_type | get_emission () const |
color_type & | ref_emission () |
void | set_transparency (float transparency) |
float | get_transparency () const |
float & | ref_transparency () |
void | set_roughness (float roughness) |
float | get_roughness () const |
float & | ref_roughness () |
void | set_metalness (float metalness) |
float | get_metalness () const |
float & | ref_metalness () |
void | set_roughness_anisotropy (float roughness_anisotropy) |
float | get_roughness_anisotropy () const |
float & | ref_roughness_anisotropy () |
void | set_roughness_orientation (float roughness_orientation) |
float | get_roughness_orientation () const |
float & | ref_roughness_orientation () |
void | set_propagation_slow_down (std::complex< float > propagation_slow_down) |
std::complex< float > | get_propagation_slow_down () const |
std::complex< float > & | ref_propagation_slow_down () |
Protected Attributes | |
std::string | name |
name of material | |
bool | sRGBA_textures |
whether textures are in sRGB format | |
std::vector< std::string > | image_file_names |
vector of image file names | |
int | diffuse_index |
index of image from which diffuse_reflectance should be mapped, -1 corresponds to no mapping | |
int | roughness_index |
index of image from which roughness should be mapped, -1 corresponds to no mapping | |
int | metalness_index |
index of image from which metalness should be mapped, -1 corresponds to no mapping | |
int | ambient_index |
index of image from which ambient_occlusion should be mapped, -1 corresponds to no mapping | |
int | emission_index |
index of image from which emission should be mapped, -1 corresponds to no mapping | |
int | transparency_index |
index of image from which transparency should be mapped, -1 corresponds to no mapping | |
int | propagation_slow_down_index |
index of image from which diffuse_reflectance should be mapped, -1 corresponds to no mapping | |
int | specular_index |
index of image from which specular_reflectance should be mapped, -1 corresponds to no mapping | |
int | normal_index |
index of image from which normals should be mapped, -1 corresponds to no mapping | |
int | bump_index |
index of image from which bumps should be mapped, -1 corresponds to no mapping | |
float | bump_scale |
scaling factor for bump map | |
![]() | |
BrdfType | brdf_type |
store brdf type, defaults to BT_COOK_TORRANCE | |
color_type | diffuse_reflectance |
diffuse reflectance of surface, defaults to 0.5,0.5,0.5 | |
float | roughness |
surface roughness in the range [0,1] (1/2 trace of symmetric 2x2 matrix for anisotropic case where directional roughness is represented in the uv-coordinate system of texcoords), defaults to 0.5 | |
float | metalness |
metalness of surface | |
float | ambient_occlusion |
scalar factor to down scale ambient light, defaults to 1 | |
color_type | emission |
emissive color component, defaults to 0,0,0 | |
float | transparency |
modulation for transparency, defaults to 0 | |
std::complex< float > | propagation_slow_down |
complex fraction of complex interior over real exterior index of refraction, defaults to 1.5,0 | |
float | roughness_anisotropy |
difference of roughness matrix eigenvalues in range [0,1] relative to roughness , i.e. lambda_1 - lambda_2 = roughness_anisotropy*roughness, defaults to 0 | |
float | roughness_orientation |
orientation of roughness in range [0,1], where 0 corresponds to u-direction and 0.5 to v direction, defaults to 0 | |
color_type | specular_reflectance |
specular color used to modulate specular reflection component, should be 1,1,1 | |
Additional Inherited Members | |
![]() | |
typedef color< float, RGB > | color_type |
used color type | |
simple class to hold the material properties of a phong material
Definition at line 14 of file textured_surface_material.h.
cgv::media::illum::textured_surface_material::textured_surface_material | ( | const std::string & | _name = "default" , |
BrdfType | _brdf_type = BrdfType(BT_STRAUSS_DIFFUSE + BT_STRAUSS) , |
||
color_type | _diffuse_reflectance = 0.5f , |
||
float | _roughness = 0.5f , |
||
float | _metalness = 0.0f , |
||
float | _ambient_occlusion = 1.0f , |
||
color_type | _emission = color_type(0, 0, 0) , |
||
float | _transparency = 0.0f , |
||
const std::complex< float > & | _propagation_slow_down = std::complex<float>(1.5f, 0.0f) , |
||
float | _roughness_anisotropy = 0.0f , |
||
float | _roughness_orientation = 0.0f , |
||
color_type | _specular_reflectance = color_type(1, 1, 1) , |
||
float | _bump_scale = 0.1f |
||
) |
define default material
Definition at line 10 of file textured_surface_material.cxx.
References ambient_index, bump_index, diffuse_index, emission_index, metalness_index, normal_index, propagation_slow_down_index, roughness_index, specular_index, sRGBA_textures, and transparency_index.
cgv::media::illum::textured_surface_material::textured_surface_material | ( | const obj_material & | obj_mat | ) |
convert obj material
Definition at line 45 of file textured_surface_material.cxx.
References add_image_file(), ambient_index, bump_index, diffuse_index, emission_index, cgv::media::illum::obj_material::get_ambient_texture_name(), cgv::media::illum::obj_material::get_bump_scale(), cgv::media::illum::obj_material::get_bump_texture_name(), cgv::media::illum::obj_material::get_diffuse_texture_name(), cgv::media::illum::obj_material::get_emission_texture_name(), cgv::media::illum::obj_material::get_name(), cgv::media::illum::obj_material::get_opacity(), cgv::media::illum::obj_material::get_opacity_texture_name(), cgv::media::illum::obj_material::get_specular_texture_name(), metalness_index, normal_index, propagation_slow_down_index, roughness_index, set_bump_scale(), set_name(), specular_index, sRGBA_textures, and transparency_index.
int cgv::media::illum::textured_surface_material::add_image_file | ( | const std::string & | file_name | ) |
add a new image and return its index
Definition at line 104 of file textured_surface_material.cxx.
References image_file_names.
Referenced by textured_surface_material().
|
inline |
Definition at line 109 of file textured_surface_material.h.
|
inline |
Definition at line 129 of file textured_surface_material.h.
|
inline |
return bump scale
Definition at line 135 of file textured_surface_material.h.
|
inline |
Definition at line 97 of file textured_surface_material.h.
|
inline |
Definition at line 113 of file textured_surface_material.h.
|
inline |
return the name of the i-th image file
Definition at line 88 of file textured_surface_material.h.
|
inline |
Definition at line 105 of file textured_surface_material.h.
|
inline |
return name value
Definition at line 74 of file textured_surface_material.h.
|
inline |
Definition at line 125 of file textured_surface_material.h.
|
inline |
return number of image files
Definition at line 84 of file textured_surface_material.h.
Referenced by cgv::render::shader_program::set_textured_material_uniform().
|
inlinevirtual |
virtual method to query number of textures
Reimplemented in cgv::render::textured_material.
Definition at line 94 of file textured_surface_material.h.
|
inline |
Definition at line 101 of file textured_surface_material.h.
|
inline |
Definition at line 121 of file textured_surface_material.h.
|
inline |
return whether textures are interpreted in sRGB format
Definition at line 80 of file textured_surface_material.h.
Referenced by cgv::render::shader_program::set_textured_material_uniform().
|
inline |
Definition at line 117 of file textured_surface_material.h.
|
inline |
Definition at line 110 of file textured_surface_material.h.
|
inline |
Definition at line 130 of file textured_surface_material.h.
|
inline |
return reference to bump scale
Definition at line 137 of file textured_surface_material.h.
|
inline |
Definition at line 98 of file textured_surface_material.h.
|
inline |
Definition at line 114 of file textured_surface_material.h.
|
inline |
return reference to image file name of i-th image file
Definition at line 92 of file textured_surface_material.h.
|
inline |
Definition at line 106 of file textured_surface_material.h.
|
inline |
return reference to name value
Definition at line 76 of file textured_surface_material.h.
|
inline |
Definition at line 126 of file textured_surface_material.h.
|
inline |
Definition at line 102 of file textured_surface_material.h.
|
inline |
Definition at line 122 of file textured_surface_material.h.
|
inline |
return reference to whether textures are interpreted in sRGB format
Definition at line 82 of file textured_surface_material.h.
|
inline |
Definition at line 118 of file textured_surface_material.h.
|
inline |
Definition at line 108 of file textured_surface_material.h.
|
inline |
Definition at line 128 of file textured_surface_material.h.
|
inline |
set scale of bumps
Definition at line 133 of file textured_surface_material.h.
Referenced by textured_surface_material().
|
inline |
Definition at line 96 of file textured_surface_material.h.
|
inline |
Definition at line 112 of file textured_surface_material.h.
|
inline |
set the image file name of i-th image file
Definition at line 90 of file textured_surface_material.h.
|
inline |
Definition at line 104 of file textured_surface_material.h.
|
inline |
set the name of the material
Definition at line 72 of file textured_surface_material.h.
Referenced by cgv::render::build_render_info(), cgv::render::extract_mesh(), and textured_surface_material().
|
inline |
Definition at line 124 of file textured_surface_material.h.
|
inline |
Definition at line 100 of file textured_surface_material.h.
|
inline |
Definition at line 120 of file textured_surface_material.h.
void cgv::media::illum::textured_surface_material::set_sRGBA_textures | ( | bool | do_set = true | ) |
set whether textures are interpreted in sRGB format
Definition at line 39 of file textured_surface_material.cxx.
References sRGBA_textures.
|
inline |
Definition at line 116 of file textured_surface_material.h.
|
protected |
index of image from which ambient_occlusion should be mapped, -1 corresponds to no mapping
In case of 4 component textures ambient_occlusion is mapped from the w component.
Definition at line 35 of file textured_surface_material.h.
Referenced by textured_surface_material(), and textured_surface_material().
|
protected |
index of image from which bumps should be mapped, -1 corresponds to no mapping
If no normal mapping is applies, bump map is also used for normal mapping.
Definition at line 49 of file textured_surface_material.h.
Referenced by textured_surface_material(), and textured_surface_material().
|
protected |
scaling factor for bump map
Definition at line 51 of file textured_surface_material.h.
|
protected |
index of image from which diffuse_reflectance should be mapped, -1 corresponds to no mapping
Definition at line 24 of file textured_surface_material.h.
Referenced by textured_surface_material(), and textured_surface_material().
|
protected |
index of image from which emission should be mapped, -1 corresponds to no mapping
Definition at line 37 of file textured_surface_material.h.
Referenced by textured_surface_material(), and textured_surface_material().
|
protected |
vector of image file names
Definition at line 22 of file textured_surface_material.h.
Referenced by add_image_file(), cgv::render::textured_material::add_texture_reference(), and cgv::render::textured_material::ensure_textures().
|
protected |
index of image from which metalness should be mapped, -1 corresponds to no mapping
In case of 4 component textures metalness is mapped from the w component. For 2 component textures, metalness is mapped from the x-component.
Definition at line 32 of file textured_surface_material.h.
Referenced by textured_surface_material(), and textured_surface_material().
|
protected |
name of material
Definition at line 18 of file textured_surface_material.h.
|
protected |
index of image from which normals should be mapped, -1 corresponds to no mapping
Definition at line 46 of file textured_surface_material.h.
Referenced by textured_surface_material(), and textured_surface_material().
|
protected |
index of image from which diffuse_reflectance should be mapped, -1 corresponds to no mapping
Definition at line 42 of file textured_surface_material.h.
Referenced by textured_surface_material(), and textured_surface_material().
|
protected |
index of image from which roughness should be mapped, -1 corresponds to no mapping
In case of 3 or 4 component textures roughness is mapped anisotropically from the xyz components. For 2 component textures, roughness is mapped from the y-component.
Definition at line 28 of file textured_surface_material.h.
Referenced by textured_surface_material(), and textured_surface_material().
|
protected |
index of image from which specular_reflectance should be mapped, -1 corresponds to no mapping
Definition at line 44 of file textured_surface_material.h.
Referenced by textured_surface_material(), and textured_surface_material().
|
protected |
whether textures are in sRGB format
Definition at line 20 of file textured_surface_material.h.
Referenced by set_sRGBA_textures(), textured_surface_material(), and textured_surface_material().
|
protected |
index of image from which transparency should be mapped, -1 corresponds to no mapping
In case of 4 component textures transparency is mapped from the w component.
Definition at line 40 of file textured_surface_material.h.
Referenced by textured_surface_material(), and textured_surface_material().