Message Boards Message Boards

Why is this Cuboid disappearing on this animation?

Anonymous User
Anonymous User
Posted 6 years ago

I am trying to move the virtual camera over a static 3D scene. The Cuboid is disappearing for the latter two thirds of this animation, though, and I don't want it to disappear. Is there a way to do graphics in Mathematica without them randomly disappearing?

In[92]:= go[resolution_, framesPerSecond_, totalSeconds_] := Module[
  {
   totalFrames = framesPerSecond*totalSeconds,
   totalBuildingsX = 100, totalBuildingsY = 100,
   distanceBetweenBuildingsX = 100, distanceBetweenBuildingsY = 200,
   lengthPerBuildingPerDistanceBetweenBuildings = 8/9,
   lengthPerBuildingX, lengthPerBuildingY,
   totalLengthX, totalLengthY,
   viewAngle = (Pi/4),
   graphicsList
   },
  lengthPerBuildingX = 
   distanceBetweenBuildingsX*
    lengthPerBuildingPerDistanceBetweenBuildings;
  lengthPerBuildingY = 
   distanceBetweenBuildingsY*
    lengthPerBuildingPerDistanceBetweenBuildings;
  totalLengthX = totalBuildingsX*distanceBetweenBuildingsX;
  totalLengthY = totalBuildingsY*distanceBetweenBuildingsY;
  graphicsList = {Opacity[2/2]}~Join~
    {Opacity[1/4], 
     Cuboid[{0, 0, 0}, {totalLengthX, totalLengthY, 3000}]};
  Export[
   "t.avi",
   Table[
    Graphics3D[
     graphicsList,
     Axes -> False,
     PlotRange -> {{-2 totalLengthX, +2 totalLengthX}, {-2 \
totalLengthY, +2 totalLengthY}, {-1, 12000}},
     ViewCenter -> {1/2, 1/2, 0},
     ViewPoint -> {totalLengthX/2 - 
        totalLengthX ((frame - 1)/totalFrames)/2, totalLengthX, 
       totalLengthX (totalFrames - (frame - 1))/totalFrames},
     ViewAngle -> viewAngle,
     Boxed -> False,
     ViewVertical -> {0, 0, 1}, SphericalRegion -> True, 
     ImageSize -> resolution
     ],
    {frame, 1, totalFrames}
    ],
   "FrameRate" -> framesPerSecond
   ]
  ]

In[91]:= go[
 {720, 480}/8 (* resolution *),
 4 (* frames per second *),
 4 (* total seconds *)
 ]

Out[91]= "t.avi"

Everything was fine while the camera was fixed up high, but then I parameterized its height only to discover Mathematica obliterates the entire scene if I do that. Why would Mathematica do that?

This never happened with other rendering programs. Was there some forewarning in the documentation that the Cuboid would disappear? Wolfram employees are invited to come over and watch me try to be productive with this program.

I have a lengthy notebook where I'm just trying to figure out how to set Graphics3D options to get it to do what I want, which is very simple with other powerful rendering programs. What a pain. What a horrible way to spend the final period of my life, battling this monster.

POSTED BY: Anonymous User
6 Replies
Anonymous User
Anonymous User
Posted 6 years ago

Bounding box is quite clear. it's the absolute boundary that will be plotted

There are two kinds of units. the "x,y" values as units or scaled units. scaled unites mean scaling all x,y so that they are 1. (meaning, they are fractional and end at 1). So don't mix up which units your using or you'll get confused.

For the image you see in front end there is also "Aspect Ratio" for 2D images. for 3D, it's the same but BoxRatios are used.

Mathematica will try to fit the whole plot so you can see it in a rectangular box that you see in front end. To do that it may adjust aspect ratio. If it did: you can use (Full)Options[graphic] to see if it did.

POSTED BY: Anonymous User
Anonymous User
Anonymous User
Posted 6 years ago

I have a list of some GL "viewer" bugs I didn't bother informing Wolfram about in a notebook I have. Rest assured WR will get around to fixing minor GL viewing bugs.

POSTED BY: Anonymous User
Anonymous User
Anonymous User
Posted 6 years ago

To answer the question, your suspicion that you moved it outside of the PlotRange are probably correct

Your example is a little complicated (not easily read). Maybe you can simpllify the example or at least present it in a more readable manner.

POSTED BY: Anonymous User
Anonymous User
Anonymous User
Posted 6 years ago

You can read the Mathematica docs for days without finding a clear definition of bounding-box. Been programming since 1980 and never before seen anything like this.

POSTED BY: Anonymous User
Anonymous User
Anonymous User
Posted 6 years ago

Here's how to kill a day of your life. Place a Cuboid with one corner at {0,0,0}, then try to place the ViewPoint level with the base of the Cuboid. 0 doesn't work, nor -1/2, nor -1, nor -2. What an awesome, special coordinate system for Viewpoint, and I'm sure there's an awesome tutorial about it somewhere. Great fun searching for the relevant information if you want to kill time from your life.

POSTED BY: Anonymous User
Anonymous User
Anonymous User
Posted 6 years ago

Thanks for trying to help.

Wolfram's website saw it fit to remove the formatting from my code, and I'm not spending more of my time performing menial tasks to accommodate Wolfram's limitations. Good software doesn't cause the user to perform menial tasks it does the opposite.

Bounding box is something that hides Cuboids I want to see---that much I gather; bounding box's position, however, is apparently one of Wolfram's trade secrets.

I was working on this at 4:00 am today. Now 6:00 pm, and I still don't know how to set the ViewPoint to put it level with base of the Cuboid; that means it's time to port this to Python.

I know the formulas to calculate the red green and blue values that should appear in each 2D pixel in the final result; I know the trig, linear algebra, and protective geometry. If I had started implementing my own 3D rendering engine at 4:00 am instead of relying on Mathematica, it would have been done by 7 or 8 am. Wolfram provides vague natural-language descriptions in their documentation instead of precise formulas and pseudo-code, so I spend my days trying to translate Wolfram's utterances into math. If you feed the Mathematica documentation to Wolfram's natural-language interpreter, how much does it understand?

When I try to click a word with the mouse, at the last second, it puts up a tooltip which catches the mouse-click and sends me to another window. They spent their resources adding a feature to block me from editing when I'm trying to edit. Pencil and paper work better.

POSTED BY: Anonymous User
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract