Jump to content


Simple animations using LDD


  • Please log in to reply
15 replies to this topic

#1 JopieK

JopieK

  • Kneecap Buster


    Posts: 2412
    Joined: 04-January 07
    Member: 1180
    Country: Netherlands

Posted 17 August 2010 - 03:40 PM

EDIT by regulator: I thought this was such an intersting idea, that I made a new topic out of it. Hope that was OK.

View PostRalph_S, on 17 August 2010 - 03:33 PM, said:

Using it for backgrounds for stop-motion video is an application I never considered, but it makes sense. It's easier to move a model on the computer over a small and properly defined distance than it is to do the same with a physical model. No doubt about it.

Especially the CMD-K (ctrl+K on windows?!) option is very handy... It is not very difficult to make animations in that way:
Posted Image

Here you can see the scene it is used in: BlocksWorld  (not yet finished and also not totally IE proof, but gives a good idea)

New Member? Read This | Questions? Need Help?Ask Here
Site Guidelines | Eurobricks FAQ | Visual User Guide


Posted Image

-== Classic LEGO trains are the best ==-

Do you need replacement stickers for LEGO (reproductions and customs): ministickers.nl

What then about the LEGuanO?!


#2 private_lego

private_lego

    Posts: 89
    Joined: 12-June 10
    Member: 11437
    Country: Belgium

Posted 17 August 2010 - 05:57 PM

It would be nice to be able to use animations like in Povray or Blender.
As far as I know, there are no programs to create a povray file out of a LXF.
The only way now is by using LDraw as converter. But then some bricks are missing.

Stop motion is nice, but take a lot of time. Complex movements are very difficult to create.

#3 JopieK

JopieK

  • Kneecap Buster


    Posts: 2412
    Joined: 04-January 07
    Member: 1180
    Country: Netherlands

Posted 17 August 2010 - 06:59 PM

Well, that is true, I was also hoping to be able to go from LDD to Blender or so. I noticed that LEGO has a special render application because the "Design By ME" box is definitely rendered using raytracing etc.

If one wants too look inside that virtual environment (not working in some IE version according to my girlfriend):

eurobricks / eurobricks is a valid username / login

I already came up with this idea quite some time ago. It will be a mix of an adventure (like monkey island), some contemporary internet games and a collaborative or complex learning environment. I will let students (and in future maybe also other teachers) develop part of it. Subjects like basic math, counting money, information retrieval and language learning will be among the subjects taught in the environment. Factors like fun and motivation will be a very important part. Hope you enjoy the basics already ;)

BlocksWorld

New Member? Read This | Questions? Need Help?Ask Here
Site Guidelines | Eurobricks FAQ | Visual User Guide


Posted Image

-== Classic LEGO trains are the best ==-

Do you need replacement stickers for LEGO (reproductions and customs): ministickers.nl

What then about the LEGuanO?!


#4 Superkalle

Superkalle

    Posts: 5634
    Joined: 21-December 08
    Member: 4755
    Country: Sweden

Posted 17 August 2010 - 07:29 PM

A simple, crude idea for controlling/generating animations would be small program that produces animation frames. This is how far I've come in my reasoning:

Input would be: Model (as LXF-file) together with a list of the elements that should be manipulated and how (rotation/postion change direction). Could also be the camera for a simple case.

Algorithm:
1. Open/Parse LXF
2. Make small change in position of defined elements
3. Save file
4. Open in LDD, take screenshot
Loop


The LXF-format is pretty straight forward XML-based format. Bascially a typical post looks like this:
	  <Part refID="0" designID="3700" materials="21">
		<Bone refID="0" transformation="1.0000001192092896,0.00076067680492997169,0,-0.00076067680492997169,1.0000001192092896,0,0,0,0.99999994039535522,0.00044196844100952148,0.95969939231872559,2.4890007972717285">
		</Bone>
	  </Part>
On the first row is the DesignID (basically the mold) and then materials (i.e. color)
On the next row we have the postion/rotation matrix, 9+3 positions
Position 1 through 9: x, z, y axis orientation of element
Position 10 to 12: Position of brick in space relative origo

So basically, a program would have to perform some tranformation operations to the position values, output a LXF-file, open the file in LXF, use SendKeys to take a screenshot, and so on.

I've managed to figure out that for a simple brick being rotated around one of the axis, it's basically only some Sin(X) operations needed.

