Selasa, 21 April 2009

Vector Transparency

vector transparency via EPS

Recently I've been thinking a lot about the question of vector-based transparency inspired by Macromedia's FreeHand 8. The much-trumpeted new feature that this latest release offers is the ability to make objects partially transparent. The implications of this are enormous and the reason is all around you - the real world is not made up purely of opaque objects. To begin with glass and see-through plastic are everywhere, but more importantly all objects cast shadows and shadows are partially transparent. In other words, to create a truly realistic image you need to be able to create transparencies. That's why, as Macromedia puts it, transparency has "commonly been referred to as the holy grail of professional vector-based design tools."

  • The Difference between Bitmap and Vector

If this is the case, the obvious question is why hasn't FreeHand offered transparency before? After all, in pixel-based bitmap editors transparency is an everyday staple. To see transparency in action in Photoshop, for example, you simply have to create a new layer and then set the level of its opacity. If your background colour is red (100% yellow, 100% magenta) and you put a 100% cyan square over it on its own layer and then set its opacity to 20%, the resulting visible colour will read off as 20% cyan, 80% yellow, 80% magenta - ie 20% of the top layer's pixel values added to 80% of the bottom's. The final visible colour is determined by looking at all relevant image layers and calculating the final value at every single pixel position.

You might think that for a vector program to offer similar transparency control would, if anything, be easier as the consistent colour values for each uniformly filled vector shape would seriously cut down on the necessary number-crunching. In fact the reason that vector - and DTP - programs haven't offered transparency in this way is far more fundamental than the processing required. The reason lies at the very heart of the difference between bitmaps and vectors. Drawing packages have been designed with commercial print in mind and this is based on the Postscript-driven object-based production of colour separated plates. Postscript processing is built on a very different system to the pixel-based layer model. Instead the page is constructed upwards from the bottom to the top with every vector-based object opaque and obscuring those below it. Only those objects on the top of the stack make it through to the final page.

So does this Postscript stack-based approach inevitably rule out the possibility of transparent vector effects? Not necessarily. For some time now designers have been forced into finding workarounds. In Illustrator, for example, it is possible to take advantage of the PathFinder filters to create a new overlying object where two objects overlap. It is then possible to manually set the correct fill and stroke. It's hardly state-of-the-art and, while it might work for the odd logo or headline effect, it's not going to be much good for a realistic illustration with hundreds of objects and complex blends. Worse, by its nature, the workaround is fixed. Move the transparent object and you will have to recreate all of the objects it overlaps.

  • FreeHand 8 Lens Fills

In comparison the new FreeHand solution is simplicity itself. All you have to do is select an object and then the Fill Inspector. From here you select the Lens fill option and the Transparency sub-option, select a colour and set the opacity percentage. The object is automatically filled with the correct colour and all underlying objects become visible and correctly coloured. The effect can be eye-opening. If you have a typical lifeless clip-art image of an opaque glass of opaque red liquid in front of a bottle, for example, making the glass and liquid partially transparent suddenly makes it look like real wine - you can even read the wine label. Even better, FreeHand lets you clone the lens and add a slight magnifying effect just it appears in real life. Best of all, if you move the lens, the effect updates automatically and instantly.

The difference to the Illustrator workaround is immense, but is it as revolutionary as Macromedia claim? Corel Draw users in particular will be less than awe-inspired. After all, Draw has offered similar features for nearly four years since the Lens special effects were introduced back in version 5. In fact looking at the small print, Macromedia do qualify their claim saying, "FreeHand 8 is the first high-end, Postscript-based drawing program to offer true, dynamic transparency capabilities while preserving documents in an editable vector format." In other words, it might not be the first to offer transparency per se, but it is the first to offer it safely and reliably in a professional Postscript-based context. Reading between the lines the implication is clear - don't touch Corel's transparencies with a barge pole.

  • Head to Head

As I've also just finished getting to grips with the latest release of Draw which prides itself on its improved Postscript support this seemed like a useful challenge. Transparency is clearly a must-have effect so I wanted to find out which of the two contenders offered the most power and the most reliability. To investigate I set up a simple test in both programs. First I created two overlapping rectangles the lower of red (0%C, 100%M, 100%Y, 0%K) and the higher of 100% cyan. Then I copied the objects and turned the cyan rectangle into a 20% cyan transparency. As a slightly harder test I created some simple red text with a 100% black outline and then covered this with the same semi-transparent cyan rectangle. Then I exported the results to an EPS file from Draw and saved the results as an EPS within FreeHand.

