RFR: 8217472: Add attenuation for PointLight [v5]

Nir Lisker nlisker at openjdk.java.net
Tue Jul 28 12:46:46 UTC 2020


On Thu, 23 Jul 2020 12:06:17 GMT, Ambarish Rapte <arapte at openjdk.org> wrote:

>> Nir Lisker has updated the pull request with a new target base due to a merge or a rebase. The pull request now
>> contains 11 commits:
>>  - Merge branch 'master' into 8217472_Add_attenuation_for_PointLight
>>  - Attenuation and range changed internally to floats from doubles
>>  - Fixed shader compilation errors for 2 and 3 lights in es2
>>  - Addressing review comments
>>  - Fixed whitespaces
>>  - Correction for indexes
>>  - Docs and year update
>>  - Merge remote-tracking branch 'nlisker/8217472_Add_attenuation_for_PointLight' into
>>    8217472_Add_attenuation_for_PointLight
>>  - GL pipeline
>>  - Separate range from attenuation
>>  - ... and 1 more: https://git.openjdk.java.net/jfx/compare/4ec163df...2e1223ed
>
> modules/javafx.graphics/src/main/resources/com/sun/prism/es2/glsl/main3Lights.frag line 92:
> 
>> 91:         d += clamp(dot(n,l), 0.0, 1.0) * (lights[0].color).rgb * att;
>> 92:         s += pow(clamp(dot(-refl, l), 0.0, 1.0), power) * lights[0].color.rgb * att;
>> 93:     }
> 
> These three lines can be changed as:
> float attenuatedColor = (lights[0].color).rgb / (lights[0].attn.x + lights[0].attn.y * dist + lights[0].attn.z * dist *
> dist); d += clamp(dot(n,l), 0.0, 1.0) * attenuatedColor;
> s += pow(clamp(dot(-refl, l), 0.0, 1.0), power) * attenuatedColor;
> Similar change in the 1 light and 2 lights shader.

Interesting, I'd think the compiler would have optimized it.

-------------

PR: https://git.openjdk.java.net/jfx/pull/43


More information about the openjfx-dev mailing list