Material: Net Curtain

I’m currently working on modelling the whole interior of the house my wife and I are buying. I’m one room in so far but I’ll cover that in detail in another post soon. I hit a snag when I was trying to model the curtains for the windows though.

How on earth do you make a net curtain material?

I tried using the translucent material, then I tried using it mixed with the transparent material but nothing seemed quite right. I had a brief chat with Alex Saplacan on the UK & Ireland Blender Users Slack group and he suggested using Wave Texture nodes to generate the lines in the fabric. After some fiddling about I came up with this which I think works pretty well.

Applying it to a plane that I’d distorted using the cloth simulation gave a pretty believable result…

Curtain with environment behind

…and up close you can see the very fine fibres.

Detail view of curtain with environment behind

Hopefully someone out there will find this useful. I hope to share more materials as I make them throughout this project. I might also have to think about changing the design of this site to make it easier to find them once there’s a decent library.

Building a PC for Blender

I’ve been playing with blender for a while now and I’ve reached the point where my laptop is just not up to the job. I have increasingly found that I abandon projects as adjusting materials and lighting requires hour long renders to see the difference. Having considered all the options;

  • Buying a newer Mac
    This doesn’t really make sense as it may not actually be an improvement as Apple tend to use AMD graphics cards and Blender seems to work best with NVIDIA cards.
  • Buying a secondhand Mac Pro and upgrading the graphics card(s)
    Having spent some time researching this route there doesn’t seem to be much useful information available. It seems that the graphics cards might need flashing to make Mac OS recognise them and the risks involved were too large. Plus the cost of a recent, pre-dustbin, Mac Pro and a good graphics card was equivalent to building a new PC from scratch.
  • Building a Hackintosh
    There’s tons of information out there for people that want to go down this route. I had a very cheap netbook running Mac OS X a few years back and it mostly worked fine but there were enough issues that made me not want to rely on it.

ComponentsI decided that I would bite the bullet and build a Windows PC. Despite the fact that I haven’t used Windows regularly for nearly twenty years and I’ve never built a PC before. So after about six months of research I placed my order and the next day many, many boxes arrived.

The full list of components is on PC Part Picker but essentially the build consists of a water-cooled Intel i7 3.3Ghz 6-core processor, 32Gb of RAM, an NVIDIA GTX 980ti, two 240GB SSDs and two 3TB HDDs.

What do I do with all of these things?

With all of the parts in hand and an entire day to myself I set about trying to put the machine together. I’ve watched countless hours of LinusTechTipsJayzTwoCents and the Awesomesauce Network over the last few months, I thought I was ready.

It turns out that building a PC is a lot more fiddly than the professionals above make it look. I intentionally bought a case that has a reputation for being easy to build in and I’m glad that I did. The instruction book that comes with the case walks you through what to install, how and in what order. Nearly every component I ordered came with a fairly hefty manual or installation guide.

Despite all of the instructions I still hit a few snags. I didn’t connect a cable to the 8-pin power connector at the top of the motherboard before installing the H110i’s radiator. This meant some very careful manoeuvring to get it out without having to disconnect everything.

I also didn’t appear to have a 4-pin cable for my power supply. On my motherboard there’s a 4, 8 and 24-pin socket for power cables. The manual makes it very clear that you must connect all of them for it to operate correctly. I looked around online and it seems that I was not alone in my confusion, plenty of other people could also not find their 4-pin cable. Apparently the 4-pin socket is optional and is only necessary for people that want to increase the voltage to their CPU for hardcore overclocking. So I didn’t connect one and the PC seems to be working fine.

I found cable management more difficult than I expected too. I chose to go all out and had some white, individually sleeved CableMod PSU cables to compliment the build. They look nice enough but I found trying to get them to look neat pretty challenging. Ordering some cable combs and a bit of fiddling seem to have solved that issue now though. Cable management in the back of the case was also a little hairy. I had planned on making it a work of art back there but after fighting with spaghetti for half an hour I decided it was neat enough and the side panel fitted without too much resistance so I called it a day.

Building the PC took me all day in the end, including clearing up all the packaging, manuals, screws, and other ephemera. I’m sure if I were to build another machine it would take a lot less time and I’d be aware of the potential pitfalls along the way. Considering how it turned out I’d say it was a pretty good days work.

Even the fans are black and white
Yes it has a window, yes it has lights
Yes it has a window, yes it has lights, try not to judge me…

 Bringing it to life

I’m not going to lie, I was pretty sure that it wouldn’t boot first time but surprisingly it started up fine. I inserted my Windows 10 flash drive and happily clicked through the install. It went without a hitch and pretty soon I was greeted by a Windows desktop. As the machine has no optical drives I plugged in an Ethernet cable and was pleasantly surprised to see that it automatically connected with no issues.

I got to work installing drivers for the motherboard, the graphics card, the cooler, everything went fairly smoothly. Until I rebooted. On booting up the machine asked for the password I had set a few minutes ago. I entered it and it resolutely refused to accept it. I know the password that I entered was correct but Windows refused. I tried the reset password option and Windows helpfully asked me to insert the CD I didn’t have. So I booted back to the installer, formatted all the disks and went through the whole process again. Fun times.

I read/watched a bunch of tutorials on oveclocking and eventually managed to get the CPU stable running at 4.3Ghz and the graphics card also saw a modest increase that got an additional ten fps in the Heaven 4.0 benchmark. I definitely don’t know enough about it to explain it to anyone else though so lets move on to the big question…

Will it blend?

Mikes BMW benchmark

