Java 2D 着色/填充
我已经从贝塞尔曲线(下面的屏幕截图)创建了一个“斑点”,现在想以伪 3D 的方式对其进行着色,所有“左”边缘上的阴影较暗,所有“右”边缘上的阴影较亮,也许表面上还有纯白色的“光点”。例如:我对如何实现此视频中使用的阴影感兴趣。
- 谁能推荐一个好方法来实现这一目标?我猜测标准 Graphics2D.fill 和 setPaint 方法可能不够复杂。
- 另外,有人可以推荐一些好的资源(最好是免费的/在线的)来了解更多这方面的知识吗?
编辑
一些附加信息:为了实现下面的平面填充效果,我创建了一个Area
对象并添加了单独的Ellipse2D
Shape
使用add(new Area(ellipse))
添加到它,然后最后添加中心多边形区域以避免在中间留下空白。
I have created a "blob" from Bezier curves (screenshot below) and would now like to shade it in such a way that it appears pseudo-3D, with darker shading on all "left" edges and lighter on all "right" edges, and perhaps pure white "light spots" on the surface itself. For example: I'd be interested in how to achieve the shading used in this video.
- Can anyone recommend a good way to achieve this? I am guessing that standard Graphics2D.fill and setPaint methods may not be sophisticated enough.
- Also, can anyone recommend some good resources (preferrably free / online) for learning more on this?
EDIT
Some additional information: To achieve the flat fill effect below I'm creating an Area
object and am adding the individual Ellipse2D
Shape
s to it using add(new Area(ellipse))
and then finally adding the central polygon area to avoid leaving a white space in the middle.
alt text http://www.freeimagehosting.net/uploads/bc8081cbf2.png
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
iPhone 应用程序可以访问 OpenGL -ES 允许在着色和渲染方面有很大的自由度,基本上是带有发光照明的彩色等值面。 Java2d 肯定不够复杂,除非你愿意为它编写一个完整的软件 3d 库。
混合 2d 和 3d 也是可能的。
The IPhone apps have access to OpenGL-ES which allows significant latitude in shading and rendering what is basically a coloured iso-surface with emissive lighting. Java2d will definitely not be sophisticated enough unless you are willing to write a whole software 3d library for it.
Mixing 2d and 3d is also possible.
我在此 运动模型以获得伪 3D 效果。我相信有更通用的实现在Java 6中。
I used a custom RadialGradientPaint in this kineic model to get a pseudo-3D effect. I believe a more general implementation is available in Java 6.