RFR: 8234920: Add SpotLight to the selection of 3D light types [v9]
Nir Lisker
nlisker at openjdk.java.net
Fri Apr 9 19:55:10 UTC 2021
On Fri, 9 Apr 2021 19:01:59 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> If you want to test aiming the light with transforms instead of a direction vector, I modified the `NGSpotLight` and `AttenLightingSample` files to use the rotation transforms.
>>
>> [transforms.zip](https://github.com/openjdk/jfx/files/6212221/transforms.zip)
>
> The problem with the hole in the spotlight on Mac is fixed. The remaining problems seem to be related to the way range is treated. Maybe there is a problem with a scale somewhere? This is on a retina display with 2x scaling. Here are two sample pictures that illustrate what I mean. The first is on Windows, and the second is on Mac.
>
> 
> <img width="1212" alt="SpotLight-range-macOS" src="https://user-images.githubusercontent.com/34689748/114226651-b2a79200-9928-11eb-9231-ed9d58ef891e.png">
>
>
> Also, I still see some unrelated problems on Linux, but since it is a VirtualBox guest running on my Windows host, I'm not sure how valid a test it is. I have to set `-Dprism.forceGPU=true` to get any 3D on that machine. @arapte was going to try it on a different system (also a VM image, but different system and graphics card). I'm less worried about this one as long as physical Linux box that actually reports 3D support works correctly.
>
> So I think we're down to the range and/or scaling being wrong on Mac. Possibly in retina mode only.
>
> As for setting the spot light direction using rotation, I think there are three API choices, and I don't like the third since it is inconsistent, so really two choices.
>
> 1. No direction property in the SpotLight API. A vector of `(0,0,1)` is transformed from the local coordinate space of the light into world coordinates and used as the direction.
> 2. Add a direction property to the SpotLight API, with a default of `(0,0,1)`. That direction vector is transformed from the local coordinate space of the light into world coordinates and used as the direction.
> 3. Add a direction property to the SpotLight API, with a default of `(0,0,1)`. That vector is use as the direction without regard to any transforms.
>
> Option 2 is the most flexible. I think option 1 is fine, since we can always compatibly add a direction vector in the future (giving us option 2 later). As I mentioned, option 3 is inconsistent, so let's not do that one.
I will check the range issue on (non-VM) Linux. I don't have a Mac, so not sure what to do if Linux checks out.
> As for setting the spot light direction using rotation, I think there are three API choices, and I don't like the third since it is inconsistent, so really two choices.
The current patch uses approach 3, and I posted a couple of replacement files in the comment above that use approach 1. If you and Ambarish can compare these, we will have a better idea on what to do. I also think that either 1 or 2 are the best choices, so if you find approach 1 too confusing or 3 very convenient, I will merge them into approach 2.
-------------
PR: https://git.openjdk.java.net/jfx/pull/334
More information about the openjfx-dev
mailing list