views:

288

answers:

2

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 Shapes 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

+1  A: 

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.

whatnick
Thanks for the advice. I'm still fairly new to graphics so will probably steer clear of 3D graphics / Open GL for the moment. Maybe I can cheat by defining a Stroke that applies shading to the edges of the blob. Not sure if I could change the shading colour depending on the current direction of the path being stroked though.
Adamski
+1  A: 

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.

trashgod
Thanks. Looks like Java 6's RadialGradientPaint only shades in a circular fashion but perhaps I can implement my own using this code as a starting point.
Adamski
I was thinking you might shade the largest inscribed circle of each ellipse, using alpha to "feather" the edges.
trashgod