A file format for Lego Models

From LDraw website:

LDraw is an open standard for LEGO CAD programs that allow the user to create virtual LEGO models and scenes.

Ldraw standard has been created in 1995. Many softwares have been created based on this format: LeoCad, MLCAD, SR 3D Builder, Bricksmith LDView... Each of them has their specificities, SR 3D Building is used for Technic model, LDView modify primitive for best rendering, ... Also there are WebGL Viewer and many other tools (LSynth allow to create bending part, exporters to modeler 3D...).

The main competitor of softwares based on LDraw is the official LEGO software: LEGO Digital Designer. Even if a user can create models, he can't use his creation with other softwares. In fact, model exporters exist but the geometry of bricks is unavailable and the user needs an another source of geometries (as LDraw).

So today, I think to create a new LDraw viewer is a needless work. The purpose of my project is the creation of content and games based brick (I avoid to use the 'LEGO' Trademark). But before to aim this dream, we need a basic renderer. Format explanation is described in the tab 'Documentation' of the LDraw website.

My first subject is the color of brick. In a file of the LDraw library (LDCfgalt.ldr), there are the list of available colors. Each color is associated with a number. Obviously, each brick will be associated with a color. A special color exists which allows to define sub-model without specified color. It allows to create a model with many identical sub-model with different colors. The color will be propagated to children of this model. The most of basic bricks use this special color. For others, many bricks have motifs and pictures. Theses motifs are primitives with fixed color. To create new motif, you need a software which manipulates vectorial image (DAT2QP). The color may be propagated by several methods: it depends of many parameters as the file structure. Presently, I don't know the best choice of propagation method.

Each ghost corresponds to the same sub-model with a undefined color (except eyes which are white and black). The colors are defined in the model with the four ghosts.

The second point concerns the format files. LDraw has three different extensions MPD, LDR and DAT. In fact, the three types of file use the same format. MPD is the extension of multi-parts document, it aims to group many subparts. LDR is the default extension, it contents the model. DAT is the extension for parts, it concerns basic bricks geometries. In a file, there are many types of primitives, they concern geometries (lines, triangles, quads, optional lines), relative files (children part), and meta-commands (informations, color, back-face-culling,...). So a basic brick is composed of lots of subfiles. For example, the brick 3001 (2x4) is composed of 12 different subfiles (some of them is used many times as studs). Each brick is associated with a big graph. This choice of the structure was certainly due to the memory capacity of computers: bricks use the same primitives, so few different primitives. Today, computers lost lots of time to display a brick by going though graph.

This first post is an overview of LDraw format. So Ldraw is an open format and is easy to use. There are two problems to fix: how should we gain computing time and how can we manage colors.

First article

This is the first article of this blog. Here, I will talk about my first contact with WordPress.

This website is hosted by OVH on a shared server. This configuration suggests the website can't access to the totality of the server capacities. This isn't a problem because this website dones't need a large bandwidth, and the allocated memory space for this website seem sufficient.

WordPress was installed by a service of OVH, so there is nothing to configure. WordPress is a blogging tool which allows to manage a website. It proposes many themes, many website appearances. After many tests, I have chosen the default theme (Twenty Fourteen) because I think it correctly uses the screen (the header is small). However, I have modified two parameters of the formatting of the page. First, the maximum width of the page was 1260px. I have deleted this limit to force the full-page for screens which have a bigger resolution. Second point concerns the text formatting: I prefers 'adjusted' texts.

I have also tested plug-ins to display my Curriculum Vitae, but I wasn't convinced by these tools. Today, I use a PDF viewer, but I search a best way (maybe with style sheets).