# ☧ The Architect

I would like to present you some constructions I made with babylon js in the last days, which gave me a lot of joy for christmas.

The basis are geometric figures of the same size of 1 like spheres, rectangles, cylinders and their halved versions, as well as some subtracted units like half a sphere subtracted from a cube, which serves as a vault for the gates. So I have a kind of lego building blocks, which I can place individually or arrange as a surface or as a volume with simple logic. With only this code, the building was erected (leaving out the stairs and rocks).

init();

range(-5, 5, 1, 0, 0, 1, -5, 5, 1);
loop(CT, mesh_box);

pivot(0, 1, 0);
range(-4, 4, 2, -10, 3, 1, -4, 4, 2);
loop(CT, mesh_box);

range(-3, 3, 2, 3, 3, 1, -4, 4, 2);
rotate(0.5 * Math.PI, 0, 0);
loop(CT, mesh_box_minus_cylinder2);

rotate(0, 0, 0);
range(-4, 4, 1, 4, 4, 1, -4, 4, 1);
loop(CT, mesh_box);

range(-4, 4, 4, 5, 8, 1, -4, 4, 4);
loop(CT, mesh_box);

scale(1, .25, 1);
range(-5, 5, 1, 8, 8, 1, -5, 5, 1);
loop(CT, mesh_box);

pivot(0, 0, -1);
scale(.98, .98, .98);
range(-3, 4, 1, 1, 5, 1, -3, -3, 1);
randomize(.01, .01, .01);
loop(FW, mesh_plane_glass);

4 Likes

My first scene:

Exported scene without materials made out of the inspector:
scene1.zip (956.8 KB)

Short video made out of the inspector:
babylonjs.zip (750.1 KB)

I use instances, so the speed is quite fast although I use a lot of individual building blocks for construction. And that’s a good thing, because it allows a little more reality into the construction by not making things “perfect”. Some shifted stones in walls and glasses show “signs of wear”, which gives you the feeling that someone has lived there or is still living… Besides, this kind of construction can be used later for physical animations. Building up buildings is fun in itself, tearing down buildings is fun too! … I try to keep this always in mind when I code.

2 Likes

Niceeee, Congrats on your first scene !!!

Gallery 2.0.22

Title: The imprisoned spirit
Year: 2020/01
Artist: Necip

Technical detail:
The cage was build up with these lines of code

2 Likes

Create formations by negative definitions

The loop does nothing else than cube marching. it iterates through a series of x,y,z points.

Given now is a row of spheres. If one of the points is inside one of the spheres no brick will be created at this point.

This is a simple way to create interesting shapes out of a block.

The depth of detail is adjustable by delta.

CodeSnipped

1 Like

Modifications with offset and rotation

1 Like

The Mandelbrot Set

mandelbrot.zip (814.0 KB)

1 Like

Will you create The Chosen One as well?

Dude, this is awesome!

Which one do you mean?

You pour gasoline my mind and light a spark!
Thank you for the in-spiration!

By the way the root logic can be found here: https://playground.babylonjs.com/#FNDS9G#0

2 Likes

I definitely love this stuff and the way you see the world

1 Like

If you love it, you’ll get more my friend: https://playground.babylonjs.com/#2A5C40#0
This time with a callback function and the logic of creating models with subtracting formations by formula.

2 Likes

Matrix - running subroutines in a giant box computer

3 Likes

You nailed it as always!
And this time you gave me an idea!

Your approach to solve problems is so unique! I am always learning something from your examples! Thank you buddy!

1 Like

GLSL Distance Functions to create real 3D volumetric modells

Two spheres and a box:

Two spheres and a box blended together:

1 Like