[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    RFR: 8234921: Add DirectionalLight to the selection of 3D light types
From:       Nir Lisker <nlisker () openjdk ! java ! net>
Date:       2021-06-28 13:14:27
Message-ID: ZQ_qma8KnTtjGmdw880ve5oK4QW9nW731pcTT37fdJE=.9e807f1a-cfff-40b1-8401-e7ed7d07e7af () github ! com
[Download RAW message or body]

Adds a directional light as a subclass of `LightBase`. I think that this is the \
correct hierarchy for it.

I tried to simulate a directional light by putting a point light far away, but I got \
artifacts when the distance was large. Instead, I added an on/off attenuation flag as \
the 4th component of the attenuation 4-vector. When it is 0, a simpler computation is \
used in the pixel/fragment shader that calculates the illumination based on the light \
direction only (making the position variables meaningless). When it is 1, the \
point/spot light computation is used. It's possible that the vertex shader can also \
be simplified in this case since it does not need to transform the position vectors, \
but I left this optimization avenue for another time.

I noticed a drop of ~1 fps in the stress test of 5000 meshes.

I added a system test that verifies the correct color result from a few directions. I \
also updated the lighting sample application to include 3 directional lights and \
tested them on all the models visually. The lights seem to behave the way I would \
expect.

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

Commit messages:
 - Small corrections to class members docs
 - Removed whitespace
 - Reordered setLight arguments in NGShape3D
 - Updated class doc
 - Initial commit of the opengl pipeline
 - Updated tests
 - Initial java and d3d implementation

Changes: https://git.openjdk.java.net/jfx/pull/548/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jfx&pr=548&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8234921
  Stats: 533 lines in 29 files changed: 472 ins; 11 del; 50 mod
  Patch: https://git.openjdk.java.net/jfx/pull/548.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/548/head:pull/548

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic