PaperModelers.com

Go Back   PaperModelers.com > Papermodelers' Bar and Grill > Other Things We Do & Make

Reply
 
Thread Tools Display Modes
  #11  
Old 06-06-2023, 11:29 AM
Laurence Finston Laurence Finston is offline
Member
 
Join Date: Sep 2021
Location: Germany
Posts: 395
Total Downloaded: 0
I wanted to try getting the fluttering effect so I wrote a little throway program in C++ for this purpose: https://laurence-finston.de/SRC_CODE/testrand.cxx.txt

The idea is to use (pseudo-) random numbers to get the effect. This is the resulting PDF file: https://laurence-finston.de/graphics/testrand.pdf

It writes TeX code to a file named `sub_testrand.tex', which is included by the file `testrand.txt'. There are several parameters which the user may set in the program. Compiling and running it causes the various images of the ladybug to be chosen randomly (within limits) and placed in random positions on the page (again, within limits). Each run of the program will produce different results.

The source code, the PDF file from a single run, and a "makefile" are available here: Laurence Finston's Website (Ladybug Test 2: Random Positions and Orientations)

I've uploaded four pages from the PDF file as JPEG files here (see below).

The C Standard Library provides the function `random', which returns an integer in the range 0 to 2^31 - 1. `random' uses a "seed" value to generate a series of pseudo-random numbers with subsequent calls to the function. Given the same seed, it will always generate the same series. If no seed is provided (using the function `srandom'), then 1 is used. Since I want different results each time, I use the integer value that represents the current time in Unix as the seed. This number is the number of seconds since the "Epoch", i.e., 1970-01-01 00:00:00 +0000 (UTC). There are other ways of getting some number that will be different each time the program is run but this one is straightforward.

I've used GIMP to make images of the ladybug rotated in increments of 45° and I've reflected each of these images about the y-axis, so there's a left-handed and right-handed version for each of the angles. 360 / 45 = 8, so I use the modulus operation, which is designated by the `%' character in C, e.g., `x = y % z', to get a random number between 0 and 7 from the potentially very large number returned by `random'. Then I multiply this number by 45 to get the angle. I then get another random number and use modulus 2 to get either a 0 or 1 and use it to determine whether to use the left- or the right-handed version of the image for the chosen angle.

For the shifting in the horizontal and vertical dimensions, I use the same procedure, whereby a limiting value can be set in each case by the user. This value is then used in the modulus operation, as above. To determine whether to shift in the positive or negative direction, I again get two more random numbers and use modulus 2 to determine the signs of the horizontal and vertical shifts.

In a non-throwaway version of the program, I would make it possible for the user to enter the parameters interactively.

In TeX, it's possible to place anything you want anywhere you want on a page using "boxes and glue" (see Knuth, The TeXbook). An important technique is the use of boxes of 0 height, width and/or depth along with "infinite glue" which can stretch or shrink as much as necessary. Such boxes make it possible to typeset items (including graphics) that, from the point of view of TeX, don't take up any space, and to overwrite material that has already been typeset.

