logo80lv
Articlesclick_arrow
Research
Talentsclick_arrow
Events
Workshops
Aboutclick_arrow
profile_loginLogIn

Modular Bricks – LEGO Shader for Unity

A great way to add LEGO-like personality to your Unity project

Modular Bricks shader pack by Matei Giurgiu is a collection of geometry shaders, designed to create extra geometry on meshes in order to give them a modular interlocking aspect.

Get Modular Bricks

Features

  • Different brick style: cubes or pipes.
  • Various shader variations: diffuse, PBL, emissive, transparent, vertex lit.
  • Amazing results with voxel art.
  • 60 seconds integration with MagicaVoxel Qubicle To Unity

Recently I have discovered a great tool for creating 3D models, it is called Magica Voxel. Basically, you build models using 3D blocks, which in geeky terms are voxels (volumetric pixels). Apart from a lot of tools for editing your voxels creations, Magica Voxel also offers a really powerful rendering engine which has various rendering effects such as drawing each voxel as a sphere or as a cylinder and doing a marching cubes effect on the voxel mesh. In my opinion, the most interesting effect is the one which draws each voxel as a Lego block.

1 of 3
1 of 4

This shader represents my effort to reproduce this effect in Unity without having to store the voxels separately. You simply import a mesh and the shader will draw the Lego cylinders on top of the geometry.  To achieve this effect, my shader is using an extra step in the rendering pipeline which was introduced since DirectX 10 and OpenGL 3.2. This extra step called the geometry stage is executed after the vertex stage and after the computations for the primitives. Therefore, the input for the geometry shader are geometry primitives (such as lines, triangles or point) and the output is a triangle stream. As a result, this specific stage gives the programmer the ability to create extra geometry and I have used this particular technique achieve the Lego effect.

Matei Giurgiu

The entire drawing process is handled by the GPU in the shader code, no compute shaders, no CPU overload. Just select the desired shader and the model will change its appearance. The radius or height of the pipe/cube can be customised in the shader properties. Works on mobile devices with OpenGL ES 3.1 + AEP (tested on Samsung Galaxy S7).

Error
(2000-0001)

Join discussion

Comments 0

    You might also like

    A Week After "Basically Announcing" Minecraft 2, Notch Basically Cancels It

    Instead, he and his team will focus on the previously-announced retro-style roguelike.

    Discord Gets Sued Over Alleged Anti-Consumer Practices

    The plaintiffs claim the platform has intentionally made it overly difficult to cancel subscriptions.

    Rumor: Possible Release Date for Grand Theft Auto 6 Revealed

    A video game store from Uruguay appears to have disclosed the launch date for the gaming industry's most anticipated title.
    • Insectoid Creature Brush mega Pack
      by Nicolas Swijngedau

      80 insectoid creature mega pack to create a variety of insects and alien creatures in the blink of an eye! Mandibles, horns, limbs, and all the little bits to bring your bugs to life! Just load the brushes, drag them into your scene and you're ready to go!

      Error
      (2000-0001)
    • Dirt & Scratches
      by Emil Skriver

      This pack can help you get that realism that 3D often lacks with various different dirt ad scratches captured from real surfaces.

      Error
      (2000-0001)

    We need your consent

    We use cookies on this website to make your browsing experience better. By using the site you agree to our use of cookies.Learn more

    ×