Material
from panda3d.core import Material
- class Material
Bases:
TypedWritableReferenceCount
,Namable
Defines the way an object appears in the presence of lighting. A material is only necessary if lighting is to be enabled; otherwise, the material isn’t used.
There are two workflows that are supported: the “classic” workflow of providing separate ambient, diffuse and specular colors, and the “metalness” workflow, in which a base color is specified along with a “metallic” value that indicates whether the material is a metal or a dielectric.
The size of the specular highlight can be specified by either specifying the specular exponent (shininess) or by specifying a roughness value that in perceptually linear in the range of 0-1.
Inheritance diagram
- __init__(*args, **kwargs)
- ambient
- assign()
C++ Interface: assign(const Material self, const Material copy)
- base_color
- clearAmbient()
C++ Interface: clear_ambient(const Material self)
- /**
Removes the explicit ambient color from the material.
*/
- clearBaseColor()
C++ Interface: clear_base_color(const Material self)
- /**
Removes the explicit base_color color from the material.
*/
- clearDiffuse()
C++ Interface: clear_diffuse(const Material self)
- /**
Removes the explicit diffuse color from the material.
*/
- clearEmission()
C++ Interface: clear_emission(const Material self)
- /**
Removes the explicit emission color from the material.
*/
- clearMetallic()
C++ Interface: clear_metallic(const Material self)
- /**
Removes the explicit metallic setting from the material.
*/
- clearSpecular()
C++ Interface: clear_specular(const Material self)
- /**
Removes the explicit specular color from the material.
*/
- clear_ambient()
C++ Interface: clear_ambient(const Material self)
- /**
Removes the explicit ambient color from the material.
*/
- clear_base_color()
C++ Interface: clear_base_color(const Material self)
- /**
Removes the explicit base_color color from the material.
*/
- clear_diffuse()
C++ Interface: clear_diffuse(const Material self)
- /**
Removes the explicit diffuse color from the material.
*/
- clear_emission()
C++ Interface: clear_emission(const Material self)
- /**
Removes the explicit emission color from the material.
*/
- clear_metallic()
C++ Interface: clear_metallic(const Material self)
- /**
Removes the explicit metallic setting from the material.
*/
- clear_specular()
C++ Interface: clear_specular(const Material self)
- /**
Removes the explicit specular color from the material.
*/
- compareTo()
C++ Interface: compare_to(Material self, const Material other)
- /**
Returns a number less than zero if this material sorts before the other
one, greater than zero if it sorts after, or zero if they are equivalent.
The sorting order is arbitrary and largely meaningless, except to
differentiate different materials.
*/
- compare_to()
C++ Interface: compare_to(Material self, const Material other)
- /**
Returns a number less than zero if this material sorts before the other
one, greater than zero if it sorts after, or zero if they are equivalent.
The sorting order is arbitrary and largely meaningless, except to
differentiate different materials.
*/
- diffuse
- emission
- getAmbient()
C++ Interface: get_ambient(Material self)
- /**
Returns the ambient color setting, if it has been set. Returns (0,0,0,0)
if the ambient color has not been set.
*/
- getBaseColor()
C++ Interface: get_base_color(Material self)
- /**
Returns the base_color color setting, if it has been set. If neither the
base color nor the metallic have been set, this returns the diffuse color.
*/
- getClassType()
C++ Interface: get_class_type()
- getDiffuse()
C++ Interface: get_diffuse(Material self)
- /**
Returns the diffuse color setting, if it has been set. Returns (1,1,1,1)
if the diffuse color has not been set.
*/
- getEmission()
C++ Interface: get_emission(Material self)
- /**
Returns the emission color setting, if it has been set. Returns (0,0,0,0)
if the emission color has not been set.
*/
- getLocal()
C++ Interface: get_local(Material self)
- /**
Returns the local viewer flag. Set set_local().
*/
- getMetallic()
C++ Interface: get_metallic(Material self)
- /**
Returns the metallic setting, if it has been set. Returns 0 if it has not
been set.
*/
- getRefractiveIndex()
C++ Interface: get_refractive_index(Material self)
- /**
Returns the index of refraction, or 1 if none has been set for this
material.
*/
- getRoughness()
C++ Interface: get_roughness(Material self)
- /**
Returns the roughness previously specified by set_roughness. If none was
previously set, this value is computed from the shininess value.
*/
- getShininess()
C++ Interface: get_shininess(Material self)
- /**
Returns the shininess exponent of the material.
*/
- getSpecular()
C++ Interface: get_specular(Material self)
- /**
Returns the specular color setting, if it has been set. Returns (0,0,0,0)
if the specular color has not been set.
*/
- getTwoside()
C++ Interface: get_twoside(Material self)
- /**
Returns the state of the two-sided lighting flag. See set_twoside().
*/
- get_ambient()
C++ Interface: get_ambient(Material self)
- /**
Returns the ambient color setting, if it has been set. Returns (0,0,0,0)
if the ambient color has not been set.
*/
- get_base_color()
C++ Interface: get_base_color(Material self)
- /**
Returns the base_color color setting, if it has been set. If neither the
base color nor the metallic have been set, this returns the diffuse color.
*/
- get_class_type()
C++ Interface: get_class_type()
- get_diffuse()
C++ Interface: get_diffuse(Material self)
- /**
Returns the diffuse color setting, if it has been set. Returns (1,1,1,1)
if the diffuse color has not been set.
*/
- get_emission()
C++ Interface: get_emission(Material self)
- /**
Returns the emission color setting, if it has been set. Returns (0,0,0,0)
if the emission color has not been set.
*/
- get_local()
C++ Interface: get_local(Material self)
- /**
Returns the local viewer flag. Set set_local().
*/
- get_metallic()
C++ Interface: get_metallic(Material self)
- /**
Returns the metallic setting, if it has been set. Returns 0 if it has not
been set.
*/
- get_refractive_index()
C++ Interface: get_refractive_index(Material self)
- /**
Returns the index of refraction, or 1 if none has been set for this
material.
*/
- get_roughness()
C++ Interface: get_roughness(Material self)
- /**
Returns the roughness previously specified by set_roughness. If none was
previously set, this value is computed from the shininess value.
*/
- get_shininess()
C++ Interface: get_shininess(Material self)
- /**
Returns the shininess exponent of the material.
*/
- get_specular()
C++ Interface: get_specular(Material self)
- /**
Returns the specular color setting, if it has been set. Returns (0,0,0,0)
if the specular color has not been set.
*/
- get_twoside()
C++ Interface: get_twoside(Material self)
- /**
Returns the state of the two-sided lighting flag. See set_twoside().
*/
- hasAmbient()
C++ Interface: has_ambient(Material self)
- /**
Returns true if the ambient color has been explicitly set for this
material, false otherwise.
*/
- hasBaseColor()
C++ Interface: has_base_color(Material self)
- /**
Returns true if the base color has been explicitly set for this material,
false otherwise.
*/
- hasDiffuse()
C++ Interface: has_diffuse(Material self)
- /**
Returns true if the diffuse color has been explicitly set for this
material, false otherwise.
*/
- hasEmission()
C++ Interface: has_emission(Material self)
- /**
Returns true if the emission color has been explicitly set for this
material, false otherwise.
*/
- hasMetallic()
C++ Interface: has_metallic(Material self)
- /**
Returns true if the metallic has been explicitly set for this material,
false otherwise.
*/
- hasRefractiveIndex()
C++ Interface: has_refractive_index(Material self)
- /**
Returns true if a refractive index has explicitly been specified for this
material.
*/
- hasRoughness()
C++ Interface: has_roughness(Material self)
- /**
Returns true if the roughness has been explicitly set for this material,
false otherwise.
*/
- hasSpecular()
C++ Interface: has_specular(Material self)
- /**
Returns true if the specular color has been explicitly set for this
material, false otherwise.
*/
- has_ambient()
C++ Interface: has_ambient(Material self)
- /**
Returns true if the ambient color has been explicitly set for this
material, false otherwise.
*/
- has_base_color()
C++ Interface: has_base_color(Material self)
- /**
Returns true if the base color has been explicitly set for this material,
false otherwise.
*/
- has_diffuse()
C++ Interface: has_diffuse(Material self)
- /**
Returns true if the diffuse color has been explicitly set for this
material, false otherwise.
*/
- has_emission()
C++ Interface: has_emission(Material self)
- /**
Returns true if the emission color has been explicitly set for this
material, false otherwise.
*/
- has_metallic()
C++ Interface: has_metallic(Material self)
- /**
Returns true if the metallic has been explicitly set for this material,
false otherwise.
*/
- has_refractive_index()
C++ Interface: has_refractive_index(Material self)
- /**
Returns true if a refractive index has explicitly been specified for this
material.
*/
- has_roughness()
C++ Interface: has_roughness(Material self)
- /**
Returns true if the roughness has been explicitly set for this material,
false otherwise.
*/
- has_specular()
C++ Interface: has_specular(Material self)
- /**
Returns true if the specular color has been explicitly set for this
material, false otherwise.
*/
- isAttribLocked()
C++ Interface: is_attrib_locked(Material self)
- /**
@deprecated This no longer has any meaning in 1.10.
*/
- is_attrib_locked()
C++ Interface: is_attrib_locked(Material self)
- /**
@deprecated This no longer has any meaning in 1.10.
*/
- local
- metallic
- refractive_index
- roughness
- setAmbient()
C++ Interface: set_ambient(const Material self, const LVecBase4f color)
- /**
Specifies the ambient color setting of the material. This will be the
multiplied by any ambient lights in effect on the material to set its base
color.
This is the color of the object as it appears in the absence of direct
light.
If this is not set, the object color will be used.
*/
- setAttribLock()
C++ Interface: set_attrib_lock(const Material self)
- /**
@deprecated This no longer has any meaning in 1.10.
*/
- setBaseColor()
C++ Interface: set_base_color(const Material self, const LVecBase4f color)
- /**
Specifies the base color of the material. In conjunction with
set_metallic, this is an alternate way to specify the color of a material.
For dielectrics, this will determine the value of the diffuse color, and
for metals, this will determine the value of the specular color.
Setting this will clear an explicit specular, diffuse or ambient color
assignment.
If this is not set, the object color will be used.
*/
- setDiffuse()
C++ Interface: set_diffuse(const Material self, const LVecBase4f color)
- /**
Specifies the diffuse color setting of the material. This will be
multiplied by any lights in effect on the material to get the color in the
parts of the object illuminated by the lights.
This is the primary color of an object; the color of the object as it
appears in direct light, in the absence of highlights.
If this is not set, the object color will be used.
*/
- setEmission()
C++ Interface: set_emission(const Material self, const LVecBase4f color)
- /**
Specifies the emission color setting of the material. This is the color of
the object as it appears in the absence of any light whatsover, including
ambient light. It is as if the object is glowing by this color (although
of course it will not illuminate neighboring objects).
If this is not set, the object will not glow by its own light and will only
appear visible in the presence of one or more lights.
*/
- setLocal()
C++ Interface: set_local(const Material self, bool local)
- /**
Sets the local viewer flag. Set this true to enable camera-relative
specular highlights, or false to use orthogonal specular highlights. The
default value is true. Applications that use orthogonal projection should
specify false.
*/
- setMetallic()
C++ Interface: set_metallic(const Material self, float metallic)
- /**
Sets the metallic setting of the material, which is is used for physically-
based rendering models. This is usually 0 for dielectric materials and 1
for metals. It really does not make sense to set this to a value other
than 0 or 1, but it is nonetheless a float for compatibility with tools
that allow setting this to values other than 0 or 1.
*/
- setRefractiveIndex()
C++ Interface: set_refractive_index(const Material self, float refractive_index)
- /**
Sets the index of refraction of the material, which is used to determine
the specular color in absence of an explicit specular color assignment.
This is usually 1.5 for dielectric materials. It is not very useful for
metals, since they cannot be described as easily with a single number.
Should be 1 or higher. The default is 1.
*/
- setRoughness()
C++ Interface: set_roughness(const Material self, float roughness)
- /**
Sets the roughness exponent of the material, where 0 is completely shiny
(infinite shininess), and 1 is a completely dull object (0 shininess).
This is a different, more perceptually intuitive way of controlling the
size of the specular spot, and more commonly used in physically-based
rendering.
Setting a roughness recalculates the shininess value.
*/
- setShininess()
C++ Interface: set_shininess(const Material self, float shininess)
- /**
Sets the shininess exponent of the material. This controls the size of the
specular highlight spot. In general, larger number produce a smaller
specular highlight, which makes the object appear shinier. Smaller numbers
produce a larger highlight, which makes the object appear less shiny.
This is usually in the range 0..128.
Setting a shininess value removes any previous roughness assignment.
*/
- setSpecular()
C++ Interface: set_specular(const Material self, const LVecBase4f color)
- /**
Specifies the specular color setting of the material. This will be
multiplied by any lights in effect on the material to compute the color of
specular highlights on the object.
This is the highlight color of an object: the color of small highlight
reflections.
If this is not set, the specular color is taken from the index of
refraction, which is 1 by default (meaning no specular reflections are
generated).
*/
- setTwoside()
C++ Interface: set_twoside(const Material self, bool twoside)
- /**
Set this true to enable two-sided lighting. When two-sided lighting is on,
both sides of a polygon will be lit by this material. The default is for
two-sided lighting to be off, in which case only the front surface is lit.
*/
- set_ambient()
C++ Interface: set_ambient(const Material self, const LVecBase4f color)
- /**
Specifies the ambient color setting of the material. This will be the
multiplied by any ambient lights in effect on the material to set its base
color.
This is the color of the object as it appears in the absence of direct
light.
If this is not set, the object color will be used.
*/
- set_attrib_lock()
C++ Interface: set_attrib_lock(const Material self)
- /**
@deprecated This no longer has any meaning in 1.10.
*/
- set_base_color()
C++ Interface: set_base_color(const Material self, const LVecBase4f color)
- /**
Specifies the base color of the material. In conjunction with
set_metallic, this is an alternate way to specify the color of a material.
For dielectrics, this will determine the value of the diffuse color, and
for metals, this will determine the value of the specular color.
Setting this will clear an explicit specular, diffuse or ambient color
assignment.
If this is not set, the object color will be used.
*/
- set_diffuse()
C++ Interface: set_diffuse(const Material self, const LVecBase4f color)
- /**
Specifies the diffuse color setting of the material. This will be
multiplied by any lights in effect on the material to get the color in the
parts of the object illuminated by the lights.
This is the primary color of an object; the color of the object as it
appears in direct light, in the absence of highlights.
If this is not set, the object color will be used.
*/
- set_emission()
C++ Interface: set_emission(const Material self, const LVecBase4f color)
- /**
Specifies the emission color setting of the material. This is the color of
the object as it appears in the absence of any light whatsover, including
ambient light. It is as if the object is glowing by this color (although
of course it will not illuminate neighboring objects).
If this is not set, the object will not glow by its own light and will only
appear visible in the presence of one or more lights.
*/
- set_local()
C++ Interface: set_local(const Material self, bool local)
- /**
Sets the local viewer flag. Set this true to enable camera-relative
specular highlights, or false to use orthogonal specular highlights. The
default value is true. Applications that use orthogonal projection should
specify false.
*/
- set_metallic()
C++ Interface: set_metallic(const Material self, float metallic)
- /**
Sets the metallic setting of the material, which is is used for physically-
based rendering models. This is usually 0 for dielectric materials and 1
for metals. It really does not make sense to set this to a value other
than 0 or 1, but it is nonetheless a float for compatibility with tools
that allow setting this to values other than 0 or 1.
*/
- set_refractive_index()
C++ Interface: set_refractive_index(const Material self, float refractive_index)
- /**
Sets the index of refraction of the material, which is used to determine
the specular color in absence of an explicit specular color assignment.
This is usually 1.5 for dielectric materials. It is not very useful for
metals, since they cannot be described as easily with a single number.
Should be 1 or higher. The default is 1.
*/
- set_roughness()
C++ Interface: set_roughness(const Material self, float roughness)
- /**
Sets the roughness exponent of the material, where 0 is completely shiny
(infinite shininess), and 1 is a completely dull object (0 shininess).
This is a different, more perceptually intuitive way of controlling the
size of the specular spot, and more commonly used in physically-based
rendering.
Setting a roughness recalculates the shininess value.
*/
- set_shininess()
C++ Interface: set_shininess(const Material self, float shininess)
- /**
Sets the shininess exponent of the material. This controls the size of the
specular highlight spot. In general, larger number produce a smaller
specular highlight, which makes the object appear shinier. Smaller numbers
produce a larger highlight, which makes the object appear less shiny.
This is usually in the range 0..128.
Setting a shininess value removes any previous roughness assignment.
*/
- set_specular()
C++ Interface: set_specular(const Material self, const LVecBase4f color)
- /**
Specifies the specular color setting of the material. This will be
multiplied by any lights in effect on the material to compute the color of
specular highlights on the object.
This is the highlight color of an object: the color of small highlight
reflections.
If this is not set, the specular color is taken from the index of
refraction, which is 1 by default (meaning no specular reflections are
generated).
*/
- set_twoside()
C++ Interface: set_twoside(const Material self, bool twoside)
- /**
Set this true to enable two-sided lighting. When two-sided lighting is on,
both sides of a polygon will be lit by this material. The default is for
two-sided lighting to be off, in which case only the front surface is lit.
*/
- shininess
- specular
- twoside
- upcastToNamable()
C++ Interface: upcast_to_Namable(const Material self)
upcast from Material to Namable
- upcastToTypedWritableReferenceCount()
C++ Interface: upcast_to_TypedWritableReferenceCount(const Material self)
upcast from Material to TypedWritableReferenceCount
- upcast_to_Namable()
C++ Interface: upcast_to_Namable(const Material self)
upcast from Material to Namable
- upcast_to_TypedWritableReferenceCount()
C++ Interface: upcast_to_TypedWritableReferenceCount(const Material self)
upcast from Material to TypedWritableReferenceCount