City Timelapse

by HarshB32 in Craft > Digital Graphics

402 Views, 1 Favorites, 0 Comments

City Timelapse

Codeblocks (NEW) - Google Chrome 12-07-2020 18_28_35.png
Codeblocks (NEW) - Google Chrome 12-07-2020 18_29_15.png
Codeblocks (NEW) - Google Chrome 12-07-2020 18_29_16 (1).png
Codeblocks (NEW) - Google Chrome 12-07-2020 18_29_16.png

This is my attempt at making a city timelapse in Tinkercad using codeblocks.

View the file here: https://www.tinkercad.com/codeblocks/bFQJamN7zXD

Supplies

A Tinkercad account.

Use the bite sized tutorials available in tinkercad if you've never used the program before.

Expectations + Some Limitations

I was expecting to make buildings with individual blocks, which would change colour at night, giving the illusion of lights being switched on, have realistic shadows using "flat cubes" which would change shape...

That would be hard....

But, it turns out, tinkercad can't handle a lot. You are confined to a cube of volume 200*200*200 units as your workspace.

200 is the limiting number. You can't have more than 200 objects, iterations...etc

This is mainly a demonstration that a bit of coding combined with 3d designs is quite powerful.

Creating Buildings-1

Codeblocks (NEW) - Google Chrome 12-07-2020 14_00_26.png
Codeblocks (NEW) - Google Chrome 12-07-2020 14_02_05.png

We are gonna use a loop to create how many buildings we want.

Adding the <add cube> inside the loop would create those many buildings.

Creating Buildings-2

ezgif.com-gif-maker.gif

But we don't want the buildings to be same.

That's where the random number generator comes in. It outputs a number within the defined boundary conditions.

So, we will add random numbers as the dimensions of our box, within reasonable limits, that is.

This would create seemingly random structures, but they would be stacked at the origin.

Creating Buildings-3

ezgif.com-video-to-gif (5).gif
ezgif.com-video-to-gif.gif

To separate the buildings from each other, we will move every cube after altering its dimensions.

This movement has to be random too, so the buildings are evenly spread out in the x-y plane.

We will use the random number generator again, this time to move along the x and y axes. The z axis should be 0, because we don't want floating buildings (or do we, future??).

Limits: x: -100 to 100

y: -100 to 100

These are the maximum tinkercad can handle. Keep the range shorter.

Creating Buildings-5

5.png
Use2.png
use.png

The buildings stick out in the -z axis.

We will delete that portion.

Add a cube which spans the whole x-y plane and half the z axis.( 100*100*50) and move it down by -50 in the z axis. Make it a instead of a and group the objects together.

As you saw in the second image, the whole portion didn't get deleted. So I made the span of the buildings shorter.

Creating the Sky-1

SKy.jpg

The sky is a dome. The buildings sit in the interior. I reduced the span of the buildings even more so the sphere comfortably engulfs the whole scene.

Creating the Sky-2

Codeblocks (NEW) - Google Chrome 12-07-2020 16_59_29.png
Codeblocks (NEW) - Google Chrome 12-07-2020 16_59_36.png
Codeblocks (NEW) - Google Chrome 12-07-2020 16_59_59.png

As we zoom inside the sphere, the colour disappears and the interior looks white. That is because the sphere is solid, and not hollow. To make it coloured on the inside, scour a portion using a spherical hole.

Creating a Base

Codeblocks (NEW) - Google Chrome 12-07-2020 17_08_35.png

A simple cube with low height but streched to fill the entire x-y plane.

Combining Everthing-1 (Base, Buildings)

Codeblocks (NEW) - Google Chrome 12-07-2020 17_29_12.png
Codeblocks (NEW) - Google Chrome 12-07-2020 17_29_21.png

We are going to combine the buildings and the base as one object.

Combining Everything-2 (Sky)

Codeblocks (NEW) - Google Chrome 12-07-2020 17_34_02.png

We are going to create a new object, for the sky, so the buildings and the base don't affect it.

Making the Sky Change Colour.

Codeblocks (NEW) - Google Chrome 12-07-2020 18_10_35.png

Under the object associated with sky, inside a loop, put the <change colour> modifier.

To hold the longer, use more <set colour> modifiers for the desired colour.

Finished Timelapse, Feedback for Tinkercad

ezgif.com-video-to-gif (4).gif

I really wanted to put a sun and stars in the sky which would rotate while the sky changed colour. This wasn't possible because tinkercad does things one after the other, instead of doing them simultaneously. It would be lovely to have a feature which allows us to define the order of execution for multiple objects.