Thursday, July 2, 2015

perspective - Illustrator: how to add isometric shadows


I´ve been wondering how to do this kind of shadows (image below) as real as possible. Is there any technique to apply? I did search for tutorials but unfortunately I couldn´t find anything on this specific topic.


isometric shadows



Answer




Doing accurate shadows is quite easy, albeit a bit tedious. All you need is to do is to systematically find intersections of lines. Not all that different from drawing (or constructing) the original orthographic or perspective images in the first place.



Before we begin lets define two different shadow models:




  • Directional lights, are light sources that are very far away, like the Sun (about 150 million kilometers away). They cast shadows that are parallel to each other*.




  • Point light sources, lights that are closer and thus have a central source.




These are quite idealized models, there are others, but should be sufficient for your needs. The example image you show is displaying a directional shadow.



* A 1 kilometer wide object (two of the largest oil tankers end to end) would have 0.004 degree angle deviation form parallel between edges of the shadow if you would model the sun as a point light. This seems close enough to parallel.



enter image description here


Image 1: Directional shadows made in illustrator. To see construction lines look here.


I will begin by describing directional shadows, because they are slightly simpler (or faster) to construct than point lights. Mainly because you can share the construction line.


Start by constructing your isometric scene. Keep in mind that you may need to deduce the height of objects later. So doing some bookkeeping may help you later, so store relevant info in a notes layer.


The basic idea is to find the intersection of a line and a plane, virtual or otherwise. We do this by first deicing the direction of the shadow and one corner on the primary (ground) plane.


enter image description here


Image 2: The light direction, and the light direction on the floor plane. As well as deconstruction of the XYZ moves to verify that the light makes sense.


Store the construction shape as it will help you solve problems you didn't anticipate. Its especially useful when you start having more height levels, if not then all you need is the light direction line.



For each corner on shadow casting side on same height duplicate the direction line. Then connect the lines and the points on the shadow casting edges on ground. You may need to construct the invisible sides to get the appropriate directions (or use the line direction on ground plane)


enter image description here


Image 3: Simplest case. Area bounded by lines and cast shadow is called shadow volume.


To understand better how the bottom side works, and why we saved the directions let us look at a still quite simple case where the object is hovering above the ground. Now our direction line isn't long enough anymore, we need to extend it. But how much?


This is where the direction on ground line comes into play. You draw the vertical down to ground level, Then place the direction on ground line on this point, the ground lies at intersection of the extended direction line and the direction on ground line. The intersection is where the ground plane intersects with direction line.


enter image description here


Image 4: By building triangles of verticals and ground direction lines you can measure nearly any intersection.


Ok, so this is tedious. But there is a easier way, for planar objects. If we think of the cube only having the top and bottom face you will notice that the shadows of the objects are the same shape as the top and bottom piece just offset from the original. Because the planes are co-planar and the projection does not have nonlinear changes.


enter image description here


Image 5: More complicated planar objects are easier. Objects co-planar to the shadow catching object are just offset.



A similar method applies to side faces only you may need to use a few skews rotates and a scale to achieve it (it is related to the SSR method of constructing objects). Lets look at what a square surface does and skew a object surrounded by square to same shape.


enter image description here


Image 6: Side panel projected. Due to the nature of things if you can project a square you can project anything in a square


All this means that the kind of example that you have presented takes a few minutes and requires only a few alt drags of objects. However you need to know what your doing. Far too complex subject for most easy tutorials.



enter image description here


Image 7: Same illustration point light shadows.


Point lights work similarly, with the change that the rays of light emanate from a point. This means that there is no trick to finding the points. Its all finding rays ad their intersection.


So what you do is you draw a line from the light source to every shadow casting corner. Then you draw a line from the light ground to the corresponding ground corner. You then extend the lines (with say transform each by scaling up) and find each intersection.


enter image description here



Image 8: Point light construction. Extend rays to corners form light location and its corresponding ground point.


That is it, other then tricks on extending lines theres not much you can automate beyond this.



Perspective works like point light shadows, for both light types. This is because even co-linear lines are emanating form points in perspective. So the workflow is the same for both types of light.



Now, knowing this has many utilities outside 2D drawing packages too. Its pretty common to need to do this line direction calculation when tracking live scenes for 3D graphics. Also the light models are the same as used in 3D.


Also note that: I do not use grids. The line tool, and alt drag cloning, is good enough for finding intersections. The grid just artificially constrains me to certain size decisions and ultimately does not make the job easier. But then I am trained as a mechanical engineer.


No comments:

Post a Comment

technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...