I'd love to give it a go myself, but I feel it's stretching my competence a bit too much  :tongue:

If anyone feels like having a go, I have some more info that could be useful (and so does LDD Tech guru Bojan).
Eurobricks Digital Design Forum - for all your LDD and Ldraw cravings

#5 JopieK

JopieK

  • Kneecap Buster


    Posts: 2412
    Joined: 04-January 07
    Member: 1180
    Country: Netherlands

Posted 17 August 2010 - 10:50 PM

Well, I would be very eager to hear it. Using your tips I should also make an application that can do this but I'm not too good a Mac programmer, maybe in Java then (or in C# under windows but I don't like windows).

New Member? Read This | Questions? Need Help?Ask Here
Site Guidelines | Eurobricks FAQ | Visual User Guide


Posted Image

-== Classic LEGO trains are the best ==-

Do you need replacement stickers for LEGO (reproductions and customs): ministickers.nl

What then about the LEGuanO?!


#6 Superkalle

Superkalle

    Posts: 5634
    Joined: 21-December 08
    Member: 4755
    Country: Sweden

Posted 18 August 2010 - 08:24 AM

View PostJopieK, on 17 August 2010 - 10:50 PM, said:

Well, I would be very eager to hear it. Using your tips I should also make an application that can do this but I'm not too good a Mac programmer, maybe in Java then (or in C# under windows but I don't like windows).
Perhaps I was  unclear. With "more info" I meant that if there are some questions, I may have a few tips. However, the basic info how to get started is mentioned in the first post.

Can you perhaps start yourself to analyze and get familiar with the LXF-format, create some ideas, and do a simple LXF-creator, and then get back with specific questions?

May I propose Windows, since it's the most common platform.
Eurobricks Digital Design Forum - for all your LDD and Ldraw cravings

#7 JopieK

JopieK

  • Kneecap Buster


    Posts: 2412
    Joined: 04-January 07
    Member: 1180
    Country: Netherlands

Posted 18 August 2010 - 08:49 AM

Well, first of all, lxf seems to be a binary format file. I can export the XML in LDD of course, but is there any info on how the lxf is built?!

New Member? Read This | Questions? Need Help?Ask Here
Site Guidelines | Eurobricks FAQ | Visual User Guide


Posted Image

-== Classic LEGO trains are the best ==-

Do you need replacement stickers for LEGO (reproductions and customs): ministickers.nl

What then about the LEGuanO?!


#8 Superkalle

Superkalle

    Posts: 5634
    Joined: 21-December 08
    Member: 4755
    Country: Sweden

Posted 18 August 2010 - 08:58 AM

View PostJopieK, on 18 August 2010 - 08:49 AM, said:

Well, first of all, lxf seems to be a binary format file. I can export the XML in LDD of course, but is there any info on how the lxf is built?!
A LXF-file is actually a simple zip-file. Use winzip to unzip and you'll find two files, a PNG thumbnail and the XML-file (text). The specification for the file structure can be found here.
Eurobricks Digital Design Forum - for all your LDD and Ldraw cravings

#9 JopieK

JopieK

  • Kneecap Buster


    Posts: 2412
    Joined: 04-January 07
    Member: 1180
    Country: Netherlands

Posted 18 August 2010 - 09:15 AM

View PostSuperkalle, on 18 August 2010 - 08:58 AM, said:

A LXF-file is actually a simple zip-file. Use winzip to unzip and you'll find two files, a PNG thumbnail and the XML-file (text). The specification for the file structure can be found here.


Well there are more elegant ways then to unzip the file. What we first need is then an unzip algorithm and an XML parser. The only thing is that I'm not too good at graphical programming, that would be the ideal solution. An alternative might be to 'hack' into the existing interface of LDD by using keyhooks.

New Member? Read This | Questions? Need Help?Ask Here
Site Guidelines | Eurobricks FAQ | Visual User Guide


Posted Image

-== Classic LEGO trains are the best ==-

Do you need replacement stickers for LEGO (reproductions and customs): ministickers.nl

What then about the LEGuanO?!


#10 private_lego

private_lego

    Posts: 89
    Joined: 12-June 10
    Member: 11437
    Country: Belgium

Posted 18 August 2010 - 10:38 AM

View PostSuperkalle, on 17 August 2010 - 07:29 PM, said:

