简体   繁体   中英

Java 2D Shading / Filling

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

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 .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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