LDraw.org Discussion Forums

Full Version: Image generation via terminal doesn't respect viewing angles
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, I'm currently trying to generate images with LDView via terminal on Linux (Ubuntu). I'm using the following command which includes parameters for DefaultLattitude and DefaultLongitude to set the viewing angle:

LDView /home/XXX/ldraw/ldrawdb/parts/608p33.dat -SaveWidth=516 -SaveHeight=516 -DefaultLatitude=90 -DefaultLongitude=-120 -SaveSnapshot=608p33.png -SaveZoomToFit=1 -SaveAlpha=1 -LineSmoothing=1 -DefaultColor3=0xBFBFBF -LightVector=-0.125,0.125,1

The problem is that the generated image is always viewed from the same direction, no matter what I set for Longitude and Latitude. However when I just open LDView with this command:

LDView /home/XXX/ldraw/ldrawdb/parts/608p33.dat-DefaultLatitude=90 -DefaultLongitude=-120

the viewing angle changes according to the parameters. So the problem only exists when I actually want to save Snapshots.

Does anyone know a solution for this?
Hello Henning,

I am also using the LDView command line in a VBA on Wondows to generate the images for the weekly instagram post.

I am using the "-cg" paramter to adjust the camera, so the main render string (without file and snapshot info) looks like this:

 -SaveHeight=1800 -cg30,45,50000 -ca0.55 -AutoCrop=1 -SaveZoomToFit=0 -SaveAlpha=1 -LineSmoothing=1 -DefaultColor3=0xBFBFBF -LightVector=-0.125,0.125,1 -EdgeThickness=3 "

-DefaultLatitude and -DefaultLongitude also don't work for me

What works is the -DefaultLatLong parameter, like
-SaveHeight=1800 -DefaultLatLong=120,45 -ca0.55 -AutoCrop=1 -SaveZoomToFit=0 -SaveAlpha=1 -LineSmoothing=1 -DefaultColor3=0xBFBFBF -LightVector=-0.125,0.125,1 -EdgeThickness=3

Reading the description for -DefaultLatitude and -DefaultLongitude , I don't think these are the correct parameters, as the description talks about resetting the view in a certain rotation mode, which I cannot imagine being used for the snapshots.

May be Travis can explain them better, but try the combined parameter.

-DefaultLatitude and -DefaultLongitude are supposed to work for command line snapshots when -cg and -DefaultLatLong are not present on the command line.

Just to confirm, are you both using LDView 4.5? Broken -DefaultLatitude and -DefaultLongitude processing for snapshots on the command line is one of the bugs that was supposed to be fixed in version 4.5 (although that somehow got missed in the change history).
I am using 4.5 with a build date of 21st of April 23

is -ca having an impact on -DefaultLatitude and -DefaultLongitude? Seems not even without it the two don't do anything

just -cg and DefaultLatLong work
(2023-06-14, 21:27)Gerald Lasser Wrote: [ -> ]I am using 4.5 with a build date of 21st of April 23

I have created an issue on GitHub to track this. I will fix it, but I don't know when the next LDView release will be.

In the meantime, your suggestion to use -DefaultLatLong or -cg should work. Note that the third (radius) number in -cg is optional. Without it, -cg behaves as an alias for -DefaultLatLong. (-DefaultLatitude and -DefaultLongitude combined were supposed to also behave in this way.)
Thanks Travis!
Thank you for your help! I got it working now.
I was actually using LDView 4.41 since I'm on Ubuntu 20.04. In this version the -DefaultLatLong parameter has no effect and I got weird 1x1 images.
Now I switched to my Mac with version 4.5 and it works with the -DefaultLatLong parameter.