A simple, crude idea for controlling/generating animations would be small program that produces animation frames. This is how far I've come in my reasoning:

Input would be: Model (as LXF-file) together with a list of the elements that should be manipulated and how (rotation/postion change direction). Could also be the camera for a simple case.

Algorithm:
1. Open/Parse LXF
2. Make small change in position of defined elements
3. Save file
4. Open in LDD, take screenshot
Loop


The LXF-format is pretty straight forward XML-based format. Bascially a typical post looks like this:
	  <Part refID="0" designID="3700" materials="21">
		<Bone refID="0" transformation="1.0000001192092896,0.00076067680492997169,0,-0.00076067680492997169,1.0000001192092896,0,0,0,0.99999994039535522,0.00044196844100952148,0.95969939231872559,2.4890007972717285">
		</Bone>
	  </Part>
On the first row is the DesignID (basically the mold) and then materials (i.e. color)
On the next row we have the postion/rotation matrix, 9+3 positions
Position 1 through 9: x, z, y axis orientation of element
Position 10 to 12: Position of brick in space relative origo

So basically, a program would have to perform some tranformation operations to the position values, output a LXF-file, open the file in LXF, use SendKeys to take a screenshot, and so on.

I've managed to figure out that for a simple brick being rotated around one of the axis, it's basically only some Sin(X) operations needed.

I'd love to give it a go myself, but I feel it's stretching my competence a bit too much  :tongue:

If anyone feels like having a go, I have some more info that could be useful (and so does LDD Tech guru Bojan).

This is possible, using en excel to calculate all the parameters and manual bring them to the file, step by step.
In povray you can define your formula and let the program do the calculations.
I have made a movie a few years ago, with a college, and several computer where rendering for days.
With 15 frames per second, you can make 1 second worth of animation in 1 hour or so in LDD. A 10 minute movie would take 600 hours ?!.
And there is no option for background, lightning and scenes with several movements together.

#11 Superkalle

Superkalle

    Posts: 5634
    Joined: 21-December 08
    Member: 4755
    Country: Sweden

Posted 18 August 2010 - 11:46 AM

View Postprivate_lego, on 18 August 2010 - 10:38 AM, said:

This is possible, using en excel to calculate all the parameters and manual bring them to the file, step by step.
In povray you can define your formula and let the program do the calculations.
I have made a movie a few years ago, with a college, and several computer where rendering for days.
With 15 frames per second, you can make 1 second worth of animation in 1 hour or so in LDD. A 10 minute movie would take 600 hours ?!.
And there is no option for background, lightning and scenes with several movements together.
It should be automatic, otherwise its not going to be practical. And I was thinking of small animations scenes for fun - not entire movies :tongue:

The idea is that you build a model in LDD, then define which parts should rotate/move (could for example be a propeller), or wheels rotating, or something simple. Then just start the "animation" program, select LXF-file, click Go and you would get about 1 frames (i.e. PNGs) per 5 seconds. These could be made into an AVI or GIF. So it's only for smaller stuff/animations, maybe like 15 seconds long (which would take about 15 minutes).

View PostJopieK, on 18 August 2010 - 09:15 AM, said:

Well there are more elegant ways then to unzip the file. What we first need is then an unzip algorithm and an XML parser. The only thing is that I'm not too good at graphical programming, that would be the ideal solution. An alternative might be to 'hack' into the existing interface of LDD by using keyhooks.
Why would you need graphical programming? This is only a matter of performing some translation matrix operations, output some XML-code (i.e. LXF)-file etc, open the file in LDD, take a screenshot (SendKeys) etc. It's a crude method, I know, but it's all for fun and for shorter animation.
Eurobricks Digital Design Forum - for all your LDD and Ldraw cravings

#12 JopieK

JopieK

  • Kneecap Buster


    Posts: 2412
    Joined: 04-January 07
    Member: 1180
    Country: Netherlands

Posted 18 August 2010 - 01:19 PM

