java.lang.Object
javafx.scene.paint.Material
javafx.scene.paint.PhongMaterial
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
TypePropertyDescriptionfinal ObjectProperty<Image>
The bump map of thisPhongMaterial
, which is a normal map stored as a RGBImage
.final ObjectProperty<Color>
The diffuse color of thisPhongMaterial
.final ObjectProperty<Image>
The diffuse map of thisPhongMaterial
.final ObjectProperty<Image>
The self illumination map of thisPhongMaterial
.final ObjectProperty<Color>
The specular color of thisPhongMaterial
.final ObjectProperty<Image>
The specular map of thisPhongMaterial
.final DoubleProperty
The specular power of thisPhongMaterial
. -
Constructor Summary
ConstructorDescriptionCreates a new instance ofPhongMaterial
class with a default Color.WHITEdiffuseColor
property.PhongMaterial
(Color diffuseColor) Creates a new instance ofPhongMaterial
class using the specified color for itsdiffuseColor
property.PhongMaterial
(Color diffuseColor, Image diffuseMap, Image specularMap, Image bumpMap, Image selfIlluminationMap) Creates a new instance ofPhongMaterial
class using the specified colors and images for itsdiffuseColor
properties. -
Method Summary
Modifier and TypeMethodDescriptionfinal ObjectProperty<Image>
The bump map of thisPhongMaterial
, which is a normal map stored as a RGBImage
.final ObjectProperty<Color>
The diffuse color of thisPhongMaterial
.final ObjectProperty<Image>
The diffuse map of thisPhongMaterial
.final Image
Gets the value of thebumpMap
property.final Color
Gets the value of thediffuseColor
property.final Image
Gets the value of thediffuseMap
property.final Image
Gets the value of theselfIlluminationMap
property.final Color
Gets the value of thespecularColor
property.final Image
Gets the value of thespecularMap
property.final double
Gets the value of thespecularPower
property.final ObjectProperty<Image>
The self illumination map of thisPhongMaterial
.final void
setBumpMap
(Image value) Sets the value of thebumpMap
property.final void
setDiffuseColor
(Color value) Sets the value of thediffuseColor
property.final void
setDiffuseMap
(Image value) Sets the value of thediffuseMap
property.final void
setSelfIlluminationMap
(Image value) Sets the value of theselfIlluminationMap
property.final void
setSpecularColor
(Color value) Sets the value of thespecularColor
property.final void
setSpecularMap
(Image value) Sets the value of thespecularMap
property.final void
setSpecularPower
(double value) Sets the value of thespecularPower
property.final ObjectProperty<Color>
The specular color of thisPhongMaterial
.final ObjectProperty<Image>
The specular map of thisPhongMaterial
.final DoubleProperty
The specular power of thisPhongMaterial
.
-
Property Details
-
diffuseColor
The diffuse color of thisPhongMaterial
.- Default value:
- Color.WHITE
- See Also:
-
specularColor
The specular color of thisPhongMaterial
.- Default value:
- null
- See Also:
-
specularPower
The specular power of thisPhongMaterial
.- Default value:
- 32.0
- See Also:
-
diffuseMap
The diffuse map of thisPhongMaterial
.- Default value:
- null
- See Also:
-
specularMap
The specular map of thisPhongMaterial
.- Default value:
- null
- See Also:
-
bumpMap
The bump map of thisPhongMaterial
, which is a normal map stored as a RGBImage
.- Default value:
- null
- See Also:
-
selfIlluminationMap
The self illumination map of thisPhongMaterial
.- Default value:
- null
- See Also:
-
-
Constructor Details
-
PhongMaterial
public PhongMaterial()Creates a new instance ofPhongMaterial
class with a default Color.WHITEdiffuseColor
property. -
PhongMaterial
Creates a new instance ofPhongMaterial
class using the specified color for itsdiffuseColor
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 ofPhongMaterial
class using the specified colors and images for itsdiffuseColor
properties.- Parameters:
diffuseColor
- the color of the diffuseColor propertydiffuseMap
- the image of the diffuseMap propertyspecularMap
- the image of the specularMap propertybumpMap
- the image of the bumpMap propertyselfIlluminationMap
- the image of the selfIlluminationMap property
-
-
Method Details
-
setDiffuseColor
Sets the value of thediffuseColor
property.- Property description:
- The diffuse color of this
PhongMaterial
. - Default value:
- Color.WHITE
- Parameters:
value
- the value for thediffuseColor
property- See Also:
-
getDiffuseColor
Gets the value of thediffuseColor
property.- Property description:
- The diffuse color of this
PhongMaterial
. - Default value:
- Color.WHITE
- Returns:
- the value of the
diffuseColor
property - See Also:
-
diffuseColorProperty
The diffuse color of thisPhongMaterial
.- Default value:
- Color.WHITE
- Returns:
- the
diffuseColor
property - See Also:
-
setSpecularColor
Sets the value of thespecularColor
property.- Property description:
- The specular color of this
PhongMaterial
. - Default value:
- null
- Parameters:
value
- the value for thespecularColor
property- See Also:
-
getSpecularColor
Gets the value of thespecularColor
property.- Property description:
- The specular color of this
PhongMaterial
. - Default value:
- null
- Returns:
- the value of the
specularColor
property - See Also:
-
specularColorProperty
The specular color of thisPhongMaterial
.- Default value:
- null
- Returns:
- the
specularColor
property - See Also:
-
setSpecularPower
public final void setSpecularPower(double value) Sets the value of thespecularPower
property.- Property description:
- The specular power of this
PhongMaterial
. - Default value:
- 32.0
- Parameters:
value
- the value for thespecularPower
property- See Also:
-
getSpecularPower
public final double getSpecularPower()Gets the value of thespecularPower
property.- Property description:
- The specular power of this
PhongMaterial
. - Default value:
- 32.0
- Returns:
- the value of the
specularPower
property - See Also:
-
specularPowerProperty
The specular power of thisPhongMaterial
.- Default value:
- 32.0
- Returns:
- the
specularPower
property - See Also:
-
setDiffuseMap
Sets the value of thediffuseMap
property.- Property description:
- The diffuse map of this
PhongMaterial
. - Default value:
- null
- Parameters:
value
- the value for thediffuseMap
property- See Also:
-
getDiffuseMap
Gets the value of thediffuseMap
property.- Property description:
- The diffuse map of this
PhongMaterial
. - Default value:
- null
- Returns:
- the value of the
diffuseMap
property - See Also:
-
diffuseMapProperty
The diffuse map of thisPhongMaterial
.- Default value:
- null
- Returns:
- the
diffuseMap
property - See Also:
-
setSpecularMap
Sets the value of thespecularMap
property.- Property description:
- The specular map of this
PhongMaterial
. - Default value:
- null
- Parameters:
value
- the value for thespecularMap
property- See Also:
-
getSpecularMap
Gets the value of thespecularMap
property.- Property description:
- The specular map of this
PhongMaterial
. - Default value:
- null
- Returns:
- the value of the
specularMap
property - See Also:
-
specularMapProperty
The specular map of thisPhongMaterial
.- Default value:
- null
- Returns:
- the
specularMap
property - See Also:
-
setBumpMap
Sets the value of thebumpMap
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 thebumpMap
property- See Also:
-
getBumpMap
Gets the value of thebumpMap
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
bumpMap
property - See Also:
-
bumpMapProperty
The bump map of thisPhongMaterial
, which is a normal map stored as a RGBImage
.- Default value:
- null
- Returns:
- the
bumpMap
property - See Also:
-
setSelfIlluminationMap
Sets the value of theselfIlluminationMap
property.- Property description:
- The self illumination map of this
PhongMaterial
. - Default value:
- null
- Parameters:
value
- the value for theselfIlluminationMap
property- See Also:
-
getSelfIlluminationMap
Gets the value of theselfIlluminationMap
property.- Property description:
- The self illumination map of this
PhongMaterial
. - Default value:
- null
- Returns:
- the value of the
selfIlluminationMap
property - See Also:
-
selfIlluminationMapProperty
The self illumination map of thisPhongMaterial
.- Default value:
- null
- Returns:
- the
selfIlluminationMap
property - See Also:
-