MoI discussion forum
MoI discussion forum

Full Version: Cross Hatching experiment

Show messages:  1-2  3-22  23-42  43-62

From: Frenchy Pilou (PILOU)
21 Jul 2022   [#43] In reply to [#42]
Not a big deal, just select the face(s) unwanted and make any erase/replace you want! :)
From: pressure (PEER)
22 Jul 2022   [#44] In reply to [#13]
Michael,

I was excited about this all week and am happy to see you made some progress. See attached PDF for my comments.
From: Michael Gibson
22 Jul 2022   [#45] In reply to [#44]
Hi Peer, I've always admired these types of illustrations but have not ever really deeply researched them so your docs are very informative and helpful for me, thanks.

Unfortunately I can't really spend a huge amount of time developing every detail of this area. Probably the cutoff point at least for now will be on things that require supplementary object selections or guiding strokes. With those sorts of things it will probably require some kind of interactive preview along with it and although that would definitely be cool it overall adds up to a pretty large package of work.

re:
> In case I wasn’t clear before: I don’t want to either render min curvature lines OR max
> curvature lines; I want both to be rendered but in separate groups or line styles so that I can
> choose which ones I want on a patch-by-patch basis.

Yeah I didn't realize that. When generating both directions I can put them inside groups for AI and SVG format exports. PDF format does not have a grouping operator in it for graphics content streams so it may not be viable to do it for PDF format.


Question - is there a specific rule for these types of breaks like should they always occur nearby a line that has been terminated because it is entering a brightly lit area?



re:
> I want still more accurate curvature lines. I know you can do this since your N-gon mesher
> makes quads with vertices that lie exactly along curvature lines

Well not quite exactly - the N-gon mesher makes quads in the UV parameter space of the NURBS surface. For conic sections they are the same but for more general surfaces it won't be.


> Any visible squiggle will spoil the effect, as will errors in line orientation, such as min curvature
> lines on a cone that are erroneously parallel in image space when they should in fact converge
> to the point:

Yeah I noticed that on the cone. So what happens there is that there is a conflict between tracing an accurate curvature line and simultaneously keeping regular spacing in image/page space. Basically the min curvature cone line wants to travel towards the point but previous lines have already taken claim to that area and so the new one can't quite follow the accurate line of curvature that it would like to.

One thing that I've tinkered with to mitigate that somewhat is to generate lines more sparsely instead of being tightly packed one after another, that gives a result like this instead (at the expense of having more shorter pieces):






I think I could get more accuracy on the curvature lines if they were allowed to approach closer to each other instead of maintaining even spacing...

Do you have some examples on what cones should look like?


re:
> I would like an option to choose whether lines are spaced evenly in image space or whether
> they're spaced evenly in object space.

The mechanism is currently pretty heavily based on image space but I'll try some experiments for this.


re:
> For example, where 3 fillets meet at a
> spherical corner I’d probably want the drawn curvature lines to be continuous with lines of min
> curvature on the fillets:

Hmmm, I'm pretty doubtful that I could get it to do that.


re:
> If there’s an option to use lines of curvature to show both shape and shading then I would like to
> be able to select whether shading is accomplished by line spacing or whether it’s accomplished
> with variable line weight. <...>

This might be feasible... I didn't realize that these were done using just one heavier line weight I kind of thought they were gradually increasing and decreasing like one long paint brush stroke.

Would you expect for the lightweight line to run the full length underneath the heavier segment or should it be trimmed out where the heavier one starts and ends?

Thanks, - Michael

Image Attachments:
hatching_additional_breaks.png  sparser_filling1.png  sparser_filling2.png 


From: pressure (PEER)
23 Jul 2022   [#46] In reply to [#45]
Michael,

You and I are in the same boat. While I did some stuff like this in pen and ink years ago, I only recently got serious about it. What I quickly found is that, traditionally, surface shading is done almost entirely with straight lines plus the occasional arc or ellipse because those are easy to make with a ruler etc., but that this method doesn't work for the doubly-curved surfaces that I need to shade. Furthermore, I found that I couldn't come up with a method of drawing convincing shade lines on doubly-curved surfaces in Illustrator or Corel. Surveying the work of others, it seems like no one else has figured out a good method either. In other words, I believe you're in a position to greatly expand the scope of this style with your principal curvature method, rather than simply emulating what others have done with pen and ink.

re:
> although that would definitely be cool it overall adds up to a pretty large package of work.

I knew I was asking for a lot with interactivity. It's totally reasonable to limit the scope.

re:
> When generating both directions I can put them inside groups for AI and SVG format
> exports. PDF format does not have a grouping operator in it for graphics content streams
> so it may not be viable to do it for PDF format.

Understood, though I haven't tried SVG export. It's not available in v4, right? I'll have to try that since now I'm using Illustrator almost exclusively for it's ability to accepted pasted Ai and am then doing most of the real work in Corel. Regarding PDF, if each direction were assigned a different line style (color or width) that would be almost as good as grouping. But, may not be needed if SVG supports grouping.

re:
> Question - is there a specific rule for these types of breaks like should they always
> occur nearby a line that has been terminated because it is entering a brightly lit area?

While it's true that the type of line breaks you pointed out occur almost exclusively where a line enters a highlight/hotspot, it is not true that this type of line break is always used where a line enters a highlight, nor is it true that this type of line break always indicates that a line is entering a hotspot. It's not even true that a single break is always used. Here's someone who liked double breaks:



I wouldn't hard code something like this. This style of line break can be made in seconds using the Eraser tool in Corel.

re:
> Well not quite exactly - the N-gon mesher makes quads in the UV parameter space

Not what I was hoping to hear, but I've still got faith in your ability to calculate derivatives accurately.

re:
> So what happens there is that there is a conflict between tracing an accurate curvature
> line and simultaneously keeping regular spacing in image/page space.

My understanding is that you're generating densely-spaced streamlines (or vector fields) along lines of curvature in object space and then using these to guide the growth of visible lines in image space, but that while what happens in image space is guided by the projected streamlines, the visible lines can deviate from the projected streamlines because the procedure is something like an optimization or curve fitting. I worry that getting this right is a difficult problem. I'd rather receive hatch lines that are evenly spaced in object space, even if they become dense to an unsightly degree in some areas, than the result of trying to maintain even tone in image space if that leads to geometric inaccuracies.

Another reason that I'm arguing for even spacing in object space is that curvature lines that have automatically been broken in a random way to give even tone will limit what I can do with those lines. But, if I get lines that are continuous from edge to edge, then I can decide how or where I want to end them.

re:
> cones

Darn. My books with examples of simple geometric shapes are where I was traveling and I didn't take photos of those pages. Here are the examples I have at hand:




re:
> Hmmm, I'm pretty doubtful that I could get it to do that.

In the example scene that you've been posting since the start, what determines the direction of hatching on planar surfaces? Does it have something to do with the lines of curvature on adjacent areas (i.e. a continuity condition), some conditions about how hatch lines interact with ridges, or is it purely decided by UV of planes used in construction?

re:
> This might be feasible... I didn't realize that these were done using just one heavier
> line weight I kind of thought they were gradually increasing and decreasing like one
> long paint brush stroke.

This is low on my list of desires. But, if you insist I would prefer that the lightweight line run the full length underneath the heavier segment because it's more flexible. That's how I've done it in Corel: draw hatch lines with light weight, duplicate hatch lines and increase weight of duplicate, and then go at the heavy lines with the Eraser while I've got the light lines locked. If I want the lightweight lines trimmed I can use the Weld command to achieve this. Regarding smoothly varying width, that is done in woodcut, but I can't think of a nice way to do it digitally that would still be reasonably editable. Do you have an idea regarding smoothly varying width?

Image Attachments:
conical_objects.jpg  light_socket.jpg 


From: Michael Gibson
23 Jul 2022   [#47] In reply to [#46]
Hi Peer,

re:
> Understood, though I haven't tried SVG export. It's not available in v4, right?

Correct, SVG import/export is new in the v5 beta.


> My understanding is that you're generating densely-spaced streamlines (or vector
> fields) along lines of curvature in object space and then using these to guide the
> growth of visible lines in image space, but that while what happens in image space
> is guided by the projected streamlines, the visible lines can deviate from the projected
> streamlines because the procedure is something like an optimization or curve fitting.

Yup, that's more or less what's going on.


> I worry that getting this right is a difficult problem. I'd rather receive hatch lines that are
> evenly spaced in object space, even if they become dense to an unsightly degree in some
> areas, than the result of trying to maintain even tone in image space if that leads to
> geometric inaccuracies.

The thing is there's a similar issue in object space as well. Except in special cases there is not
such a thing as an exact line of curvature that is equidistant at all points from another
line of curvature. There is with cylinders but not on just any arbitrary curved surface.

What I mean is If you make a line of curvature and then pick a point on that curve and move
a certain distance away from it in and then make a second line of curvature going through
that new point the new line of curvature can easily converge towards or diverge away from
the previous one.

So kind of the whole general idea of "evenly spaced lines of curvature" is rather ill defined.


> Another reason that I'm arguing for even spacing in object space is that curvature lines that
> have automatically been broken in a random way to give even tone will limit what I can do with
> those lines. But, if I get lines that are continuous from edge to edge, then I can decide how or
> where I want to end them.

I guess it could be possible also in image space to have an option to allow a line being traced to
have free rein to go where it wants to become a more accurate line of curvature but it will probably
be pretty messy looking with a lot of density and converging pieces. Something like a torus
could also be prone to them going on and on but I guess they could terminate after some
kind of winding threshold.


> In the example scene that you've been posting since the start, what determines the direction
> of hatching on planar surfaces? Does it have something to do with the lines of curvature on
> adjacent areas (i.e. a continuity condition), some conditions about how hatch lines interact
> with ridges, or is it purely decided by UV of planes used in construction?

It's just the UV directions of the NURBS surface.


re:
> Regarding smoothly varying width, that is done in woodcut, but I can't think of a nice way to do it
> digitally that would still be reasonably editable. Do you have an idea regarding smoothly varying width?

Well it's not supported as a regular line stroke property so it would have to be formed by a filled
outline rather than as a stroked curve.


Thanks,
- Michael
From: OSTexo
23 Jul 2022   [#48]
Hello,

I've used MoI countless times for this style of drawing taking manual steps and complimentary applications to get there. I use the iso at points script in MoI to generate a line set, export the image with background, convert the raster background to a very limited color vector, boolean the iso lines with the vector background and use some brushes to apply the dot dashed style to the remaining lines.

The limitation in many cases comes is with the lack of lighting control in MoI. It's not really meant to have this feature so I find that positioning lighting on the model in another application, rendering it out and then compositing it into the background image of the MoI export works, even if it's sort of a long way around to get the line work flowing a bit better.

What I'm left with eventually is a pure vector line work technical illustration whose layers can be individually tweaked to change the drawing aesthetically, e.g. modifying line thickness, dot dash and line spacing. Most of the time spent with MoI export in my case is cleanup, little line fragment deletion, trimming intersections and overshoots in the 2D curves and extending curves along their tangents to their intersections. Currently it's just more efficient to perform those operations in other applications, but if those make it into MoI, it means one can stay in MoI and export a nearly complete illustration set with minor adjustments.

If MoI had features like an integrated distribution tool that works with the align tool and the ability to move and explode part assemblies, cutting planes, lighting control, surface and curve extension along tangents and little things like curved leaderlines and automated thick/thin line assignment it starts allowing for output of very high quality technical illustrations that don't need to be tweaked in multiple applications, an even bigger time saver. Suddenly highly polished technical illustration output doesn't take loads of time and money, MoI takes a larger role beyond design.

Having an interactive hatch tool would be next level stuff, similar in operation to the current iso tool to rapidly place down and move shading lines along the model surface but have the line termination depend on the brightness value. That sort of tool also might open up possibilities for more defined thick thin line assignment. Of course that comes back to lighting intensity and position control within MoI but your illustration output that took minutes would only look like it took days.
From: Michael Gibson
23 Jul 2022   [#49] In reply to [#48]
Hi OSTexo, well there are a couple of things there that are relatively low hanging fruit. LIke improving Extend is something I can likely get to pretty soon.

Can you describe a little about what you would need for lighting control?

- Michael
From: Mindset (IGNITER)
24 Jul 2022   [#50]
Hi Michael ,

Could we designate specific preset hatching options to various faces selectively?
Might they generate into different styles so that they remain selectable as layers in Affinity Designer?

This could be huge !!
Thanks ,
MindSet
From: Michael Gibson
24 Jul 2022   [#51] In reply to [#50]
Hi MindSet,

re:
> Could we designate specific preset hatching options to various faces selectively?

Probably not for now at least. Maybe in the future it could be a property of styles.


> Might they generate into different styles so that they remain selectable as layers in Affinity Designer?

Yes I think there will be a new entry in the Line style options dialog where you can currently set up how Visible lines, Outlines, Silhouettes, Hidden lines, and Annotations are organized in the output.

- Michael
From: pressure (PEER)
27 Jul 2022   [#52] In reply to [#48]
OSTexo,

Thanks for pointing out the IsoAtPoints script and for asking Michael to make it years ago. I gave it a try and am hoping you can give me some pointers.

I found that this script accepts 1 face only, so I'm running the script 8 times to go around a filleted rectangle:



Is that what you'd do in this case, have you modified the script to accept multiple faces, or can you recommend some other workflow?

I found that the singularity in UV occurs at different vertices on different corners of a filleted rectangle and so I end up with isocurves that fan out at some corners but are parallel at others. Do you carefully construct solids so that the UV coordinates will be right for line shading, or how do you handle UV parameterization that doesn't jive with how you'd like shade lines to run?



What do you use for fragment deletion? I'm using an Illustrator script by John Wundes called SelectPathsBySize

Image Attachments:
IsoAtPoints_1face.png  IsoAtPoints_UV.png 


From: pressure (PEER)
27 Jul 2022   [#53] In reply to [#47]
Michael,

Thanks for explaining more about how your method works.

re:
> the whole general idea of "evenly spaced lines of curvature" is rather ill defined.

You're right. I was fixated on solids of revolution and was thinking about lines being equidistant in polar coordinates, but clearly that's not generalizable. I'll put some more thought into what I mean by "evenly spaced"".

At the very least I now agree that hatch lines must be selectively shortened where they radiate from an umbilic to avoid drawing undue attention to a point that's not important. I tried this manually and found that I needed to thin out hatch lines significantly, though still not near evenly spaced in image space:





Instead of even spacing in image space, what about a minimum distance between shade lines in image space? Maybe that's what you're doing already.

re:
> Something like a torus could also be prone to them going on and on

You've likely already thought of this, but attached is an academic paper where the authors terminate integration when the ends of a growing line of curvature are within a small distance from each other and then force the line to close by distributing the integration error over all of the integration points. This might run into trouble on a twisted surface, so the user would need some control over the small distance. See Fig. 4 and the text immediately below on page 4 of the attached PDF. Here's an ellipsoid that they made from paper strips:



and here's a video showing how they wove car body panels out of paper strips that follow curvature lines:

Image Attachments:
distracting_umbilics.jpg  thinned_umbilics.jpg 


From: OSTexo
27 Jul 2022   [#54]
Hello Michael,

Position, size, shape, intensity and the ability to save/edit/delete lighting setup. I realize MoI isn't really intended for this sort of thing and other render tools can get close enough to cobble things together even though it's sort of clunky.

In thinking about it a bit more if you were you make the process interactive you could use sliders and/or numerical input to define a starting iso density, it looks like you have the ability to have the isolines retain continuity across surfaces, that's a good thing. Being able to group, join and merge lines that are connected end to end would be really useful as well, this enables the designer to determine the flow of the shading lines to give a different look to the drawing.

Being able to automate these sort of tasks would really speed up the process and if made somewhat interactive one could quickly iterate and clean up designs.
From: OSTexo
28 Jul 2022   [#55]
Hello,

I've cobbled together a workflow for illustration that works pretty well for me even though it does require repetition.

When a model is completed I use Array > Curve to lay down a set of points along edges on one side of the model. If the model is symmetrical on an axis I'll use a midpoint to start. I'll then run the IsoAtPoints script surface by surface in a single general direction, having the shading lines moving one way just gives the eyes a direction to follow although it's really just an aesthetic choice.

In order to keep the shading lines consistent across multiple surfaces I use the MarkCurveStart and MarkCurveEnd script and walk my way across surface by surface. Michael Gibson provided the way to make one change to the start script which then allows end to end matching of shading lines across surfaces. That provides a set of shading curves which then can be exported.

Depending on the exported curve set I determine whether to use Illustrator plugins from Astute, limited palette image tracing and segment deletion in Corel and then curve cleanup no matter what application downstream is used.

I still haven't figured out how to round trip the AI files back into MoI to use the curve editing tools there, the dimensions always seem to be a bit off when edited. If the technical illustration focused features make it into v5 that just means a more complete deliverable being output right from MoI.
From: pressure (PEER)
29 Jul 2022   [#56] In reply to [#55]
OSTexo,

Thank you for talking more about your process. I don't understand what you're using MarkCurveStart for. I would have thought that 2 abutting faces always share an edge and so the intersections of the shade lines and the edge could be used to transfer line spacing between faces. I guess I haven't run into the problem that MarkCurveStart solves, but I'm glad you brought it up so that I'll know about it when I need it.
From: pressure (PEER)
2 Aug 2022   [#57] In reply to [#47]
Michael,

I've been doing some manual experiments and have changed my mind about hatch spacing. You are right: for a surface having a uniform tone the hatch pitch should be uniform in image space. The thing that had me thinking otherwise was hatching with min curvature lines on a cylinder where uniform pitch in object space gives an illusion of curvature while uniform pitch in image space looks like a flat cutout:



But, I played around with some other shapes and am now pretty sure that all that's happening here is that uniform pitch in object space just happens to emulate the shading that results from a headlight in this one case. In other words, uniform pitch in object space is bad for other shapes.

Here's the most challenging sort of shape / viewpoint that I've tried to get uniform tone on:



It's bad because the shape is smooth and so I've found that breaking the hatch lines acts like a rough texture, because there are no natural locations at which to decimate the hatch lines in a discrete way, and aliasing + moire wreak havoc at the front and back.

Would you run this ring through your system and see how it comes out? Model and ViewManager file are attached. Please omit raster shading.

Sorry for being glib about accuracy. I've come to realize that integrating a direction field is a hard problem. I'm impressed by how well the examples have turned out if this integration is taking place in image space. I do believe that integrating in object space could have major advantages because the direction field would remain continuous at silhouettes, because face symmetries could be used as a hard cue for growing curvature lines, and for artistic flexibility. But, I don't have anything really useful to say on this at the moment so will keep working on the idea.

Regarding cones, I don't think there's a perfect solution for min curvature lines converging to the vertex. Here are the solutions that I know of, with max curvature lines being a clear winner:

Attachments:
ring_1049_.views.json
ring_1049_080222.3dm

Image Attachments:
cone_matrix.png  cylinder_hatch.png  ring.png 


From: Michael Gibson
4 Aug 2022   [#58] In reply to [#57]
Hi Peer,

re:
> But, I played around with some other shapes and am now pretty sure that all that's happening here
> is that uniform pitch in object space just happens to emulate the shading that results from a headlight
> in this one case.

Yes that makes sense. I guess that's a general problem that any locations with lines getting close together can get interpreted as a low illumination area from shading.

And then if you are actually doing shading aware spacing that might be even worse because then you'll have some areas with higher density from shading and some with higher density that is not from shading.

re:
> Would you run this ring through your system and see how it comes out?

Here are a couple of results, first with "tightly packed" lines where it tries to insert a new one as close as it can to existing ones, and the last 2 with sparser filling:









- Michael

Image Attachments:
peer_ring1.png  peer_ring2.png  peer_ring3.png  peer_ring4.png 


From: OSTexo
4 Aug 2022   [#59]
Hello,

I us the curve start and end marking so I can keep continuity of the shading curves across surfaces. If a pronounced separation between surfaces is desired then I wouldn't use the mark start/end.

In the image example I started at one end equally spacing points around the end using array curve, then iso at points, then for every subsequent surface I marked the generated curves with mark at start/end depending on the curve direction and repeated the iso at points command.

That left me with a whole set of lines which I then exported with a raster background to .ai using the default lighting in MoI. I then trimmed the excess transparent raster data from the background image so the bounding box of the vector curves matched the background image.

At that point there are multiple ways to post process the file to get the look and application you use, but they all usually involve adjusting the levels of the background image, converting the background to a limited color vector image and then using that background vector to perform automatic or manual operations to the set of vector shading curves.

I may be mistaken but the operations developed by Michael are getting you much further ahead in MoI itself. Getting contiguous shading curves out of MoI cleanly trimmed by using lighting in MoI just leaves having to specify curve width and/or vector brush stroke type. That leaves you with limitless aesthetic options when you have a clean set of vector curves. Being able to add/tune things like dash/dot and stroke style is something done easily enough outside of MoI in nearly every vector illustration program, this hatching feature can save a bunch of work in the middle of the process.

Image Attachments:
pipe.jpg 


From: pressure (PEER)
6 Aug 2022   [#60]
Michael,

Thank you for trying a couple of methods on the ring. I prefer the sparse version because it gives fewer radial fragments on the top of the ring. I'm surprised by how even the tone is on the top of the ring in ring2 and ring4 while also looking smooth. I'll try some more experiments to see if I could live with the deviations between the line trajectories and the UV direction field.

OSTexo,

Nice pipe! Thank you for explaining. I now understand how you're using start and end markings. That's a great trick that I'll definitely use.
From: pressure (PEER)
11 Sep 2022   [#61]
In anticipation of the release of cross hatching here's a script that allows the hatch direction to be changed on planar faces of solids.


Attachments:
UVchanger-plane.js

Image Attachments:
UVchanger-plane.gif 


From: Frenchy Pilou (PILOU)
11 Sep 2022   [#62]
UVchanger-plane
Works like a charm!


Show messages:  1-2  3-22  23-42  43-62