Next I imported both files into PageMaker 6.5 and printed out the CMYK separations. The FreeHand plates came out exactly as I expected with 20% rectangles on the cyan plate, a mix of 100% and 80% rectangles and text on the magenta and yellow plates and 100% solid outlines on the black plate. The Draw separations though were bizarre. All the objects with no transparency came out just as expected, but the colour handling in the transparent areas was mysterious to say the least. The overlapped rectangle and text both knocked out their supposedly overlying 20% cyan rectangles to white, there were percentage tints on the black plate and worse there were tints on the yellow and red plates in areas that should have been purely cyan!

The only thing I could say for certain is that the plates would not have produced the effect I was expecting. At this stage I nearly threw in the towel thinking a barge pole wasn't nearly long enough. Fortunately the results were so strange that felt I had to check them, so I went back into Draw to check my EPS output options. Sure enough there was a "use printer colour profile" option selected that I hadn't noticed. When this was turned off and the pages printed again the results were very different. The cyan plate still had knocked out areas and the black plate still had its percentage tints, but the magenta and yellow plates had lost their colour cast. I was definitely making progress and I was also intrigued. The areas of transparency were clearly being treated very differently to the rest of the drawing, but how and why?

To understand I really needed to get into the EPS files themselves to see what was happening. As both programs claim to open Postscript files for editing I didn't think this would be too much of a problem. However when FreeHand opened its EPS file all the transparent fills were there in place just as they were when saved to its native *.FH8 format file. As Postscript doesn't allow transparent objects the program must somehow be recreating the effect on opening. Very clever but, in this instance, not very helpful. Trying to get Draw to open its EPS was even less enlightening. An error message appeared saying that the file had an invalid format despite the fact that it had created the file itself! Another black mark for Draw, but potentially the end of the investigation.

Illustrator to the Rescue

Fortunately this is where Illustrator showed its greatest strength, its bombproof Postscript handling, as it had no problem opening either file for editing. The results were a big surprise in each case. I had expected FreeHand to take an approach similar to the Illustrator PathFinder method with a whole series of new objects created where they were overlapped by the transparent rectangle. Instead the effect was produced by copying all of the relevant objects as they stood, changing their fill and stroke properties appropriately and then masking them with the transparent object so that only the desired area was visible. In many ways it's a wasteful method built on processing unnecessary information, but it has two great strengths. No information is lost and all objects, even the text, remain fully editable.

The areas of transparency in the Draw EPS were dealt with very differently. The overlapped text was not created as true letters, for example, but simply as a whole series of shapes and curves. As future editability isn't considered an issue, Draw is free to recreate the effect as it sees fit. In other words Draw is only interested in the end results not in the means. This is particularly obvious when it comes to the question of colour. Checking Illustrator's colour palette showed that the overlapped rectangle and text that should have been 20%C, 80%M, 80%Y, 0%K was in fact 0%C, 60%M, 60%Y and 20%K. Suddenly the strange results with the knocked-out cyan and the black tints became clear. In creating the EPS, Draw had automatically applied Gray Component Replacement (GCR) when dealing with the areas of transparency, moving all shared percentages of CMY onto the black plate.

  • In Practice

What this means in practice is that despite the completely different methods for creating the transparency effects - both in the EPS and on the plates - both the FreeHand and Draw files would theoretically produce exactly the same results. Given this, Draw is certainly not the lame duck that it had seemed regarding the commercial printing of its advanced effects. In fact it could be argued that Draw's approach is superior as its automatic GCR could prevent over-inking an obvious danger when colours are being mixed. In practice though most bureaux would almost certainly prefer the FreeHand approach. To begin with GCR is never perfect so there would be an inevitable slight colour shift. More importantly the resulting knock-out effect could lead to potential trapping problems if registration wasn't perfect. Most fundamentally of all, no designer likes things happening outwith their control.