One last point pertains to the frame with the crosshairs: Before the graphic containing it is included, this command causes it to be scaled by 0.70711: \def\epsfsize#1#2{0.70711#1}
This value is (approximately) the inverse of the square root of two, i.e., 1/(2^.5). The square root of two is the proportion of DIN A3 to DIN A4. The frame was originally for A3 and `testrand.pdf' is in A4, so I had to scale it.
Attached Thumbnails
Animation-testrand_01_low_res.jpg   Animation-testrand_11_low_res.jpg   Animation-testrand_12_low_res.jpg   Animation-testrand_25_low_res.jpg  

Last edited by Laurence Finston; 06-06-2023 at 12:24 PM.
Reply With Quote
  #12  
Old 06-07-2023, 11:40 AM
Laurence Finston Laurence Finston is offline
Member
 
Join Date: Sep 2021
Location: Germany
Posts: 395
Total Downloaded: 0
I've used GIMP to rotate the original image, and it's reflection about the y-axis, about a point chosen to be the center in increments of 18°. This was rather error-prone but I finally managed it. The next step is to add increments of 15° but before I do that, I will look at the GIMP documentation to see how I can automate the process at least somewhat.

I've made a file with all of the current rotations: https://laurence-finston.de/graphics..._rotations.pdf

It's located here, together with the source code: Laurence Finston's Website (Ladybug Rotations)

I want to use these images for a kind of choreography in the style of Busby Berkeley. I've only just started with this and it will need a lot of work: https://laurence-finston.de/graphics...g_panorama.pdf

The PDF and source code are available here: Laurence Finston's Website (Ladybug Panorama)

I've uploaded four images from the PDF file (see below).
Attached Thumbnails
Animation-ladybug_panorama_1_low_res.jpg   Animation-ladybug_panorama_2_low_res.jpg   Animation-ladybug_panorama_7_low_res.jpg   Animation-ladybug_panorama_10_low_res.jpg  

Last edited by Laurence Finston; 06-07-2023 at 11:52 AM.
Reply With Quote
  #13  
Old 06-08-2023, 05:34 AM
Laurence Finston Laurence Finston is offline
Member
 
Join Date: Sep 2021
Location: Germany
Posts: 395
Total Downloaded: 0
An apparent limitation of including the images in a TeX file via `\epsffile' is that it doesn't seem to be possible to include in such a way that their backgrounds are transparent. However, there may be a way to do this, after all. If it's not possible with dvips, the package \epsffile belongs to, it may be with PSTricks, another package for accessing the capabilities of PostScript from within a TeX file. Or there may be some other way.

