Script Idea - Make Box

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
bupaje
Posts: 1175
Joined: Fri Nov 12, 2004 5:44 pm
Location: California
Contact:

Script Idea - Make Box

Post by bupaje »

Hi I posted this in the feature requests but figure I'd mention it here in case anyone is up to it. What I think might be cool is a script that after I create six layers or groups and name them

sky
north
south
east
west
ground

and could take this and run the script to automatically position them in a cube -like making a skybox in some 3D programs. This way you can draw your layers and then quickly turn this into a 3D space to walk around.

I was doing the 3D tutorial and eagerly went to try and convert my fish animation to 3D and am finding it difficult to rotate and line up the layers perfectly so a script that could speed this up would be great.
User avatar
7feet
Posts: 840
Joined: Wed Aug 04, 2004 5:45 am
Location: L.I., New Yawk.
Contact:

Post by 7feet »

In my oh so humble opinion, this one isn't really all that good for scripting. The problem is to define a box that's the right size, and a lot of Moho's internal numbers often don't seem to relate to each other directly. So I think it would be better to have a few Moho Objects, of various sizes, that you could import. I can whip up a few of those.

The biggest problem I see (for myself) in this is that Moho doesn't have a way to scale groups in 3d space, and that would have to be written. I'm feeling a little math impaired at the moment, so at least from me it'll have to wait, but it would be handy.

Another option is to map your background onto a box, or better yet a sphere, in a 3D app. If you import the 3D OBJ and can see the texture on the outside of the object, you can go to the Layer Properties>3D Options and switch from the Clockwise to Counter-clockwise polygon orientation (or the other way around, whichever) and when you scale the 3d layer to encompass your whole lil' Moho world ( so you're inside the 3D object, if I'm not being clear), you'll see the texture on the inside of the object, and that should do the trick. I'd be doing it this way but I still feel dumb as a doorknob when it comes to most 3D programs.

Another option is to make a 3D box in Moho made up of image layers. I could whip up some templates for that too, based on a particular image size. That would also let you do the basic images in Moho and use renders for each section so you could "bake" all the layer and object effects and not have add them to your overall render time.

Well, maybe a script wouldn't be so hard, I'll look at it tommorow, But a template object is easier. I'll whip one up, you can see if it fits the bill.

--Brian
User avatar
Barry Baker
Posts: 342
Joined: Fri Aug 27, 2004 6:58 am
Location: UK
Contact:

Post by Barry Baker »

7feet wrote:The biggest problem I see (for myself) in this is that Moho doesn't have a way to scale groups in 3d space
But if I scale a group, surely it scales in Z as well as X & Y? Seems to work anyway...
7feet wrote:Another option is to map your background onto a box, or better yet a sphere, in a 3D app. If you import the 3D OBJ and can see the texture on the outside of the object, you can go to the Layer Properties>3D Options and switch from the Clockwise to Counter-clockwise polygon orientation (or the other way around, whichever) and when you scale the 3d layer to encompass your whole lil' Moho world ( so you're inside the 3D object, if I'm not being clear), you'll see the texture on the inside of the object, and that should do the trick. I'd be doing it this way but I still feel dumb as a doorknob when it comes to most 3D programs.
That's a neat idea! Gile[s] has an option to render a "world cube" but I haven't actually tried this yet. To create a sphere would be more difficult to texture, I think, as you'd need a 360deg spherical panorama picture to map onto it. It can be done in the panorama software that comes with most digital cameras, but you need a series of views to create the panorama. Easy with photos, but not so easy to draw.
7feet wrote:Another option is to make a 3D box in Moho made up of image layers. I could whip up some templates for that too, based on a particular image size. That would also let you do the basic images in Moho and use renders for each section so you could "bake" all the layer and object effects and not have add them to your overall render time.
I'm working on a piece that takes place within a room, and I have done exactly this (at least, the first part - making a cube up from Moho layers). I have made groups for each wall within which I have several vector and image layers for wall, textures, furniture etc. Then I have rotated the groups in 3D space to position them arouind my stage area.
User avatar
7feet
Posts: 840
Joined: Wed Aug 04, 2004 5:45 am
Location: L.I., New Yawk.
Contact:

Post by 7feet »

Uhhh - well, I usually try to check if I really know what I'm talking about before I write something. I seemed to remember some wierdness with scaling vector layers in 3D space, but it sure isn't there now.

Dang, I was just about to put up a skybox template, but my server seems to be kayoed again. Maybe a little later. I also just ran into the rendering madness I saw you just put up a bug report on, Barry. Eek.

--Brian
User avatar
bupaje
Posts: 1175
Joined: Fri Nov 12, 2004 5:44 pm
Location: California
Contact:

Post by bupaje »

Thanks for the suggestions and sample offer! I'm going to poke around at the different methods and will check out your sample when available. :)

I could probably render and apply the textures in a 3D program as you suggest and import the object as you suggest but it would be nice to do it the other way as you could animate the different vector elements and if needed hide the other sides and only make them visible as they come into view of the camera and I have some other half formed thoughts floating around as well. I was actually trying to make a basic shape and then reuse it but lining it up is hard and also working on each layer already in a cube would mean constantly changing the camera view etc. Seems like it might be easier to work on them the 'regular' way and then form the cube but any step to simplify is very welcome -thanks for your efforts and willingness to help. :)
User avatar
Barry Baker
Posts: 342
Joined: Fri Aug 27, 2004 6:58 am
Location: UK
Contact:

