LDraw.org Discussion Forums
Animated Rotation of Model - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html)
+--- Forum: Rendering Techniques (https://forums.ldraw.org/forum-20.html)
+--- Thread: Animated Rotation of Model (/thread-21524.html)

Pages: 1 2


Animated Rotation of Model - Tanner S. - 2016-05-14

I was wondering if there was a way to make LDView export a series of images showing a rotation around the model incrementally.

Could it be accomplished using the batch command (which I know next to nothing about)?


RE: Animated Rotation of Model - Max Martin Richter - 2016-05-14

(2016-05-14, 1:59)Tanner S. Wrote: I was wondering if there was a way to make LDView export a series of images showing a rotation around the model incrementally.

Could it be accomplished using the batch command (which I know next to nothing about)?

I did such an animation a couple of years ago.
 
There must be somewhere a script for this animation on one of my harddisks, but I can't remember the right one.

Maybe I can find it the next days, but there is no guarantee for this task ;-)

If I remember right, you need to export to a Povray file and manually edit this file to load the POV script.

/Max


RE: Animated Rotation of Model - Travis Cobbs - 2016-05-15

(2016-05-14, 1:59)Tanner S. Wrote: I was wondering if there was a way to make LDView export a series of images showing a rotation around the model incrementally.

Could it be accomplished using the batch command (which I know next to nothing about)?

LDView doesn't support this inherently. A batch file could be made relatively easily, with a constant latitude and increasing longitude from 0 to 360. This would be done with the -cg option, like -cg 30,0 for 30 degrees latitude, 0 degrees longitude. I'll try to get back to you with actual batch file contents.


RE: Animated Rotation of Model - Travis Cobbs - 2016-05-15

OK, here is the contents of a batch file:

Code:
@echo off
SET LDVIEW=C:\Program Files\LDView\LDView64.exe
FOR %%F IN (%*) DO (
   FOR /L %%L IN (0,1,359) DO (
        ECHO %%~nF-%%L.png
       "%LDVIEW%" -SaveSnapshot="%%~nF-%%L.png" -SaveZoomToFit=0 -ZoomToFit=0 -SaveSeries=1 -SaveWidth=1024 -SaveHeight=1024 -DefaultLatLong=30,%%L "%%F"
    )
)

I'm not batch file expert, and I haven't tested it with filenames with spaces (although it might work), nor have I tested it with full paths. Specify an LDraw file (or LDraw files) as the parameters for the program. It will generate PNG files from 0 to 359. Note that this is set up for a 64-bit LDView. Change the second line to the correct full path to your LDView.


RE: Animated Rotation of Model - Tanner S. - 2016-05-17

(2016-05-15, 5:31)Travis Cobbs Wrote: I'm not batch file expert, and I haven't tested it with filenames with spaces (although it might work), nor have I tested it with full paths. Specify an LDraw file (or LDraw files) as the parameters for the program. It will generate PNG files from 0 to 359. Note that this is set up for a 64-bit LDView. Change the second line to the correct full path to your LDView.

This is the code that I put in:

Code:
@echo off
SET LDVIEW=C:\Program Files (x86)\LDraw\LDView\LDView.exe
FOR %%F IN (%*) DO (
  FOR /L %%L IN (0,22.5,360) DO (
       ECHO %%~nF-%%L.png
      "%LDVIEW%" -SaveSnapshot="%%~nF-%%L.png" -SaveZoomToFit=0 -ZoomToFit=0 -SaveSeries=1 -SaveWidth=1024 -SaveHeight=1024 -DefaultLatLong=30,%%L "%%F"
   )
)

The code runs when I open a file with the batch file, but the rendered images are blank. Is the code wrong or is something else going on?


RE: Animated Rotation of Model - Travis Cobbs - 2016-05-17

(2016-05-17, 0:43)Tanner S. Wrote: The code runs when I open a file with the batch file, but the rendered images are blank. Is the code wrong or is something else going on?

Try deleting all the text between "%LDVIEW%" and "%%F" and see if LDView opens the file interactively. If not, that means that LDView can't find the file. If the filename (or path to the file) contains spaces, try renaming the file to not contain any spaces, and storing it in a path where nothing in the path contains spaces.


RE: Animated Rotation of Model - Tanner S. - 2016-05-18

(2016-05-17, 1:38)Travis Cobbs Wrote: Try deleting all the text between "%LDVIEW%" and "%%F" and see if LDView opens the file interactively. If not, that means that LDView can't find the file. If the filename (or path to the file) contains spaces, try renaming the file to not contain any spaces, and storing it in a path where nothing in the path contains spaces.

Sure enough, it was the space in the file path. Thanks. By the way, am I correct in assuming that it renders using the last selected preference setting?


RE: Animated Rotation of Model - Travis Cobbs - 2016-05-19

(2016-05-18, 20:48)Tanner S. Wrote:
(2016-05-17, 1:38)Travis Cobbs Wrote: Try deleting all the text between "%LDVIEW%" and "%%F" and see if LDView opens the file interactively. If not, that means that LDView can't find the file. If the filename (or path to the file) contains spaces, try renaming the file to not contain any spaces, and storing it in a path where nothing in the path contains spaces.

Sure enough, it was the space in the file path. Thanks. By the way, am I correct in assuming that it renders using the last selected preference setting?

Good to hear. And yes, it uses the last settings. You can easily change that by creating a Preference Set in LDView with all the settings you want, then adding a -PreferenceSet=<PrefSetName> to the command line in the bat file. I would strongly suggest not having spaces in the preference set name.

Note that the bat file can almost certainly be fixed to deal with spaces in input filenames, but I don't know off-hand how to do so.


RE: Animated Rotation of Model - Tanner S. - 2016-05-19

Cool, and thanks so much for your help. I'm sorry, but I have one last question.

Is there a way to make it render at specific angles, rather than using a "counter" per say. It doesn't appear that the program is able to render half-degrees, and I need it to output a series of images at the angles: 0, 22, 45, 67, 90, etc. Can this be done?


RE: Animated Rotation of Model - Travis Cobbs - 2016-05-19

(2016-05-19, 2:43)Tanner S. Wrote: Cool, and thanks so much for your help. I'm sorry, but I have one last question.

Is there a way to make it render at specific angles, rather than using a "counter" per say. It doesn't appear that the program is able to render half-degrees, and I need it to output a series of images at the angles: 0, 22, 45, 67, 90, etc. Can this be done?

First of all, I believe that the LDView command line supports real numbers there, not just integers, so 22.5 should work fine. Secondly, I think you can update the following line to use specific values instead of a loop from 0 to 359:

Code:
FOR /L %%L IN (0,1,359) DO (

Change it to look like this instead:

Code:
FOR %%L IN (0,22.5,45,67.5,90) DO (

Put whatever angles you want inside the parentheses. (Don't forget to also remove the /L.)