However, I have found a solution using GIMP: I imported the PDF file `testrand.pdf' into GIMP. This file has a single figure placed in a "random" position within a frame. It's possible to import a multi-page PDF document into GIMP as images or as layers. In this case, I chose images. It's very easy to select the white area within the frame, clip the image to the selection and make the white area transparent. It just needs to be done for every page, which is yet another reason why I want to learn how to use macros in GIMP. I could save myself a little effort by formatting the PDF so that the frame is the border, with no white are or frame label lying outside it.

After I'd made the backgrounds of the images transparent, I combined them in a separate image, together with a watercolor background.
Attached Thumbnails
Animation-testrand-combined_low_res.jpg  

Last edited by Laurence Finston; 06-08-2023 at 05:47 AM.
Reply With Quote
  #14  
Old 06-08-2023, 07:26 AM
Laurence Finston Laurence Finston is offline
Member
 
Join Date: Sep 2021
Location: Germany
Posts: 395
Total Downloaded: 0
It turns out that it is a limitation of PostScript that makes it impossible to include images with transparent backgrounds in the PostScript or PDF files when using the epsf macros from the dvips package. However, I use dvipdfmx to convert the dvi files created by TeX to PDF and dvipdfmx supports including PNG images, including transparency. I may give this a try sometime but it would be yet another thing I'd have to learn how to do, so it's not a high priority.

Another possibility would be to use pdfTeX, which can also include PNG images including transparency, but again, I'd have to sit down and learn how to do it. I don't feel much like doing this for either package since I've been very happy with dvips. If I can learn how to automate the process at least partially, I can just take care of "flattening" the transparency in GIMP.

While trying out various things, I once again stumbled upon the interesting "psychedelic" effect I'd gotten before, but didn't know how to reproduce. I've used the term "fractal" in the name of the attached image file but only because the pattern around the figure looks a bit like colored representations of fractals. Of course, it has nothing to do with them.

I got the effect by converting a perfectly normal PNG file with a transparent background to EPS. If it were controllable, it might be an interesting effect to use for something.
Attached Thumbnails
Animation-ladybug3_rotated_000_fractal_low_res.jpg  

Last edited by Laurence Finston; 06-08-2023 at 07:50 AM.
Reply With Quote
  #15  
Old 06-08-2023, 10:20 AM
Laurence Finston Laurence Finston is offline
Member
 
Join Date: Sep 2021
Location: Germany
Posts: 395
Total Downloaded: 0
Ideally, I would work with line drawings in black and white or drawings with areas of distinct color with no antialiasing in GIMP and do the coloring afterwards. However, with existing drawings that were done without any thought of processing them digitally that's obviously not possible.

One problem with processing the images I have is that colored areas using colors like the red in the ladybug's wings or the purple background for the snowflakes is that these areas contain pixels of all kinds of colors. Also, outlines done in pencil will contain different shades of gray and probably pixels of other colors, too. That makes it difficult to make the background transparent, because selecting a color to change to transparency will also affect pixels within the figures.

In the case of the ladybugs, it is however easy to select the area of white pixels around the figure by using the "fuzzy select" tool, which apparently only selects contiguous pixels or at least ones that are close to each other. I'll have to look this up. Inverting the selection to select the figure instead makes it possible to color the entire area black (or some other color). I do this in a separate layer which may then be used as a mask. It's no problem to exchange the colors black and white for other colors or to make one transparent.

I also made a separate xcf file (xcf is GIMP's native format) with layers containing various backgrounds, scaled and made the same size as the ladybug images. I can now load this file into the individual ladybug files and chose which to display, if any. The second image shows a gouache background while the others are watercolor.

The problem with all of this is that it is an immense amount of work for one person. If you look at the credits for a feature-length animated film, they are usually very long. I think there could easily be a couple of hundred people working on them. I sometimes watch animations made by students at art schools that teach animation on YouTube, which are about 5 to 10 min. long and even the credits for those animations list quite a few people, maybe a dozen or two. The only way I'll be able to produce even a few seconds of animation is to find some way to automate the process as much as possible. I'm not even thinking about minutes.

Even after all these years, there have been very few if any people who have matched what Winsor McCay, who made some of the earliest animated films, accomplished by himself or with a couple of assistants. However, even in my most delusional moments I don't imagine I can draw like Winsor McCay.
Attached Thumbnails
Animation-ladybug3_rotated_090_mask_low_res.jpg   Animation-ladybug3_rotated_000_reflected_with_orange_background_low_res.jpg   Animation-ladybug3_rotated_045_mauve_background_low_res.jpg   Animation-ladybug3_rotated_045_reflected_english_red_background_low_res.jpg   Animation-ladybug3_rotated_000_mixed_background_low_res.jpg  


Last edited by Laurence Finston; 06-08-2023 at 10:44 AM.
Reply With Quote
Google Adsense
  #16  
Old 06-09-2023, 05:08 AM
Laurence Finston Laurence Finston is offline
Member
 
Join Date: Sep 2021
Location: Germany
Posts: 395
Total Downloaded: 0
Last night I took a black and white print-out of the ladybug drawing and used my light table to trace the outlines. I didn't think to use better drawing paper that would erase well but used ordinary sketch paper instead. After tracing, I cleaned up the trace as best I could and inked it using a 0.7mm technical pen. I scanned the inked trace and cleaned up the worst of the smudges in GIMP.

The ink from the technical pen is sufficiently black so that it selects well in GIMP. I will keep this drawing for reference and print it out for use in making cut-outs.
Attached Thumbnails
Animation-ascf0006.jpg   Animation-ascf0003.jpg   Animation-ascf0004.jpg   Animation-ascf0005.jpg   Animation-ascf0007.jpg  

Animation-ascf0008.jpg   Animation-ascf0010.jpg   Animation-ladybug_outline_low_res.jpg  
Reply With Quote
  #17  
Old 06-10-2023, 09:26 AM
Laurence Finston Laurence Finston is offline
Member
 
Join Date: Sep 2021
Location: Germany
Posts: 395
Total Downloaded: 0
I now have rotations of the ladybug figure in increments of 15°, 18° and 22.5°, in the original form and reflected about the y-axis. I was going to upload a PDF file containing all the images to my website, but it was nearly 60 MB and compressing it hardly did any good, so I decided not to.

The first seven attached images show another figure from my "Midsummer Night's Dream" project. In the original, the drawing went off the paper and I always planned to transfer it to a bigger piece and complete it. I used a scan and I could easily have added crosshairs using MetaPost and TeX, but I didn't think of it, so I just did them by hand. I then did some more crosshairs on a piece of DIN A3 paper. I taped the frog to the larger paper at the top edge with drafting tape and pasted the rest of it. The paste is dry, so when I get around to it, I'll remove the tape and paste all of the edges.

The third-to-last photo shows the pieces I cut out for making a paper puppet out of the frog drawing. The second-to-last picture shows the same thing for the snowflakes from my "Nutcracker" project. The last photo belongs with the frog photos; I forgot to upload it.
Attached Thumbnails
Animation-dscf0002.jpg   Animation-dscf0003.jpg   Animation-dscf0001.jpg   Animation-dscf0006.jpg   Animation-dscf0009.jpg  

Animation-dscf0010.jpg   Animation-dscf0011.jpg   Animation-snowflakes_1_cutouts_1.jpg   Animation-dscf0008.jpg  

Last edited by Laurence Finston; 06-10-2023 at 09:37 AM.
Reply With Quote
  #18  
Old 06-10-2023, 03:15 PM
Laurence Finston Laurence Finston is offline
Member
 
Join Date: Sep 2021
Location: Germany
Posts: 395
Total Downloaded: 0
The second image is an example of compositing foreground figures with a perspective drawing as a background for the ground or floor, in this case, and a backdrop for the upper part of the background, in this case, a monochrome watercolor.

The first image is the original drawing, cropped in the horizontal dimension. In the vertical dimension, it went off the paper at the bottom. This drawing demonstrates how I did most if not all of the others that I've been uploading here. I stopped at the stage before coloring, i.e., I made a sketch in pencil, cleaned it up by erasing and redrawing and then inked the final lines with a technical pen.

The 3DLDF code for the perspective drawing is in the attached file `theseus_and_hippolyta.ldf.txt'. It obviously needs work, but I think it's successful as a proof of concept.
Attached Thumbnails
Animation-thship1_cropped_low_res.jpg   Animation-theseus_and_hippolyta1_low_res.jpg  
Attached Files
File Type: txt theseus_and_hippolyta1.ldf.txt (5.0 KB, 1 views)

