JDK-8102454 : Specify the lighting equation for 3D PhongMaterial rendering
Type:Enhancement
Component:javafx
Sub-Component:graphics
Affected Version:8
Priority:P3
Status:Resolved
Resolution:Fixed
Submitted:2013-04-25
Updated:2015-06-16
Resolved:2013-12-11
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
Please do not reopen this JIRA as the light specification is completed. File new JIRA if there is area you would like us to improve.
11-12-2013
The javadoc was pushed today as part of fix to RT-26385. Here is the javadoc as a record:
The 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.
11-12-2013
If you look at 3D Sphere example in Ensemble8, there is Self Illumination map that shows lights of cities in the dark. However, when it comes to the day part of the planet, those lights should not be visible. What do you think?
See pictures in RT-34820
11-12-2013
Also I got a feeling that last operation should be not + but rather max, as following:
shaded color = max(lightColor * ((diffuseMap * diffuseColor) + (specularColor * specularMap * ( R . V ) ^ specularPower)), selfIlluminationMap)
11-12-2013
Javadoc still doesn't have the equation specified
11-12-2013
Will add this specification into the javadoc for PhongMaterial.
22-10-2013
The lighting equation for PhongMaterial is defined as the following:
shaded color = (lightColor * ((diffuseMap * diffuseColor) + (specularColor * specularMap * ( R . V ) ^ specularPower)) + selfIlluminationMap
where lightColor is the sum of all scoped light sources, R is the normalized reflection vector and V is the normalized viewer vector.