You don't need graphical programming, using windows messages would also be nice already, but still, it doesn't give you a lot of feedback of course. I'm not sue wether that is possible, but maybe it could even become a photoshop plugin. Problem with windows is that the applications are not normally scriptable. In Mac OS most applications are so no real programming (just Applescript) is required although I don't think this is usable with LDD for Mac (but didn't look into it so it is a wild guess). In fact looking at havok.com it might be that LDD is just an application built around the havok.com tools:

http://www.havok.com...ral-information

New Member? Read This | Questions? Need Help?Ask Here
Site Guidelines | Eurobricks FAQ | Visual User Guide


Posted Image

-== Classic LEGO trains are the best ==-

Do you need replacement stickers for LEGO (reproductions and customs): ministickers.nl

What then about the LEGuanO?!


#13 Superkalle

Superkalle

    Posts: 5634
    Joined: 21-December 08
    Member: 4755
    Country: Sweden

Posted 18 August 2010 - 02:47 PM

View PostJopieK, on 18 August 2010 - 01:19 PM, said:

You don't need graphical programming, using windows messages would also be nice already, but still, it doesn't give you a lot of feedback of course. I'm not sue wether that is possible, but maybe it could even become a photoshop plugin. Problem with windows is that the applications are not normally scriptable. In Mac OS most applications are so no real programming (just Applescript) is required although I don't think this is usable with LDD for Mac (but didn't look into it so it is a wild guess). In fact looking at havok.com it might be that LDD is just an application built around the havok.com tools:

http://www.havok.com...ral-information
Well, give it a try with whatever approach you want and get back here in the forum when you have come a bit further.

In the meantime, if anyone else feels like giving it a go, it'd be nice.
Eurobricks Digital Design Forum - for all your LDD and Ldraw cravings

#14 JopieK

JopieK

  • Kneecap Buster


    Posts: 2412
    Joined: 04-January 07
    Member: 1180
    Country: Netherlands

Posted 18 August 2010 - 09:37 PM

What I see in the XML file is:


<Cameras>
	<Camera refID="1" fieldOfView="80" distance="207.7166595458984375" transformation="0.745532572269439697265625,0,-0.66646921634674072265625,-0.2326819896697998046875,0.93707573413848876953125,-0.2602851092815399169921875,0.624532043933868408203125,0.349126398563385009765625,0.698620378971099853515625,134.8406219482421875,62.021808624267578125,131.483428955078125"/>
  </Cameras>
  <Bricks cameraRef="1">
  ...

So apparently more cams can be used (the file format supports it at least), and you can assign a camera to groups of bricks. An other interesting find is this:

<Group transformation="1,0,0,0,1,0,0,0,1,0,0,0" pivot="0,0,0" ...

So we could also in theory make a tool that lets you really animate objects...

New Member? Read This | Questions? Need Help?Ask Here
Site Guidelines | Eurobricks FAQ | Visual User Guide


Posted Image

-== Classic LEGO trains are the best ==-

Do you need replacement stickers for LEGO (reproductions and customs): ministickers.nl

What then about the LEGuanO?!


#15 Superkalle

Superkalle

    Posts: 5634
    Joined: 21-December 08
    Member: 4755
    Country: Sweden

Posted 18 August 2010 - 10:26 PM

View PostJopieK, on 18 August 2010 - 09:37 PM, said:

What I see in the XML file is...
Exactly - You see what I mean now - The idea was very straight forward. Generate LXF-file, take screenshot (send keys strokes, Ctrl-K), tweak the transformations a bit, generate new LXF-file, take screenshot, and so on. I agree, it's not elegant, but it will work for simpler stuff. And I think it's the only way to go since LDD will not allow us access to the data geometries or an API, so the only way to do it is throught the application.
Eurobricks Digital Design Forum - for all your LDD and Ldraw cravings

#16 private_lego

private_lego

    Posts: 89
    Joined: 12-June 10
    Member: 11437
    Country: Belgium

Posted 19 August 2010 - 04:30 PM

Quote

So apparently more cams can be used (the file format supports it at least), and you can assign a camera to groups of bricks. An other interesting find is this:

<Group transformation="1,0,0,0,1,0,0,0,1,0,0,0" pivot="0,0,0" ...

So we could also in theory make a tool that lets you really animate objects...

Group transformation is really necessary to make something move.
Suppose you want a car take a turn, and you have to move all bricks one by one, along a curved path.
If this works, then we are one step closer to animation. Let's find out.

Tried it and failed.
Changed the numbers after pivot = No result
Changed the numbers after transformation = No result or error : file could not be loaded.
When you rotate or move a group in LDD the numbers doens't change.
Anyone ??

Edited by private_lego, 19 August 2010 - 04:54 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users