Last edited by Laurence Finston; 06-10-2023 at 03:26 PM.
Reply With Quote
  #19  
Old 06-11-2023, 07:38 AM
Laurence Finston Laurence Finston is offline
Member
 
Join Date: Sep 2021
Location: Germany
Posts: 395
Total Downloaded: 0
These are some drawings I did in 2002. They are illustrations for Kafka's "A Hunger Artist". I did them without any thought of the practicality of the size, they are on DIN A2 paper (42 x 59.4cm). I did them partially by hand using millimeter paper and partially on the computer using AutoCAD. I did the sign for the theater by hand, including every little circle with a compass I bought for the purpose and still have.

I traced all of it onto tracing paper and transferred it to watercolor paper. The facade is watercolor and the sign is drawing ink. It was very painstaking work.

I'm glad these methods are obsolete but back in the day it was still normal.

The second to last photo shows a failed attempt. First of all, the paper is ordinary printer paper and didn't take the watercolor well and secondly I messed up the windows and tried to correct my mistake. That doesn't work with watercolor; you get one chance and that's it.
Attached Thumbnails
Animation-dscf0001.jpg   Animation-dscf0005.jpg   Animation-dscf0007.jpg   Animation-dscf0008.jpg   Animation-dscf0011.jpg  

Animation-dscf0013.jpg  
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 07:40 AM.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.

Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)
Copyright © 2007-2023, PaperModelers.com