How to create shadow of 3d object in javafx? I tried to create with
Parent root2 = FXMLLoader.load(getClass().getResource("ball.fxml"));
Shadow shadow = new Shadow();
root2.setEffect(shadow);
Here the results :
Can someone help me to create shadows of 3d objects? Thanks!
The Shadow effect in JavaFX is for implementing drop shadow style effects for 2D objects; it will not create appropriate shadow effects for 3D objects and is not built for that purpose.
The core JavaFX 8 3D API has no in-built methods for supporting generation of shadow effects for 3D objects.
You could read up on various techniques for implementing shadows for 3D objects and attempt implementing an appropriate algorithm based on the graphics primitives that are supplied with the Java 8 3D API. Doing so would likely be a pretty difficult task IMO.
If shadows for 3D objects are important for you, you may wish to consider an alternative 3D API that provides a greater degree of 3D shadow support.