Adamski
Adamski

Reputation: 54695

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.

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 http://www.freeimagehosting.net/uploads/bc8081cbf2.png

Upvotes: 4

Views: 1942

Answers (2)

trashgod
trashgod

Reputation: 205785

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.

Upvotes: 1

whatnick
whatnick

Reputation: 5470

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.

Upvotes: 1

Related Questions