Perhaps the central rule of design is to keep things simple and predictable. Because FreeHand is always thinking in Postscript - remember its native files can be saved directly to EPS - it can be relied on to get the message across as simply as possible when it comes to speaking Postscript during output. Because Draw manages things its own way and then has to translate back into Postscript the complexity involved is inevitably greater - presumably this is why it was unable to parse its own file - and there is more scope for errors and misunderstandings to be introduced. As such it's fair to say that, for the creation and outputting of simple transparency effects, FreeHand 8 is definitely the program of choice as Macromedia claims.

  • Graduated Transparencies

That's not the end of the story, however, as Corel's break with the pure Postscript object approach opens up other possibilities. In particular, since version seven, Draw has offered an interactive transparency tool which enables a whole new range of effects. Most importantly transparencies no longer have to be solid, but can vary in opacity. In many ways this is as big a breakthrough as the introduction of partial transparencies in the first place. Again to see why all you have to do is look around - the transparent shadows that define our world are all graduated. Draw's new controls are not only essential when it comes to producing photo-realistic results, the other options for applying patterned or textured transparencies and for choosing blend modes can also be used to create some amazing effects. Using a fractal water ripple pattern set to apply only to the blue channel of an underlying photo, for example, I was able to give myself a pretty realistic Maori-style face tattoo!

Such power leaves the other drawing programs standing. If Draw can output such effects reliably, FreeHand's much-vaunted new capabilities are going to seem very puny indeed. To test whether it could, I created an EPS with three lines of red text each covered by a graduated, patterned and textured cyan transparent rectangle respectively. I then brought the file into PageMaker and printed off the separations. This time the cyan plate was completely empty, the yellow and magenta plates had been knocked out by the transparent boxes and all the blend and patterned effects were on the black plate! What's more the quality of the text in the transparent boxes looked very poor. This time there could be no GCR explanation. If the EPS had gone off for commercial print like this the effect would have been disastrous.

To find out what was happening I again loaded the EPS into Illustrator. The explanation was very simple, each of the transparent effects had been created as a bitmap. To be honest this didn't come as too much of a surprise as there is simply no vector-based way that such effects could be described. This move to bitmapping immediately explained the relatively poor quality of the text on my laser-produced separations. With the higher lpi of an imagesetter the effect would not be so pronounced, but some loss in smoothness would still be inevitable especially as no anti-aliasing had been applied. After a little thought it also explained the failure to colour-separate correctly. Draw must have created the bitmaps as RGB files and as PageMaker is unable to convert RGB files to CMYK on the fly it had instead dumped them all onto the black plate.

Unlike PageMaker, Illustrator is able to separate RGB bitmaps so I tested its separations of the file. This time the four plates were produced exactly as expected. Draw too is able to convert RGB to CMYK on the fly so in fact the most likely outputting scenario of producing separations directly from Draw would not have encountered the same problems. Being able to output the graduated transparency effects then is by no means impossible, but I'm very glad I looked into the matter before jumping in. It's certainly clever, but I'm not really comfortable with Draw's switching between vector and bitmap processing especially as its unacknowledged. The translation can never be seamless - as seen in the poorer quality of the halftoned text - and it can lead to problems - as seen in the PageMaker RGB problem.

For absolute reliability when outputting professionally there's a lot to be said for sticking with the lowest common denominator. That's what Illustrator offers with rock-solid Postscript handling but no transparency control at all. For more adventurous users, FreeHand pushes the Postscript envelope but never strays outside. For the user interested purely in power, Corel ignores all external constraints choosing to translate its effects retrospectively into whichever format is most appropriate whether vector or bitmap. So which approach is best? For the standalone user outputting directly to their own printer there's no question that the Corel approach offers maximum power and with enough quality in nine cases out of ten. For the professional designer, however, quality is crucial ten times out of ten.

So does that mean I'll be playing safe and ignoring Draw's advanced graduated transparency features? Not necessarily. Now I understand how the effects work I'll be happy to use them, but within the right context. Essentially they are bitmap-based effects. This means that they are ideal for outputting not directly to EPS, but to TIFF. That way it is possible to keep tighter control of image quality by setting export features like resolution, colour mode and anti-aliasing. Even better effects can then be checked and if necessary fine-tuned in Photoshop before being brought back in to the drawing or DTP program for final outputting.

Tidak ada komentar:

Posting Komentar