Using BumpInput

An important lighting parameter is SurfaceScale, which determines how high the border should be elevated for the sake of light imitation. You saw how it affects the result in the preceding examples.

But you can choose what to elevate exactly by using the setBumpInput(Effect input) method. Technically, you can use any effect as a bump map here, but most convenient will be ImageInput. In the selected image, transparent areas will stay flat and everything else will be elevated and highlighted.

In the following example, the Packt logo was used as an ImageInput:

I've highlighted the most important parts of the code:

//chapter8/light/BumpInputDemo.java ...

Get Mastering JavaFX 10 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.