简体   繁体   English

3d对象的阴影在javafx

[英]shadow of 3d objects in javafx

How to create shadow of 3d object in javafx? 如何在javafx中创建3d对象的阴影? I tried to create with 我试着创造

Parent root2 = FXMLLoader.load(getClass().getResource("ball.fxml"));

Shadow shadow = new Shadow();

root2.setEffect(shadow);

Here the results : 结果如下:

Without shadow 没有影子

With shadow 带着影子

Can someone help me to create shadows of 3d objects? 有人可以帮我创建3d对象的阴影吗? Thanks! 谢谢!

The Shadow effect in JavaFX is for implementing drop shadow style effects for 2D objects; JavaFX中的阴影效果用于实现2D对象的阴影效果效果; it will not create appropriate shadow effects for 3D objects and is not built for that purpose. 它不会为3D对象创建适当的阴影效果,也不会为此目的而构建。

The core JavaFX 8 3D API has no in-built methods for supporting generation of shadow effects for 3D objects. 核心JavaFX 8 3D API没有内置方法来支持为3D对象生成阴影效果。

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. 您可以阅读有关实现3D对象阴影的各种技术,并尝试基于Java 8 3D API提供的图形基元实现适当的算法。 Doing so would likely be a pretty difficult task IMO. 这样做可能是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 . 如果3D对象的阴影对您很重要,您可能希望考虑提供更高程度3D阴影支持的替代3D API

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM