Class: QgsPhongTexturedMaterialSettings

A Phong shading model with diffuse texture map.

Warning

This is not considered stable API, and may change in future QGIS releases. It is exposed to the Python bindings as a tech preview only.

Added in version 3.16.

List of all members, including inherited members

Class Hierarchy

Inheritance diagram of qgis._3d.QgsPhongTexturedMaterialSettings

Base classes

QgsAbstractMaterialSettings

Abstract base class for material settings.

Abstract Methods

averageColor

Returns an approximate color representing the blended material color.

setColorsFromBase

Decompose an average color into Phong material components, and sets the material's colors accordingly.

Methods

ambient

Returns ambient color component

diffuseTexturePath

Returns the diffuse texture path.

opacity

Returns the opacity of the surface

setAmbient

Sets ambient color component

setDiffuseTexturePath

Sets the path of the diffuse texture.

setOpacity

Sets opacity of the surface.

setShininess

Sets shininess of the surface

setSpecular

Sets specular color component

setTextureRotation

Sets the texture rotation in degrees

setTextureScale

Sets the texture scale The texture scale changes the size of the displayed texture in the 3D scene If the texture scale is less than 1 the texture will be stretched

shininess

Returns shininess of the surface

specular

Returns specular color component

textureRotation

Returns the texture rotation, in degrees.

textureScale

Returns the texture scale The texture scale changes the size of the displayed texture in the 3D scene If the texture scale is less than 1 the texture will be stretched

Static Methods

create

Returns a new instance of QgsPhongTexturedMaterialSettings.

supportsTechnique

Returns True if the specified technique is supported by the Phong material.

class qgis._3d.QgsPhongTexturedMaterialSettings

Bases: QgsAbstractMaterialSettings

ambient(self) QColor

Returns ambient color component

Return type:

QColor

abstract averageColor(self) QColor

Returns an approximate color representing the blended material color.

This function calculates a weighted average of the ambient, diffuse, and specular color components to produce a single representative color.

See also

ambient()

See also

specular()

Added in version 4.2.

Return type:

QColor

static create() QgsAbstractMaterialSettings | None

Returns a new instance of QgsPhongTexturedMaterialSettings.

Return type:

Optional[QgsAbstractMaterialSettings]

diffuseTexturePath(self) str

Returns the diffuse texture path.

Return type:

str

opacity(self) float

Returns the opacity of the surface

Added in version 3.28.

Return type:

float

setAmbient(self, ambient: QColor | Qt.GlobalColor | int)

Sets ambient color component

Parameters:

ambient (Union[QColor, Qt.GlobalColor, int])

abstract setColorsFromBase(self, baseColor: QColor | Qt.GlobalColor | int, metallic: float)

Decompose an average color into Phong material components, and sets the material’s colors accordingly.

Sets ambient and specular colors from the input color. This also sets the shininess parameter based on the metallic value.

Parameters:
  • baseColor (Union[QColor, Qt.GlobalColor, int]) – The color to decompose

  • metallic (float) – Controls how “metal-like” a material appears. Value between 0 and 1

See also

setAmbient()

See also

setSpecular()

See also

setShininess()

Added in version 4.2.

setColorsFromBase(self, baseColor: Union[QColor, Qt.GlobalColor, int]) Decomposes a base color into Phong material components.

Sets ambient and specular colors from the input color. This is equivalent to calling setColorsFromBase with the metallic parameter equal to 0: setColorsFromBase(baseColor, 0).

Parameters:

baseColor – The color to decompose

See also

setAmbient()

See also

setSpecular()

Added in version 4.2.

setDiffuseTexturePath(self, path: str | None)

Sets the path of the diffuse texture.

Parameters:

path (Optional[str])

setOpacity(self, opacity: float)

Sets opacity of the surface.

Added in version 3.28.

Parameters:

opacity (float)

setShininess(self, shininess: float)

Sets shininess of the surface

Parameters:

shininess (float)

setSpecular(self, specular: QColor | Qt.GlobalColor | int)

Sets specular color component

Parameters:

specular (Union[QColor, Qt.GlobalColor, int])

setTextureRotation(self, rotation: float)

Sets the texture rotation in degrees

Parameters:

rotation (float)

setTextureScale(self, scale: float)

Sets the texture scale The texture scale changes the size of the displayed texture in the 3D scene If the texture scale is less than 1 the texture will be stretched

Parameters:

scale (float)

shininess(self) float

Returns shininess of the surface

Return type:

float

specular(self) QColor

Returns specular color component

Return type:

QColor

static supportsTechnique(technique: Qgis.MaterialRenderingTechnique) bool

Returns True if the specified technique is supported by the Phong material.

Parameters:

technique (Qgis.MaterialRenderingTechnique)

Return type:

bool

textureRotation(self) float

Returns the texture rotation, in degrees.

Return type:

float

textureScale(self) float

Returns the texture scale The texture scale changes the size of the displayed texture in the 3D scene If the texture scale is less than 1 the texture will be stretched

Return type:

float