Class PhongMaterial
java.lang.Object
javafx.scene.paint.Material
javafx.scene.paint.PhongMaterial
public class PhongMaterial extends Material
The
and
PhongMaterial class provides definitions of properties that represent a Phong shaded material. It describes the interaction of light with the surface of the Mesh it is applied to. The PhongMaterial reflects light in terms of a diffuse and specular component together with an ambient and a self illumination term. The color of a point on a geometric surface is mathematical function of these four components. The color is computed by the following equation:
for each ambient light source i {
ambient += lightColor[i]
}
for each point light source i {
diffuse += (L[i] . N) * lightColor[i]
specular += ((R[i] . V) ^ (specularPower * intensity(specularMap))) * lightColor[i]
}
color = (ambient + diffuse) * diffuseColor * diffuseMap
+ specular * specularColor * specularMap
+ selfIlluminationMap
where lightColor[i] is the color of light source i,L[i] is the vector from the surface to light source i,N is the normal vector (taking into the account the bumpMap if present),R[i] is the normalized reflection vector for L[i] about the surface normal,and
V is the normalized view vector.- Since:
- JavaFX 8.0
- See Also:
Property Summary
| Type | Property | Description |
|---|---|---|
final ObjectProperty<Image> |
bumpMap |
The bump map of this PhongMaterial, which is a normal map stored as a RGB Image. |
final ObjectProperty<Color> |
diffuseColor |
The diffuse color of this PhongMaterial. |
final ObjectProperty<Image> |
diffuseMap |
The diffuse map of this PhongMaterial. |
final ObjectProperty<Image> |
selfIlluminationMap |
The self illumination map of this PhongMaterial. |
final ObjectProperty<Color> |
specularColor |
The specular color of this PhongMaterial. |
final ObjectProperty<Image> |
specularMap |
The specular map of this PhongMaterial. |
final DoubleProperty |
specularPower |
The specular power of this PhongMaterial. |
Constructor Summary
| Constructor | Description |
|---|---|
PhongMaterial() |
Creates a new instance of PhongMaterial class with a default Color.WHITE diffuseColor property. |
PhongMaterial |
Creates a new instance of PhongMaterial class using the specified color for its diffuseColor property. |
PhongMaterial |
Creates a new instance of PhongMaterial class using the specified colors and images for its diffuseColor properties. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
final ObjectProperty<Image> |
bumpMapProperty() |
The bump map of this PhongMaterial, which is a normal map stored as a RGB Image. |
final ObjectProperty<Color> |
diffuseColorProperty() |
The diffuse color of this PhongMaterial. |
final ObjectProperty<Image> |
diffuseMapProperty() |
The diffuse map of this PhongMaterial. |
final Image |
getBumpMap() |
Gets the value of the bumpMap property. |
final Color |
getDiffuseColor() |
Gets the value of the diffuseColor property. |
final Image |
getDiffuseMap() |
Gets the value of the diffuseMap property. |
final Image |
getSelfIlluminationMap() |
Gets the value of the selfIlluminationMap property. |
final Color |
getSpecularColor() |
Gets the value of the specularColor property. |
final Image |
getSpecularMap() |
Gets the value of the specularMap property. |
final double |
getSpecularPower() |
Gets the value of the specularPower property. |
final ObjectProperty<Image> |
selfIlluminationMapProperty() |
The self illumination map of this PhongMaterial. |
final void |
setBumpMap |
Sets the value of the bumpMap property. |
final void |
setDiffuseColor |
Sets the value of the diffuseColor property. |
final void |
setDiffuseMap |
Sets the value of the diffuseMap property. |
final void |
setSelfIlluminationMap |
Sets the value of the selfIlluminationMap property. |
final void |
setSpecularColor |
Sets the value of the specularColor property. |
final void |
setSpecularMap |
Sets the value of the specularMap property. |
final void |
setSpecularPower |
Sets the value of the specularPower property. |
final ObjectProperty<Color> |
specularColorProperty() |
The specular color of this PhongMaterial. |
final ObjectProperty<Image> |
specularMapProperty() |
The specular map of this PhongMaterial. |
final DoubleProperty |
specularPowerProperty() |
The specular power of this PhongMaterial. |
Property Details
diffuseColor
public final ObjectProperty<Color> diffuseColorProperty
The diffuse color of this
PhongMaterial.- Default value:
- Color.WHITE
- See Also:
specularColor
public final ObjectProperty<Color> specularColorProperty
The specular color of this
PhongMaterial.- Default value:
- null
- See Also:
specularPower
public final DoubleProperty specularPowerProperty
The specular power of this
PhongMaterial.- Default value:
- 32.0
- See Also:
diffuseMap
public final ObjectProperty<Image> diffuseMapProperty
The diffuse map of this
PhongMaterial.- Default value:
- null
- See Also:
specularMap
public final ObjectProperty<Image> specularMapProperty
The specular map of this
PhongMaterial.- Default value:
- null
- See Also:
bumpMap
public final ObjectProperty<Image> bumpMapProperty
The bump map of this
PhongMaterial, which is a normal map stored as a RGB Image.- Default value:
- null
- See Also:
selfIlluminationMap
public final ObjectProperty<Image> selfIlluminationMapProperty
The self illumination map of this
PhongMaterial.- Default value:
- null
- See Also:
Constructor Details
PhongMaterial
public PhongMaterial()
Creates a new instance of
PhongMaterial class with a default Color.WHITE diffuseColor property.PhongMaterial
public PhongMaterial(Color diffuseColor)
Creates a new instance of
PhongMaterial class using the specified color for its diffuseColor property.- Parameters:
-
diffuseColor- the color of the diffuseColor property
PhongMaterial
public PhongMaterial(Color diffuseColor, Image diffuseMap, Image specularMap, Image bumpMap, Image selfIlluminationMap)
Creates a new instance of
PhongMaterial class using the specified colors and images for its diffuseColor properties.- Parameters:
-
diffuseColor- the color of the diffuseColor property -
diffuseMap- the image of the diffuseMap property -
specularMap- the image of the specularMap property -
bumpMap- the image of the bumpMap property -
selfIlluminationMap- the image of the selfIlluminationMap property
Method Details
setDiffuseColor
public final void setDiffuseColor(Color value)
Sets the value of the
diffuseColor property.- Property description:
- The diffuse color of this
PhongMaterial. - Default value:
- Color.WHITE
- Parameters:
-
value- the value for thediffuseColorproperty - See Also:
getDiffuseColor
public final Color getDiffuseColor()
Gets the value of the
diffuseColor property.- Property description:
- The diffuse color of this
PhongMaterial. - Default value:
- Color.WHITE
- Returns:
- the value of the
diffuseColorproperty - See Also:
diffuseColorProperty
public final ObjectProperty<Color> diffuseColorProperty()
The diffuse color of this
PhongMaterial.- Default value:
- Color.WHITE
- Returns:
- the
diffuseColorproperty - See Also:
setSpecularColor
public final void setSpecularColor(Color value)
Sets the value of the
specularColor property.- Property description:
- The specular color of this
PhongMaterial. - Default value:
- null
- Parameters:
-
value- the value for thespecularColorproperty - See Also:
getSpecularColor
public final Color getSpecularColor()
Gets the value of the
specularColor property.- Property description:
- The specular color of this
PhongMaterial. - Default value:
- null
- Returns:
- the value of the
specularColorproperty - See Also:
specularColorProperty
public final ObjectProperty<Color> specularColorProperty()
The specular color of this
PhongMaterial.- Default value:
- null
- Returns:
- the
specularColorproperty - See Also:
setSpecularPower
public final void setSpecularPower(double value)
Sets the value of the
specularPower property.- Property description:
- The specular power of this
PhongMaterial. - Default value:
- 32.0
- Parameters:
-
value- the value for thespecularPowerproperty - See Also:
getSpecularPower
public final double getSpecularPower()
Gets the value of the
specularPower property.- Property description:
- The specular power of this
PhongMaterial. - Default value:
- 32.0
- Returns:
- the value of the
specularPowerproperty - See Also:
specularPowerProperty
public final DoubleProperty specularPowerProperty()
The specular power of this
PhongMaterial.- Default value:
- 32.0
- Returns:
- the
specularPowerproperty - See Also:
setDiffuseMap
public final void setDiffuseMap(Image value)
Sets the value of the
diffuseMap property.- Property description:
- The diffuse map of this
PhongMaterial. - Default value:
- null
- Parameters:
-
value- the value for thediffuseMapproperty - See Also:
getDiffuseMap
public final Image getDiffuseMap()
Gets the value of the
diffuseMap property.- Property description:
- The diffuse map of this
PhongMaterial. - Default value:
- null
- Returns:
- the value of the
diffuseMapproperty - See Also:
diffuseMapProperty
public final ObjectProperty<Image> diffuseMapProperty()
The diffuse map of this
PhongMaterial.- Default value:
- null
- Returns:
- the
diffuseMapproperty - See Also:
setSpecularMap
public final void setSpecularMap(Image value)
Sets the value of the
specularMap property.- Property description:
- The specular map of this
PhongMaterial. - Default value:
- null
- Parameters:
-
value- the value for thespecularMapproperty - See Also:
getSpecularMap
public final Image getSpecularMap()
Gets the value of the
specularMap property.- Property description:
- The specular map of this
PhongMaterial. - Default value:
- null
- Returns:
- the value of the
specularMapproperty - See Also:
specularMapProperty
public final ObjectProperty<Image> specularMapProperty()
The specular map of this
PhongMaterial.- Default value:
- null
- Returns:
- the
specularMapproperty - See Also:
setBumpMap
public final void setBumpMap(Image value)
Sets the value of the
bumpMap property.- Property description:
- The bump map of this
PhongMaterial, which is a normal map stored as a RGBImage. - Default value:
- null
- Parameters:
-
value- the value for thebumpMapproperty - See Also:
getBumpMap
public final Image getBumpMap()
Gets the value of the
bumpMap property.- Property description:
- The bump map of this
PhongMaterial, which is a normal map stored as a RGBImage. - Default value:
- null
- Returns:
- the value of the
bumpMapproperty - See Also:
bumpMapProperty
public final ObjectProperty<Image> bumpMapProperty()
The bump map of this
PhongMaterial, which is a normal map stored as a RGB Image.- Default value:
- null
- Returns:
- the
bumpMapproperty - See Also:
setSelfIlluminationMap
public final void setSelfIlluminationMap(Image value)
Sets the value of the
selfIlluminationMap property.- Property description:
- The self illumination map of this
PhongMaterial. - Default value:
- null
- Parameters:
-
value- the value for theselfIlluminationMapproperty - See Also:
getSelfIlluminationMap
public final Image getSelfIlluminationMap()
Gets the value of the
selfIlluminationMap property.- Property description:
- The self illumination map of this
PhongMaterial. - Default value:
- null
- Returns:
- the value of the
selfIlluminationMapproperty - See Also:
selfIlluminationMapProperty
public final ObjectProperty<Image> selfIlluminationMapProperty()
The self illumination map of this
PhongMaterial.- Default value:
- null
- Returns:
- the
selfIlluminationMapproperty - See Also:
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.