Post by Barry Baker »

bupaje wrote:...and also working on each layer already in a cube would mean constantly changing the camera view etc. Seems like it might be easier to work on them the 'regular' way and then form the cube
There are two ways that I can think of to make this easier.

1) You work on your layers flat on frame zero, and only form the cube on frame 1 of your animation - that way you can still go back and work on everything flat at any time.

2) Each face of your cube is a group layer containing the various vector and image layers that make it up. You only rotate and position the groups (with the basic rectangles inside them) into the cube shape. You can work on any new vector layers flat and add them to whichever group you want. If you need to tweak any layer, you just drag that layer temporarily out of the group and work on it flat.
User avatar
7feet
Posts: 840
Joined: Wed Aug 04, 2004 5:45 am
Location: L.I., New Yawk.
Contact:

Post by 7feet »

Gotten a bit off of scripting, but it happens. Made up 2 files, one is the basic template, the other I threw in a few cheesy clouds and a ground field so you could see how it works.

SkyBox.zip

I went about it slightly differently than Barry's tack. First, I made the mask layers, and rotated and translated the layers to where I wanted them on Frame Zero. Then I dropped them each into a group layer, duplicated the mask layer and cleared it out of the masking object to make a drawing layer with the same 3D position as the mask layer. Then I set up the masking.

So now you have a 3D cube (this one is pretty big, about a thousand "units" in each dimension) that, when you choose one of the "drawing" layers you can scribble on it in 3D with impunity, and not have to worry about staying within the lines. That makes it pretty easy to make shapes that go from one side of the box onto another. I was using the Orbit Camera tool to get to where I could see the side I wanted to draw on (no need to be facing it dead on), select that layer, and draw away. If you think you need them, make a few duplicates of the drawing layer before you start to give you a little more flexibility.

Another thing I just tried was nesting these boxes. I imported another copy of the box, scaled it a little smaller, and drew some mountains on it. Then I animated the cloud box to rotate, and then flew the camera around a bit. Clouds move, you can do a full 360 degree spin, and there's some nice parallax bits between the mountains and clouds as you move. I imagine you could do as many series of nesting as you've got the patience for. You might have to watch out and make sure the scale of each iteration is enough larger than the previous one that you don't get strange things happening as far as layers shuffling about as you rotate box groups and layer origins of outer layers may get closer to the camera than some inner ones.

The file has the camera moved to be dead in the middle of the box. Figured it was a decent place to start. I also have no idea how layer effects are going to look going from one side of the box to another, but I'm sure we'll find out. Have fun.

--Brian
Last edited by 7feet on Fri Dec 03, 2004 1:10 pm, edited 1 time in total.
User avatar
bupaje
Posts: 1175
Joined: Fri Nov 12, 2004 5:44 pm
Location: California
Contact:

Post by bupaje »

Thanks! I'll be home in another four hours and will check out the sample and the ideas presented. Really appreciate the interaction on this forum.
User avatar
bupaje
Posts: 1175
Joined: Fri Nov 12, 2004 5:44 pm
Location: California
Contact:

Post by bupaje »

You get an extra thank you. I'm trying this now and really appreciate the work you put into it.

I have to apologize but since I'm still very new I'm trying to understand if I should draw on the layers labeled 'South' for example or the 'South Mask' still so green I'm not sure.
Max Power
Posts: 46
Joined: Sat Nov 27, 2004 2:35 am
Location: Tampa Fl
Contact:

Post by Max Power »

I'm a noob to Moho and was having a similar prob as this thread.
7feet I got to say i think your sky box was the perfect solution. My characters are appliances so they are "stuck" in the same room every episode. I think I can just draw the kitchen into the box and import the characters into their proper position as needed. Then the camera moves should result in my 2d guys living in a believable 3d space without unwanted distortion maybe only needing a second top version of my scenes.

If I'm off base please let me know. 7feet, it seemed that you intended this to be a template for all to work with, if not its still a great learning tool.

Max Power
User avatar
7feet
Posts: 840
Joined: Wed Aug 04, 2004 5:45 am
Location: L.I., New Yawk.
Contact:

Post by 7feet »

Max-

Use it at will, that's what it's for. Anything I do in this happy lil' forum is for public consumption, and if for some reason I don't want it to be, I'll say it explicitly. Put your own flavor on it.

You should also check out this topic:

http://www.lostmarble.com/forum/viewtopic.php?t=258

In that one, pay attention to the parts about Layer Origins. It's a fundamental part of using Vector layers in 3D in Moho. Like building rooms for yer characters.

--Brian
Max Power
Posts: 46
Joined: Sat Nov 27, 2004 2:35 am
Location: Tampa Fl
Contact:

Post by Max Power »

thanks man I have been looking at the door in 3d room thread as well. Its great that when I run into a brick wall, some one else has already had that problem and addressed it here on this forum.
When I get my project in a more complete form I will be sure to post it here to get feedback from everyone from my rigging to timing to content.

Thanks again,
Max Power

Audio expert/ Moho Noob
Post Reply