Illustrator script for super-strong inner Shadow effect tutorial

Source: Internet
Author: User
Tags arithmetic
To give you illustrator software users to detailed analysis to share the script to create a very strong inner shadow effect of the tutorial.
Tutorial Sharing:
First, create a new document, with rounded rectangle tool, or rectangular tool + fillet effect, to draw such a graphic:
Then, execute the menu command effect "-›"svg filter "-›" apply SVG filter command, and in the pop-up dialog box, create a new SVG filter:

Then, copy and paste the following code to replace the contents of the text box, click OK:
Finally, the point "OK" applies the effect, the inner shadow effect comes out, with (5,5) the direction of the offset:

If you find a graphic with jagged edges, this is similar:

Then, execute the command "effect"-›"document grid effect setting", tick "anti-aliasing", that's OK.
Done. If you want to adjust the offset of the inner shadow, adjust the value of dx, dy. Changing the color and transparency of the inner Shadow can be done by adjusting
tags in the Flood-color and Flood-opacity properties to do. This method should be in the AI to create the inner shadow of the most labor-saving, the effect is good way. Note, however, that this filter should usually be placed at the end of the effects panel because the graphic is raster after applying the filter.
Note: This method comes from the discussion on Stackexchange: Inner shadow issue in Illustrator CS5, the earlier source is derived from: svgquickref, but this site's domain name is currently expired, not normal access = =
2. And others (how it works)
In the above example, we use the AI SVG filter function, we write a filter, applied to the rounded rectangle, generated an inner shadow effect. Out of curiosity, I studied how it works and found that the water was quite deep. Now, let's talk about the SVG filter function in AI. The following part, when the expansion of reading well, may be a little obscure, so do not require mastery. However, after mastering the application of SVG filters, you can write some simple filters to use in the AI.
First, talk about what SVG is. The full name of SVG is the scalable Vector Graphic, which allows you to scale vectorial graphics. SVG is actually a plain text XML format that defines shapes, fill colors, strokes, and so on in XML. In Wikipedia, the application of SVG format is widely used as national emblem, map and information map.
In addition to describing the shape of vector graphics, fill color, strokes and so on, SVG can also use filters to further decorate the graphic. The filter here is the SVG filter (SVG Filters). Online information about SVG filters is poor, both in Chinese and in English. However, based on the limited information available, I probably learned what the SVG filters are and how to use them.
SVG filters are also plain-text XML formats, as are descriptions of vector graphs in SVG format. The SVG filter starts with a label and ends with a label. The section within and the label is defined for the filter. In AI, the id attribute in the tag, which is the name of the filter displayed in the SVG filter panel.
An important concept of SVG filters is the base filter (filter primitives), where each base filter can perform a specific cosmetic function, such as a color transformation. All base filter names start with "Fe" and should be abbreviated as filter effect or filter element, as above. An SVG filter can be completed by a combination of a base filter or multiple base filters. After you know this, look back and see how the inner shadow effect is implemented step-by-step. For easy viewing, set the artboard background to this grid:

First, do the first step:
In this step, the base filter translates the original graphic to five pixels down and to the right in two directions (note that the bounding box for the above image is compared to the background grid):

Then it was
The base filter acts as a Gaussian blur for a graphic, which, as its name does, determines the fuzzy radius by the standard deviation of the stddeviation parameter to Gaussian blur. After making a Gaussian blur for the above graph, the result is temporarily in the buffer, the name is "Offset-blur":

Next is the base filter:
The function of the command is to spell two figures in a certain rule. You need to specify a blending mode with mixed mode arithmetic, over, in, out, atop, xor six kinds. Arithmetic is the arithmetic mode, there are four parameters, K1, K2, K3, K4 need to be manually specified; The flattening rule is to make this transformation for [R, G, B, a] each channel: result = k1*in*in2 + k2*in + k3*in2 + K4, In and in 2 for two graphs the size of each individual channel component of each pixel, result is a color channel value for the composite image. Over, in, out, atop, XOR six blending modes as shown in the figure:

You need to specify two images as input. In this example, the input image one, that is, the in parameter specified, is the source image, sourcegraphic input image Two, which is specified by the in2 parameter, offset-result the output result of the last step underlying filter in the buffer. Then let the two images do the out operation, and get the result:

Finally, the above flattening result is stored in a buffer, named inverse.
And here's the base filter:
command to color fill the area controlled by the SVG filter. In this example, the SVG filter control area is populated with black, 75% visibility:

Note the underlying filter does not have input parameters. The result of the fill is output to the buffer, and the name is color.
And then another command:
This time using the color and inverse images in the buffer to do in, the inner Shadow is made, and the result is saved to the shadow, as shown:

Finally, you flatten the shadow and the source image:
When the pieces are finished, the results are finally needed:

The step of creating an inner shadow using an AI SVG filter is almost like this. If you look back at the whole process, you'll find that many of the underlying filters take a step's output as input to this step. Then, you can draw a node graph based on the connection between the input and output of the underlying filter. The Base filter node diagram of our example can be drawn like this:

This makes the relationship between the base filters clear at a glance.
In addition, SVG filters have some other interesting features. One more example: enhance the concave and convex effect of the image.
If you've used some 3D authoring software or a game engine like Unity, you might know that in the computer world, the bump on the surface of an object can be done by a bump map or normal map. The bump map is given a concave and convex texture in addition to the color texture, the bump texture is represented by grayscale, the whiter the place represents the higher the height, the darker the lower the height is.
Normal maps are similar, except that the bump texture represented by grayscale is changed to a surface normal texture represented by color, and the [R, G, B] color of each pixel is the size of the component that should be dot normal [X, Y, Z]. Through bump mapping and normal mapping, you can greatly increase the reality of objects in the computer world, and will not increase the burden of computer rendering as much as adding geometric details as you create polygons directly:

such as the above Crazybump software screenshot, where the stone wall texture, and through the stone wall texture itself to generate a concave-convex texture, the computer according to the concave and convex texture, color texture and incident light color, direction, as well as the direction of the angle of view, generated the final color image with a realistic sense.
In AI, a similar effect can be made using SVG filters.
The filter uses the grayscale of the source image to generate a concave and convex texture, and then uses the bump texture to generate a concave and convex image from the light, and then the concave-convex image is pieced together with the source image to produce a more concave-convex image:

As shown in the picture above, the image below is the source diagram, and the difference can be seen by contrast.
You can then play with this, such as changing the direction of the light source:

Change the color of the light to the warm glow of the sunset:

Change the type of light source:

Even add a "shiny" effect to the texture:

As we can see, SVG filters are one of the least common features of AI, but they are quite powerful. With the SVG filter feature, we can write the filters we want, greatly enhancing the AI's capabilities and even turning the AI into an image processing software. However, the AI SVG filter also has many limitations:
The first is that the SVG filter can not easily adjust the parameters, if you need to adjust the parameters, you must change the code to adjust by hand. Also, the SVG filter in AI is not able to get the background of the current graph, as on the Web, by opening the Enable-background property. As well, it seems that AI may not use SVG filters to refer to other images or vector objects.
Finally, it is estimated that because Adobe also feel that this feature may not have many people to use, did not do software testing this function, SVG filter This feature has some bugs, if you enter some invalid SVG commands may cause AI crash. So before you apply the SVG filter, you must save the file.
Well, the above information is small to give you illustrator of this software users of the detailed script to create a very strong inner shadow effect of the tutorial to analyze the full content of sharing, you see the users here, small knitting believe that everyone is now very clear the method of making it, Then you go to follow the small series of the above tutorial yourself to try it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.