JDK-8310658 : Add support for specular map in metal
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: internal
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • CPU: generic
  • Submitted: 2023-06-22
  • Updated: 2023-07-11
  • Resolved: 2023-06-28
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.

To download the current JDK release, click here.
Other
internalFixed
Related Reports
Blocks :  
Relates :  
Description
Need to add support for specular map in metal.
After JDK-8310109 we will have basic support for texture mapping and filtering. We have also added mipmap support for diffuse map. But specualr map doesn't need mipmap so in this change mostly we need to add a way to set multiple sampler descriptors for 3D texture mapping.
Comments
Changeset: e40f0ba5 Author: Jayathirth D V <jdv@openjdk.org> Committer: aghaisas <ajitgh@gmail.com> Date: 2023-06-28 11:19:29 +0000 URL: https://git.openjdk.org/jfx-sandbox/commit/e40f0ba5d3411b6ccb20518919a8ce82173f1587
28-06-2023

I have 16 inch Macbook Pro with M1 aarch64 SoC. Took help from Ajit to run 3D Sphere demo on OpenGL in another 16 inch x64 Macbook Pro with AMD discrete GPU and the artifact is not seen in that machine. Looks like OpenGL artifact is seen because of driver differences.
28-06-2023

Added code to pass Specular Map and Specular texture. Also added new default sampler in shader without mipmapping. To support current usage of linear filter with/without mipmap there is not need to pass separate samplers to the render encoder. We can actually create 2 samplers one with mipmap and another without mipmap in shader and use it. Its better to not handle support for more filters in this task since we are replicating the feature present in other pipelines and not adding new features like fine grained texture filter support. After adding above code, observed some differences on the edge pixels in Ensemble8->3D Sphere demo when we enable Specular Map between Metal and OpenGL. In case of OpenGL on the edge pixel where sunlight is falling there are some artifacts but in Metal i don't see the artifacts. Will attach the images for the same. We have same texture filters and wrap modes between Opengl and Metal, so we should not see differences. Ran Ensemble8->3D Sphere demo in D3D windows and i dont see these artifacts and it matches Metal output. Looks like we have some difference in light calculation between D3D and OpenGL or there is some OpenGL driver bug in macOS.
28-06-2023