On my laptop the BMW benchmark scene above takes over half an hour to render. On the new PC with an overclocked CPU and GPU the same thing renders on the GPU in 30.29 seconds! Even on the CPU it only takes one minute and twenty seconds!

I am so happy with how it all turned out the machine runs brilliantly, blender works superbly and it’s still pretty quiet. Hopefully I’ll be sharing some new work soon.

Rendering Minecraft in Blender

I’ve been having an on and off love affair with Blender for three years now. While it’s true that the interface is bordering on user-hostile once you begin to understand the Blender way of doing things it is an incredibly capable piece of software.

Recently I stumbled upon Mineways, a free, open-source program which allows you to export sections of your Minecraft worlds for rendering or 3D printing. Being quite a fan of Minecraft (my wife and I had our Minecraft avatars on our wedding cake) I thought I’d have a play with it and see what I could make.

I did it Mineways

The Mineways program itself is incredibly easy to use. Open up a world file, chose the maximum height and depth you would like in the final scene, ctrl-click (right-click) and drag over the section you would like to export and then export an OBJ file for rendering.

Mineways

Once Mineways has finished exporting you’ll be left with several files:

  • An OBJ file which we’ll open in Blender
  • An MTL file which specifies the materials for the model
  • Three PNGs of Minecraft textures in RGB, RGBA and Alpha versions

It’s probably good housekeeping to put all of those files into a folder to keep everything organised and then we’re ready to get into Blender.

Will it blend?

So first up you’ll need to download and install Blender (the current version is 2.74 at the time of writing). Next if you are completely unfamiliar with the software I would recommend you go and make a mug to get up to speed with navigating the interface. You may also find that using a mouse makes it easier to navigate although it is possible with a multitouch trackpad (which is how I use it).

Now that you have Blender installed and you know your way around it a little lets get started. Create a new file in Blender, you should have a scene with a cube in the middle of it. Right click on the cube to select it, press “x” on the keyboard and click on the delete option that appears under your cursor. This should leave you with an empty scene ready to import your model. To import the OBJ file select File > Import > Wavefront (.obj) and then navigate to the OBJ file created by Mineways.

You should now see your model in all it’s greyish beauty. To see a textured preview change the viewport shading mode to texture by pressing “alt+z” (option+z), to switch back press “z” to go to Wireframe mode and “z” again to get back to Solid mode.

Blender Viewport Shading Modes

Now to see how it renders we need to set up at least one light and one camera. Fortunately the default Blender scene contains a camera and a sun lamp so you should be nearly ready to go. Adjust your view by rotating, panning and zooming until you have a good view of the model. Then from the View menu at the bottom left of the panel you’re working in select View > Align View > Align Active Camera to View.

Now we’re ready for our first render. Select the camera icon from the panel on the right to access the render settings. Set your resolution in the panel and then press the Render button. The output may look a little like this.

Blender internal renderer

My render came out particularly strangely as the world file I was working from came from a modded version of minecraft (ATlauncher). Mineways is only designed for “vanilla” (non-modified) minecraft worlds so it converts blocks it doesn’t recognise into bedrock. In this case it also got confused by the variety of trees available and made some trunks out of coal ore and some leaf blocks into wood blocks.

It’s fair to say that I was a little disappointed with this render but worry not things will get better. Blender has two built in renderers – the code that computes how the final image should look. Currently we are using Blender Render which is the original renderer for Blender and our other option is to use Cycles. The differences between them are many but essentially it boils down to Cycles being based on the physical world and therefore generally creating more realistic looking renders.

A new Cycle

There are definitely things we could do to improve the output in Blender Render but I’m going to suggest we jump ship to Cycles and get this render looking nice and smooth. Unfortunately however you can’t just switch to Cycles and carry on rendering. You have to recreate all the textures in your scene using nodes.

For most objects you just need to create a diffuse shader that uses an image texture as an input for the colour and then assign filename-RGBA.png as the texture. You can either do this in the materials tab on the right or in the node editor.

minecraft-diffuse-texture-nodes-cycles

For objects that have transparency (leaves, flowers, grass, etc.) you’ll need to add a mix shader between the diffuse shader and the material output. Then you’ll need to connect a transparent shader to the first shader input of the mix shader and control its factor with filename-alpha.png.

minecraft-texture-nodes-cycles

Having made those changes you should get something like this.

Full colour Minecraft render

It takes a while to get all the materials set up and the render can take a long time (this image took about seven hours with a thousand samples) but the results speak for themselves.

If you want to increase the “realism” you can experiment with lighting and add emission shaders to textures that should be light sources. In the image below the environment is set to black, the lava is a mix of diffuse and emission shaders and there is a dim moonlight from above.

Lava Emission Shader in Cycles

Switching to cycles won’t solve any issues with incorrect or missing textures though, so for now it’s probably best to stick to vanilla minecraft worlds. I’d really like to make some nice renders of the particle accelerators and nuclear power stations that my friends and I have built in the previous games so it may become the subject of a future post.

Beyond Minecraft

If you want to experiment further you can make your own textures and assign them to whichever objects you like. I tried another version using a mix shader that combined diffuse and glossy shaders to produce a material similar to a hard plastic.

Hard white plastic cycles nodes

I then added a plane beneath the minecraft model, scaled it so it expanded beyond the view of the camera and assigned the same texture to it. I also used a plane out of shot to the right with an emission shader to simulate the light of a soft box. The result is the bright and clean renders below.

minecraft-white-render

Close up of Mix shader in Cycles

A quick bonus

The day after I posted this I found a YouTube video that explains how to render minecraft items in Blender. It’s really quick and easy to follow, best of all you can use it with cycles by creating a diffuse shader with the colour input set to the image.

Minecraft Iron Sword