Anaglyph 3d via George?

To talk about anything else
Post Reply
User avatar
CartoonMonkey
Posts: 1087
Joined: 01 Jun 2007, 18:47
Location: Portland, Oregon
Contact:

Anaglyph 3d via George?

Post by CartoonMonkey »

Can someone good with George scripting help me with a script?
I'd like to use the freehand select tool to highlight a bit of artwork, and then press a button on a custom panel that would:
anaglyph.jpg
1: cut this selection to a new layer and turn the image from it's original color (black line work) to red, and then set multiply mode for that layer.
2: a second layer is created containing the same content, except it is cyan colored, and offset 50 pixels to the right. (You may see where I'm going with this).

Essentially, a way to create multiple levels of depth from one image, for anaglyph red / blue (cyan) 3d glasses.

I'd like to explore doing some 3d comics, and TVPaint is such a wonderful tool, it'd be my weapon of choice for creating high resolution print quality copies of my 3d images. I think I know how I'd go about it in Photoshop, but I'd rather avoid Adobe at all costs. :-D

Inspired by this amazing book. Some of the best 3d conversion ever done in the history of comics! Check it out: https://www.lambiek.net/shop/series/fra ... nsion.html
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: Anaglyph 3d via George?

Post by Svengali »

cool idea.

At first glance it would seem easiest for the artist to draw original frame's content by placing different Z dimensional, depth object/elements on different layers, then automating the separation process in which each layer would be individually redrawn, based on a list of numbers representing the Red offset (positive to zero to negative?) then inverting each number representing the cyan offset. The layer's red version and green version would be stamped on a new layer and the original black line layer would be turned off.

The deepness of the space could be easily adjusted by tweaking the table's number intervals and reprocessing all the layers in the drawing.

Properly written, I could see a fairly simple menu-driven George script that could include an option to process a whole clip of layered image/frames - with a single click. resulting in a 3D animation.

sven

Woodring... :D
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
User avatar
Peter Wassink
Posts: 4436
Joined: 17 Feb 2006, 15:38
Location: Amsterdam
Contact:

Re: Anaglyph 3d via George?

Post by Peter Wassink »

To color the content of a layer cyan/red you can use this function: https://forum.tvpaint.com/viewtopic.php ... ey#p133187
so you'd be able to do it with just actions.

You could also try the FXstack route...
Peter Wassink - 2D animator
• PC: Win11/64 Pro - AMD Ryzen 9 5900X 12-Core - 64Gb RAM
• laptop: Win10/64 Pro - i7-4600@2.1 GHz - 16Gb RAM
User avatar
Thierry
Site Admin
Posts: 2780
Joined: 07 Jan 2013, 08:28

Re: Anaglyph 3d via George?

Post by Thierry »

Hmm...
There are George functions that can cut a selection to a new layer (tv_SelectionMask "action" "cut2layer"), set a specific blending mode (tv_LayerBlendingMode newLayer multiply), duplicate a layer (tv_LayerDuplicate newLayer), so that's a start.
Changing color from the original image is likely the trickiest part, but I think Peter's solution would be the best.

Chad, what are the RGB values you wish to use for the red & blue, {255,0,0} and {0,0,255} ?
If I had a bit of time on my hands I think I could throw a script that does it.
User avatar
CartoonMonkey
Posts: 1087
Joined: 01 Jun 2007, 18:47
Location: Portland, Oregon
Contact:

Re: Anaglyph 3d via George?

Post by CartoonMonkey »

Hey Thierry!
That would be amazing if you can help! Yeah, it would be nice to have a tool where you select part of an image with the lasso selection tool, press a toolbar button, and it give you a popup, asking a numeric value to send the artwork to in "space". -200 or +200... -10 or +10... and the image is placed on two separate layers using that offset, one in red, one in blue (cyan), with the layer on top set to multiply mode. Positive values would make the red or blue closer together or farther apart on the x axis. Something like the attached image:
anaglyph-3d-text-effect-photoshop.png
anaglyph-3d-text-effect-photoshop.png (43.34 KiB) Viewed 9934 times
They would be:

Red - rgb(255, 0, 0)
Blue - rgb(0, 0, 255)
Green - rgb (0, 255, 0)

Additionally you can do complimentary colors:

Cyan - rgb(0, 255, 255)
Yellow - rgb(255, 255, 0)
Magenta - rgb(255, 0, 255)
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: Anaglyph 3d via George?

Post by Svengali »

The anaglyph clip-on lenses I ordered yesterday arrived, so I decided to experiment with a simple, manually-assembled test to see if I could isolate some of the basic issues before attempting to automate the 3D process.

I started with a simple drawing of a white, donut-shaped object outlined in black and a bit of simple shading and prepared it the following way:
1. The area outside the donut (and inside the hole) is alpha transparent)
2. I made a copy frame and turned all pixels white.
3. I made another copy and ran the basic scan cleaner on it so that only the black pixels remain.
4. I setup 4 layers, two containing the black pixel version, and two below that with the solid white copy (any black /gray pixels also white.)
5. I shifted the first layer left (4 pixels) and turned all black pixels to red (255, 0, 0) and changed layer blending mode to multiply.
6. I shifted the second layer right (4 pixels) and turned all black pixels to cyan (0, 255,255) and changed layer blending mode to multiply.
7. I shifted the third layer left (4 pixels). The blending mode remained color.
8. I shifted the bottom layer right (4 pixels).The blending mode also remained color.
9. I tried out different background colors and felt that a white background worked best (I think Woodring's cover drawing environment is conceived of as white.)

When I look at the result through the anaglyphic glasses, to my eyes, the original central donut sits noticeably BACK into the framed space.

I wanted to test if, when the red and cyan shift were reversed, the donut would project differently. To save time, I just grabbed the original red/cyan donut, flipped it horizontally and stamped it four times around the center donut.

To my eyes, the four flipped donuts sit noticeably FORWARD out of the framed space.

With this limited experiment I've concluded the best drawn objects for this process are black and white (and gray). I also had best results when the background was white.

Here is the image:
RED-CYAN test image.png
RED-CYAN test image.png (58.46 KiB) Viewed 9894 times
When I have time I'll try to write and post an easy-to-use, basic script that automates the manual steps I described above. Hope someone finds this info useful.

sven
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
User avatar
CartoonMonkey
Posts: 1087
Joined: 01 Jun 2007, 18:47
Location: Portland, Oregon
Contact:

Re: Anaglyph 3d via George?

Post by CartoonMonkey »

This is fantastic Sven! (I have the same clip on / flip up 3d glasses ) -We may see an influx of people interested in TVPaint who do anaglyph 3d conversion in the future. Exciting!

Here's one I did manually. It gets tough when you have to re-draw or erase portions of the drawings when things overlap. On the main character here I used the warp in the FX stack to bend the body of the creature outward in a slight sphere by moving several points in the center to the left on the top red drawing. Sort of works.. not very well. (Hey, I'm an amature at 3d conversion. Although I did once take a class from the legendary Ray Zone, rest in peace.) I can't imagine the amount of work Charles Barnard did on the Jim Woodring book to achieve what he did. It's an incredible achievement.
anaglyph-2.jpg
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: Anaglyph 3d via George?

