Saturday, 1 February 2020

Opps...!


When I wrote ColouredVoxel2Ldr I used an ordered packing mechanism of bricks (or plates - but not both) to fill the space defined by the voxel model.  Here I wanted to use random bricks and plates (in the same build) to fill the spaces.  "Opps" is an example of that packing technique where bricks and plates are packed into an 8x8 grid at 100% density (so every space is filled).  For this image the 100% packed tower was imported into LDCad, where I separated it the middle and then scattered some of the separated  brick/plate elements on the ground plane.  The final image was rendered in Blender 2.8


Tuesday, 7 January 2020

The High Tower

The problem with the Lego landscapes was that it still doesn't consider the "density" of the build. I wanted to create something where it would pack bricks into the available spaces before it increased the height of the build.  Consequently I would need to analyse the available space left in each layer and fit bricks into those spaces.  My first attempt had a bug in the code that increased the height of the bricks in one of the corners of the build.  Whilst the bug was frustrating to track down it did make quite a nice image!


Saturday, 4 January 2020

Lego Landscapes (In Search Of Studless Models - Part 6)

Having reached a point where I could build various random structures of different heights/colour combinations, I decided to combine them with a script that I wrote a couple of years ago which would randomly combine a library of Lego models (each created on a 4x4 base plate) onto a 48x48 base plate.  This allowed me to create a "landscape" of Lego.












Sunday, 29 December 2019

No Studs Here! (In Search Of Studless Models - Part 5)

Personally, I think the appeal of studless models is that, generally, they just look nicer, and more "polished", so they appear as if they have been finished with a "human touch".  Hence giving a computer the ability to create studless models might begin to blur the boundaries between computer generated models and human created models. 



As the brick matrix was now being randomly created (as opposed to selecting an LDraw part and calculating the brick matrix) it was now much easier to swap out bricks for similar bricks - so swapping a 1x1 standard brick for a 1x1 cylinder brick or  a 1x2 standard brick for a 1x2 grill brick or 1x2 with embossed bricks became much simpler.  Sloping roof tiles were set to only be added at the top of the models (because of the issues with the height of sloping roof tiles noted previously) 

Having managed to track (most of) the available studs in a build I could begin to apply colours to the model to make it more visually pleasing.  I also wanted to include some transparency as that can make the renders look more interesting, especially with the photoreal renderers that are becoming increasingly available.  Distributing the colours over the height of the the design meant adjusting for the max height of the model.  For shorter models (under 5 units high) I coded to add more blue, which helps to break up the green floor of the other models


Thursday, 26 December 2019

What! A Stud? (In Search Of Studless Models - Part 4)

Isolating the available studs in a model requires that you analyse the whole column of bricks above any given stud - by analysing each layer in the column of your build matrix it's possible to isolate where the studs should be available - however my current code is not flawless - in the model below there are a couple of studs that are not identified (one above the base layer and one above the 1x2 wall texture brick).

Monday, 2 December 2019

Imaginary Bricks! (In Search Of Studless Models - Part 3)

I'd returned to just using 1x1 tiles to try to isolate stud availability.  I had been using my brickalo code to generate the models that I would then try to add tiles to, however my brickalo code was an unmanagable mess (of my own making) so I decided to rewrite my code to better support the isolation of studs within a model.

Initially my new code focused purely on the placement of tiles on "imaginary" studs of imaginary bricks!  I coded a mechanism of creating a numpy matrix that could represent the bricks and plates added to a model (without actually bothering to add the brick to the LDraw model).  However it quickly became apparent that having made a functional matrix that could track imaginary bricks and plates - I may as well use it to add real bricks to the LDraw model.  It's worth noting that this approach was very different to the code I'd used for brickalo.  

With brickalo, the code selected a random LDraw part (from a list of parts) and then drilled down into the part to work out what the dimensions (1x2,2x2,2x4 plate or brick etc) of the LDraw part were which then allows the code to calculated the part matrix which is then added to the larger build matrix.  With my new code, that I was using for tile placement, the part matrix is randomly generated, and the corresponding part selected according to the dimensions and size of the randomly generated part matrix.   As it turns out, this new approach would allow for the selection of  many more variations of similar parts.



Thursday, 14 November 2019

Not All Tiles are Equal (In Search Of Studless Models - Part 2)

Initially I looked at trying to use 1x1 sloping roof tiles to place on each available stud but the problem with these parts is that they are not 1 plate width high, so not only do you need to identify available studs but you also need to know the gap distance between the stud and any parts above the stud.  In the little animation below it looks like I got lucky, but if you look carefully, there is an intersection in the model!


Another couple of intersections are more obvious in the model below.

In fact I've yet to solve this problem, so for now sloping roof tiles could only be used on the top of a model!