Post by Svengali »

Yes, My clip-on, flip-up Anaglyph Milisten lenses came overnight from Amazon, $5.00 for three sets. Pretty good quality and the color of the lenses seem almost perfect.

Your drawing works quite well for me. Using a warp effect on the object volume is something I never considered. It suggests to me that it might also be possible to tilt and skew between an object's red/cyan components and their white backgrounds in slightly different directions so as to permit a single object to appear to project or recede in Z space. Will have try that.

In my thinking, creating elements of a drawing on different layers (or pre-separating the objects in an existing drawing onto multi-layers (restoring their occluded parts) could make iterative tweaking of the 3D much easier in a script that automates the process... AND would definitely lend itself to multiframe animation where layers of the drawing move above/below each other or an individual object moves forward and/or back in the space.

At the moment my timing is jammed up because we are leaving Friday on a two week vacation. Time permitting I will post a bare-bones script that could be used for automating the red/cyan process. We'll see.

Thanks so much for starting this topic. It dovetails nicely to some other things I am doing in my personal TVPaint animation experiments.

sven

Update Friday Morning 6:30 AM - Just a quick update... after starting work on the script we ran out of time before having to get to the airport. I'll post a working version of the RED/CYAN conversion script after we get back! Sorry

And by the way, for those who have received the anaglyph glasses... Check out Youtube for Anaglyph posts, there are some interesting live=action videos to be found!


sven
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
Post Reply