C3POwen

[Guide] Rendering LDraw models using POV-Ray

Recommended Posts

I was asked to put together a tutorial on rendering LDraw-produced models in POV-Ray in as clear and simple a way as possible. Although the following might seem a bit lengthy, I have tried to keep it clear, which is what caused it require a lot of explanation. I plan on updating things and changing things as time goes on and as people give me their input, so as to create a useful guide for everyone here on Eurobricks.

NOTE: To give an idea of how long these images can take to render, I will be adding the render time of each image to the tutorial. As I don't rely on POV-Ray's anti-aliasing, I have rendered each image at 2880x1620 with AA set to off, and then crop and resize the image afterwards.

For computer spec comparisons, I use an Intel Core i5 running at 2.67 GHz, with 4GB of RAM running at 1333 MHz and an NVIDIA GeForce GTX 460 with 1GB of RAM. I'm also using POV-Ray 3.7, which can take advantage of more than one CPU core.

Contents

  1. Introduction
  2. Requirements
  3. MLCad (including LSynth and SR 3D Builder)
  4. Special files
  5. LDView
  6. Setting up POV-Ray
  7. Rendering your model in POV-Ray (including lighting and effects)
  8. Downloads
  9. More information
  10. Version history

1. Introduction

Unlike LEGO’s own Digital Designer (LDD), which can currently only output an image of exactly what you can see within the LDD window, LEGO models created using LDraw can be turned into high-quality and, in some cases, photo-realistic images.

This brief tutorial covers some of the basics of converting files created in LDraw and other compatible programs into something that looks almost real.

As an example throughout this guide, I will be using a model I made in MLCad of the tipper from 4201 Loader and Tipper, which can be found here.

2. Requirements

Regarding operating system, I currently use Windows 7, so this tutorial will be written to mainly accommodate Windows users, and I shall assume you are using a 32-bit version of Windows with the default installation path for LDraw.

For anyone using a 64-bit version, when referencing folder paths please use “C:\Program Files (x86)” instead of “C:\Program Files”.

Firstly, if you do not have it installed already, you need to install the LDraw All-In-One Installer, which contains the following programs required for this tutorial:

  • The LDraw parts library
  • MLCad, used for building the models
  • LSynth [optional], a system for building flexible parts within MLCad
  • LDView, used for converting models into a POV-Ray file
  • LGEO, a parts library built specifically for POV-Ray
  • POV-Ray, a ray-tracer that can render 3D models in high-quality

You can find the installer here: http://www.ldraw.org/

This will install everything within the "C:\Program Files\LDRAW" folder, although POV-Ray will get its own installation folder.

More information on this installer can be found at http://www.holly-woo...w/aioi1-en.html

At the moment, the installer seems to install POV-Ray 3.6, but if you're using a computer with multiple CPUs then it would be worth downloading and installing beta version 3.7, as this can make use of more than one CPU. This can be downloaded from http://www.povray.org/beta/ and is installed in the Program Files folder, but installs the "ini" and "include" files in your My Documents folder.

Although it's still in beta, I've had no issues when using this to render images.

3. MLCad

MLCad is a user-interface for the LDraw system, and makes it easier to create virtual LEGO models than hand-coding the location of each piece. It’s not as straight-forward to use as LEGO Digital Designer, but the parts list contains a greater number of “older” pieces, you ultimately have complete control over brick placement as LDD-style collision is ignored, and (if you’re feeling adventurous) you can even recreate LEGO elements yourself, if they have not been created already, and submit them to the LDraw parts lists. It is missing a number of more recent parts, but new elements are always being submitted and can be downloaded and installed fairly easily.

There are many excellent tutorials on how to use MLCad, so I won’t cover that here. However, there are a few settings within MLCad that I use that you may find useful.

Firstly, under Settings → General → Change... and then on the Step, Grid, Snap tab, I set the values as below:

MLCad_01.png

The coarse settings are left at MLCad’s default setting.

The medium settings are changed to 1 unit per step, and the rotation angle is set to mimic the rotation of the new-style locking hinge pieces, which can be set at angles of 22.5 degrees. 11.25 degrees gives you slightly more freedom when using the old-style hinge pieces, but the correct angle is easily set for the locking hinges, which can be reproduced in sets of two rotations.

Finally, the fine settings are set very low, so that I can accurately place items that have been rotated. Of course, if you find MLCad’s default settings enough, then they can be left as they are.

I then set up the parts tree to something more useable, under Settings → Parts Tree → Tree Configuration…, although this can be quite time-consuming and if you accidentally reset the tree you cannot easily get the settings back, as the information is stored in your computer's registry.

For ease of use, I have created a group file that automatically adds the values for you, an explanation of which is available in the “Downloads” section.

3.1. LSynth

If this is installed alongside MLCad, it will allow you to render flexible elements, such as hoses, and store these within your LDR and MPD files. It has a bit of a learning curve (pun not intended), but once you’ve got the hang of it, it can really improve models that contain flexible parts.

A modest example of what it can do can be found here in a Technic model that I’ve rendered.

A good guide can also be found at http://www.holly-woo...utorial-en.html

3.2. SR 3D Builder

A lot of people use SR 3D Builder as an alternative to MLCad, as it uses a system that is a little more like LDD. It uses a file format called L3B, which is essentially the LDraw format but with a bit more functionality. These files can also be opened within LDView, but certain special elements created within SR 3D Builder (such as rubber hoses) cannot be displayed using LDView, and therefore cannot be exported to POV-Ray for rendering.

As far as I’m aware, SR 3D Builder does not recognise the LSynth library of parts.

4. Special files

There are a few special files that are installed with the All-In-One installer which need some adjusting before rendering your model in POV-Ray.

  1. LGEO.xml
    This file contains all of the colour and element definitions for when LDView is exporting a model to the POV-Ray format. The default version is missing some colours, so I have created a more complete version, which can be found in 8. Downloads. Simply replace the default version with this one, and you will have more of LDraw’s colours available to render with. This needs to be saved to “C:\Program Files\LDRAW\LDView”
  2. lg_color.inc
    This file is installed into LGEO's program folder, in the "lg" sub-folder. It contains definitions to all of the colours of the bricks that POV-Ray uses, as well as information on element finish (transparency, reflection, etc.). The default one does not render accurate LEGO colours, so a replacement for this one can be found in 8. Downloads. This needs to be saved to "C:\Program Files\LDRAW\LGEO\lg"

5. LDView

Once you have completed your model in MLCad, open LDView and locate the model file (either an LDR or MPD file, or L3B is you have used SR 3D Builder). Depending on how good your graphics card is, you should see a representation of your model that looks better than the one shown in MLCad. As LDView also displays the LEGO logo on element studs, you can use this to check to see if they are set to your desired rotation, as this will carry through to the POV-Ray render.

Settings-wise, there is little that needs tweaking here, as it is mainly just for visual effect. However, you can set a better default angle, as LDView’s default is more top-down than the default one in MLCad, and when you export the model to POV-Ray, it will use the angle you currently have your model rotated to.

Select View → Viewing Angles → Specify latitude/longitude, and enter your desired values. As I said, I like the default MLCad 3D angle, so I use latitude 23 and longitude 45, although latitude 30 works well with some long, low models, such as cars.

LDView_01.png

Click OK and then go back to View → Viewing Angles and then click Save Current as Default. Now, when you open any model within LDView, it will always be initially displayed at this angle.

The model I will be using as it appears within LDView:

4201_01.png

Render time: N/A

5.1. Exporting to a .pov file

Now that you have your file open in LDView, click File → Export. This will bring up a dialog box which allows you to specify where you wish to save the exported file. It also has a button called Options..., which allows you to define various parameters. This is where you can set the aspect ratio for your render, and gives you some specific options: 5:4, 4:3, 3:2, 5:3, 16:9 and 2.35:1. I tend to go with 16:9, as that’s the ratio that modern widescreen TVs and monitors tend to use. It’s important that you remember which one you use, as you will need to set up another file in POV-Ray to account for this.

There are a few other options to choose from here, and I use the ones shown below:

LDView_02.png

Once you’ve chosen your settings, click OK and then from the Export window click Save. This will create a .pov file at your chosen location, using your chosen file name (by default this is the filename of the model you were looking at in LDView).

6. Setting up POV-Ray

6.1. Image resolution presets

The first thing to set up is the file that contains the default resolution presets. If you are using POV-Ray 3.6, this will be located within the “C:\Program Files (x86)\POV-Ray for Windows v3.6\renderer” folder and will be called “quickres.ini”, and this cannot be edited from here, so you may need to copy the file to your desktop first and then open it from there. If you’re using POV-Ray 3.7, this can be edited within the program itself, as it stores it in you user area, so you can just open POV-Ray and select Tools → Edit resolution INI file.

Open this file with a text editor and you should be able to see a list of screen resolutions, listed in this format:

[1280x1024, AA 0.3]
Width=1280
Height=1024
Antialias=On
Antialias_Threshold=0.3

The first line is the name of the preset, and this is displayed in a drop-down box within POV-Ray. The following lines are the actual settings themselves. Copy and paste one of these settings to another location in this file, so we can create a new preset.

You can leave both Antialias and Antialias_Threshold alone, as these are best left at default. If you wish to create an image that matches the aspect ratio set within LDView, this is where you set it. As I prefer to render in 16:9, then I need to make a width and height that matches this. So, for example, an image that is 1280 pixels in width must be 720 pixels in height, so you need to change this for your new preset, resulting in something like this:

[1280x720 16:9, AA 0.3]
Width=1280
Height=720
Antialias=On
Antialias_Threshold=0.3

I add the 16:9 comment to the preset’s title, just to make it easier to see the ratio.

If you’ve had to edit this from your desktop, then just copy it back to the original location.

6.2. POV-Ray INI file (3.7 only)

This file is the one that contains the paths to the LGEO pieces that POV-Ray utilizes in rendering. If you’re using POV-Ray 3.6 it should already have the right paths in it. However, if you’ve manually installed the POV-Ray 3.7 beta, then it needs to be set up.

Open POV-Ray and go to Tools → Edit master POVRAY.INI, and this should open the file within a text editor. At the bottom of the file, you need to insert three lines to ensure that POV-Ray can locate the right files. These are:

Library_Path="C:\Program Files\LDraw\LGEO"
Library_Path="C:\Program Files\LDraw\LGEO\ar"
Library_Path="C:\Program Files\LDraw\LGEO\lg"

Don’t forget that if you’re using a 64-bit operating system to make sure that the path uses "C:\Program Files (x86)".

Share this post


Link to post
Share on other sites

7. Rendering your model in POV-Ray

Assuming that POV-Ray is registered to automatically open .pov files when you double-click on them, navigate to the location of the .pov file that you created and open it. Alternatively, open POV-Ray from your Start menu or desktop, and locate the file by using the File > Open File... command. This will load the file and you will see that it mainly consists of text-based commands.

To begin with, we’ll generate a render using the basic settings, so that we can get an idea of what our image will look like when it's done.

Select your desired image resolution from the drop-down box just under the New and Open buttons. If you set 16:9 as the original exported aspect ratio from LDView, and if you set up some new image resolutions as shown under “Image resolution presets”, then ensure that you select the correct one. If you’d rather run a quick test of the render, then the lower the resolution the better.

If you’re all ready to run, then press the green Run button.

This will start rendering your image in a new window, and will show you the progress of the file. If you’re using POV-Ray 3.7 and you have a multi-CPU system, then you’ll find that it renders fairly quickly. Of course, rendering is a slow and intensive process anyway, so don’t expect it to happen too quickly.

Once this has finished, you should have a render of your model, with three off-camera lights casting shadows on the floor. These are set to the LDView default locations, but they can be edited, and you can even create your own extra lights. More detailed information can be found at: http://library.thinkquest.org/3285/language/light.html?tql-iframe#light_source

You may notice that these lights look quite harsh and the shadows may look unrealistic. This is where you would use an area light to improve things.

The model rendered with default settings in POV-Ray, using my custom "lg_color.inc" file:

4201_02.png

Render time at 2880x1620: 0m 32s

Note: Before going on to improve the lighting, rename the output file to something slightly different so that you can compare it with the next render.

7.1. Area lights

The purpose of an area light is to soften any shadows that are cast across an image, as if being viewed under more natural conditions. These are actually fairly straightforward to set up, and only require a minimal amount of editing.

In the tab that contains the code for your POV-Ray image, look for the section marked //Lights. If you’ve exported the file directly from LDView, it should look something like this:

// Lights
#ifndef (LDXSkipLight1)
light_source {	// Latitude,Longitude: 45,0,LDXRadius*2
<0*LDXRadius,-1.414214*LDXRadius,-1.414214*LDXRadius> + LDXCenter
color rgb <1,1,1>
}
#end
#ifndef (LDXSkipLight2)
light_source {	// Latitude,Longitude: 30,120,LDXRadius*2
<1.5*LDXRadius,-1*LDXRadius,0.866026*LDXRadius> + LDXCenter
color rgb <1,1,1>
}
#end
#ifndef (LDXSkipLight3)
light_source {	// Latitude,Longitude: 60,-120,LDXRadius*2
<-0.866025*LDXRadius,-1.732051*LDXRadius,0.5*LDXRadius> + LDXCenter
color rgb <1,1,1>
}
#end

A brief explanation of the above is this: light_source defines that you are creating a light. The line directly below that defines the location of your light source, and LDView uses the radius of the model to ensure the light is set at a suitable distance. After that, the color option simply defines the colour of the light, and is defined as a “float” value (which means that any value between 0 and 1 can be used to define the colour level, so pure red would be <1,0,0>). Everything that is marked with a # can essentially be ignored here.

To turn these into area lights, you only need to add a few variables, for example:

// Lights
#ifndef (LDXSkipLight1)
light_source {	// Latitude,Longitude: 45,0,LDXRadius*2
<0*LDXRadius,-1.414214*LDXRadius,-1.414214*LDXRadius> + LDXCenter
color rgb <1,1,1>
area_light 200, 200, 10, 10
jitter
}
#end

This simply changes the normal light into an area light that is 200 units in both width and length, and contains 10 light points along each axis, creating a grid. In this instance, as there are 10 light points along the width and length, this combines to create a total of 100 light points, which creates some nice smooth, realistic shadows.

The jitter function stops "banding" in the shadowed areas, which clearly makes the final render look it was created virtually. jitter simply applies some randomisation to the shadow to make it look more realistic.

Add the extra lines above to each light_source (as shown in the example), click Save and then click Run. This time you’ll find that the render takes a lot longer, especially if you have any large transparent elements in the model, such as windscreens which have complex shapes in them. This is because the area_light function is tracing many more rays across the model, which is more computationally intensive.

Again, this will render in a separate window, and you’ll notice that any parts of the model that are visible already have more realistic lighting. Now, if you compare both final images, a difference will clearly be noticeable.

The model rendered using default lighting, but with area lighting applied:

4201_03.png

Render time at 2880x1620: 36m 10s

If you want to see what effect the jitter command has on area light shadows, try leaving it out of the light_source command and see how it looks when you render the image.

7.2. "The Fog"

If you’ve exported your model from LDView at a fairly shallow angle, such as directly side on, then when you render the model you’ll see a dark horizon line in the distance. If your background colour is set to display as white, then this will be particularly noticeable. What you can do to improve things is use a fog effect in the distance.

This is quite simple to set up, and I tend to use the following:

// Fog
fog {
distance LDXRadius*25
color rgb 1
}

The color is set to pure white as a float value, but can also be set in other ways: color rgb <1,1,1> and color rgb <255/255, 255/255, 255/255> will both produce the same results.

The distance variable tells POV-Ray how far away in the distance at which 36.8% of the background is still visible. As the POV-Ray file contains a value for the radius of the model, I use this (LDXRadius) and multiply it by 25. This can vary, depending on the size of the model you use, so you may have to change this value to get the desired result.

7.3. Custom lighting

Although area lighting adds some nice effects, I find that it can make some elements give off a lot of glare from certain angles. To get around this, you can create your own custom lighting. I use something based off the default light setup, but move one of the lights to be directly overhead and then add a new light to the side, so that the model doesn’t look too dark after it’s rendered.

Like the fog function, this is more down to experimentation. This is the setup that I tend to use:

// Lights
light_source {
<0*LDXRadius,-1.5*LDXRadius,-1.5*LDXRadius> + LDXCenter
color rgb 0.75
area_light 200, 200, 10, 10
jitter
}
light_source {
<1.5*LDXRadius,-1*LDXRadius,0.866026*LDXRadius> + LDXCenter
color rgb 0.75
area_light 200, 200, 10, 10
jitter
}
light_source { // Custom light 1: Above
<0,-2*LDXRadius,0> + LDXCenter
color rgb 0.5
area_light 200, 200, 10, 10
jitter
}
light_source {  // Custom light 2: Side
<2*LDXRadius,-0*LDXRadius,-2*LDXRadius> + LDXCenter
color rgb 0.5
area_light 200, 200, 10, 10
jitter
}

You may now find that the floor looks too dark, but I cover that in the next section.

The model rendered using the above custom lighting setup:

4201_04.png

Render time at 2880x1620: 43m 04s

Incidentally, the *.pov file that LDView creates uses -Y as up, which is the opposite of how POV-Ray normally works, so keep that in mind when creating custom lights.

7.4. Reflection

To add a little more interest to a scene, I tend to add some reflection to the floor. If you’re rendering a model against a plain background and on a plain floor, the final result can look a little flat.

LDView adds a floor to each render, which can be turned on or off, and the description for the floor is found at the end of the POV-Ray file and looks like this:

// Floor
#if (LDXFloor != 0)
object {
plane { LDXFloorAxis, LDXFloorLoc hollow }
texture {
	pigment { color rgb <LDXFloorR,LDXFloorG,LDXFloorB> }
	finish { ambient LDXFloorAmb diffuse LDXFloorDif }
}
}
#end

To add some reflection, and change the ambient and diffuse settings, I replace the pigment and finish lines with this:

pigment { color rgb 0.9 }
finish { ambient 0.2 diffuse 0.5 reflection 0.05 }

This tells POV-Ray that I’m using a light grey floor, as the RGB is set just below pure white (which would be a value of “1”), and that I’m using a tiny bit of reflection, with some custom ambient and diffuse settings. The values listed in the finish statement can be played around with, although I’d recommend doing this with low resolution images, so that you can re-render until you’re happy with it.

By using the above, you should find that the floor now looks less dark and also shows a slight reflection of the rendered model.

The model rendered with a reflective floor:

4201_05.png

Render time at 2880x1620: 47m 00s

7.5 Transparency

It is possible to output an image with a transparent background, in case you wished to be able to add a custom background later using something like Photoshop. This can be applied with a simple switch, which is entered into the text box to the right of the dropdown of image resolutions. To enable it, you need to enter +UA, which turns this function on. To ensure that the output format is PNG, which supports transparency, enter +FN +UA which will also switch PNG output on. As POV-Ray 3.7 defaults to PNG output, you should only need the +UA switch when using this version.

It is also important that you run the render with the floor turned off, as this will still render if it is enabled. You can switch this off by setting the LDXFloor value to 0 at the top of the file.

The model rendered with a transparent background:

4201_06.png

Render time at 2880x1620: 29m 51s

There is a lot that can be done with transparency, and I only cover the basics here. For more complex usage, please see More Information.

Note: If you use anti-aliasing on an image with background transparency, you’ll get a “halo” of pixels around the final image the same colour as the original background, so it makes sense to render the image at a higher resolution without anti-aliasing and then use something like Photoshop to resize it afterwards. The background colour will also have an effect on your bricks, even though the background shows as transparent, so if you plan on overlaying an image with transparency on a dark background, it makes sense to use a dark background colour.

7.6 Radiosity

Although area lighting makes a scene look more realistic over the default light setup produced by LDView, radiosity helps take that even further, giving more realistic shadows than area light does, as the light bounces around between parts.

As of POV-Ray 3.5, a radiosity macro has been included by default, and this can be switched on with the addition of only a few lines.

IMPORTANT: For using radiosity, I recommend using a fresh POV-Ray file, as you will not want the file to be populated with any of the previous settings shown in this guide.

Firstly, you need to navigate to the beginning of your file, just under the initial portion that lists the LDView details (this is in green by default within POV-Ray). All you need to do then is paste in the following text:

#version 3.7;

#include "rad_def.inc"

global_settings {
       max_trace_level 10
       radiosity {
               Rad_Settings(Radiosity_Fast, on, off)
       }
}

light_source {	// X, Y, Z
       <-1000, -1500, -1000>
       color rgb 0.5
       area_light 200, 200, 10, 10
       jitter
}

#declare LDXSkipLight1 = 1;
#declare LDXSkipLight2 = 1;
#declare LDXSkipLight3 = 1;

Once pasted in, the version declaration should be changed to the version of POV-Ray that you're using (in this case POV-Ray 3.7).

The #include line includes the file that lists POV-Ray's available radiosity macros.

Following that is the global_settings field, which contains the radiosity declaration itself. There are a number of different macros that can be used, but by default I always use the Radiosity_Fast macro first, as this allows me to run a quick render to see how the scene will look. When rendering LEGO models, it is advisable to leave the "on, off" switches as they are.

The next portion of the above code is an area light. In this instance I’m only using one light, which is located off to the left of the model. You can tinker with the coordinates to adjust the light’s position, or even add extra lights if you wish. For this tutorial, I’m using the above setting with only one light.

I then usually change the floor settings to the following:

// Floor
#if (LDXFloor != 0)
object {
       plane { LDXFloorAxis, LDXFloorLoc hollow }
       texture {
               pigment { color rgb 0.9 }
               finish { ambient 0 diffuse 0.9 reflection 0 }
       }
}
#end

If you wish, you can change the reflection value to something like 0.05 to create a reflective floor.

I recommend using a low resolution first as, like area lighting, radiosity can be fairly slow when rendering models with transparency. If you now run the render using the above settings, you should get the following result:

4201_07.png

Render time at 2880x1620: 12m 03s

You may notice some visual artifacts (the floor around the tyres is a good example). This "blotching" is due to the radiosity process, and is reduced with higher-quality settings.

If you’re happy with the result, you can then render it with a different radiosity setting at a higher resolution. Again, POV-Ray’s anti-aliasing isn’t great, so it makes sense to run a render that is much larger than you plan to use and then resize it in an image manipulation program afterwards.

If I’m happy with my test render, I’ll tend to use the Radiosity_Final macro, as this can give very good results. This is the result of the same scene using the Radiosity_Final macro:

4201_08.png

Render time at 2880x1620: 33m 12s

Again, you'll notice that the artifacts are less obvious now, although still there. If you're feeling adventurous, you could tinker with these settings directly within the rad_def.inc file to something you're happy with, but testing can take a long time, as can the render itself if you ramp your settings right up.

You can also try out the other macros if Radiosity_Final is not quite to your liking. As they all have varying quality settings, render times can vary wildly.

The complete list of available macros is as follows:

  • Radiosity_Default
  • Radiosity_Debug
  • Radiosity_Fast
  • Radiosity_Normal
  • Radiosity_2Bounce
  • Radiosity_Final
  • Radiosity_OutdoorLQ
  • Radiosity_OutdoorHQ
  • Radiosity_OutdoorLight
  • Radiosity_IndoorLQ
  • Radiosity_IndoorHQ

For more guidance on implementing radiosity, the POV-Ray wiki guide should prove useful, with a detailed breakdown of the individual radiosity settings that rad_def.inc utilizes.

Edited by C3POwen

Share this post


Link to post
Share on other sites

8. Downloads

8.1. Fixed/new LGEO parts

Firstly, the "lg_color.inc" and "LGEO.xml" files referenced in this guide are included in the below zip file. As I have created some new LGEO parts, rather than keep two separate versions of these files (one with new parts and one without) it makes sense to include everything in one download, which currently stands at just under 900 KB.

Secondly, there are a few LGEO parts that either do not match the LDraw orientation properly or have other issues, and you'll be able to find those fixed files here. There are also a few other parts that are missing from the LGEO library that I have managed to adapt from other parts myself, which are included as well.

  • "LGEO-Update.zip" (2014-01-16) - currently includes 162 new parts, 24 updated parts and 62 fixed parts, as well as a user guide.

LGEO%202014-01-16.png

Most of the FIXED, UPDATED and NEW LGEO parts as of 2014-01-16

8.2. MLCad Parts Tree group file

This file needs to be installed to the "C:\Program Files\LDraw\MLCad" folder, and is used to populate the parts tree shown on the left of MLCad. To make it work properly, first rename the old version of the file to something like "MLCad_old.grp" so that you have a backup.

You then need to remove the appropriate key from the registry. I have created a file that will do this automatically, so just download the below file REG file to somewhere like the desktop and run it, confirming that you wish to merge the file.

Once you have done this, copy the "MLCad.grp" file to the stated location, reopen MLCad and it should contain a new parts tree. I've arranged it so that the main elements you need are at the top in alphabetical order, then other elements following that, again in alphabetical order.

I've removed printed bricks from the main bricks list, and these can be found in Other Parts > B. The Technic section contains all Technic parts, but I have created a couple of extra groups to make things easier to find. I've also separated out Minifig body parts and accessories. There is also an LSynth folder at the bottom, if you have that installed.

9. More information

There is an absolute wealth of information on rendering in POV-Ray, only some of which has been touched here. For some extra help in using POV-Ray, please see below:

10. Version history

  • 2012-02-06: Initial post
  • 2012-02-08: Added custom MLCad group file to Downloads section
  • 2012-02-10: Added table of contents
  • 2012-02-12: Added custom lighting, reflection and transparency to Rendering... section
  • 2012-02-14: Added registry file for automatically removing MLCad groups to Downloads
  • 2012-02-22: Added more information/link regarding transparency
  • 2012-03-06: Divided into three posts for ease of editing
  • 2012-04-16: Added "LGEO.xml" and "lg_color.inc" files to Downloads
  • 2012-05-27: The "lg_color.inc" file in the Downloads section has been updated, so that transparent neon colours are not overly bright.
  • 2012-06-03: Added section on Radiosity; started adding images of new example model; added some fixed/new LGEO parts to Downloads
  • 2012-06-06: Updated downloadable LGEO parts in Downloads to zip file.
  • 2012-06-20: Minor clarifications in the Radiosity section.

Edited by C3POwen

Share this post


Link to post
Share on other sites

Looking good! Now I just have to figure out LDraw. :D

Out of curiosity, is there any way to do a render of only the object, and omit the background? I would prefer to have transparent pngs, instead of a white background with shadows on it. Similar to how LDD takes screenshots.

Edit: The Google-fu is strong with this one: http://www.imagico.de/pov/icons.html

If you could try this out and post a backgroundless image compared to one of your prior renders I'd be interested in seeing that.

Edited by zinfinion

Share this post


Link to post
Share on other sites

Hello everyone!

I'm glad that this guide is here, and it is important to discuss rendering techniques.

Right now I'm using this guide with a little modification: http://www.brickshelf.com/cgi-bin/gallery.cgi?f=163897

Here are the main steps I follow (very similar to the guide above):

1. Make the model using SR3D and MLCad

2. Using LDView to set the right position of the model, and export the model file to .pov extension using LGEO parts and color.

3. Modify the pov file

a) replace colors with colors from this site: http://guide.lugnet.com/color/

b) replace the existing lights with radiosity, HDRI and area light (it's the same as in the brickshelf guide)

4. Render the image with POV-Ray 3.7RC without AA :)

5. Wait (this is the longest part)

6. Resize with bicubic antialiasing

In the end you end up with an image like this:

4491.png

It is not perfect, but it is a good start.

So briefly this is how I do my renders.

Edited by whitew0lf

Share this post


Link to post
Share on other sites

Why there is nothing to download in the Downloads section?

Edited by legolijntje

Share this post


Link to post
Share on other sites

Why there is nothing to download in the Downloads section?

The guide is a work in progress, at the moment. :wink:

It has been posted to start to listen user's opinions.

I hope it will be possible to provide e ultra-compact version of the guide soon.

Share this post


Link to post
Share on other sites

The guide is a work in progress, at the moment. :wink:

I hope it will be possible to provide e ultra-compact version of the guide soon.

Good start - here are a few suggestions:

- multiple platform approach for mac/windows in your guide - it should be interesting to have both platforms. You can use my website to add the relevant info if you like. But it will be beneficial to have both setups together.

- the povray section should have some images with before / after changes, as it is very difficult to quantify the small setting changes in the renderings. Also there are a thousand things one can alter - reflections on the floor, sky view, different light rendering, making the bricks more transparant, etc... It should be fun to show as much as possible.

I'll link to this post from my website, for window visitors

For those on mac os x they might want to have a look at it: argobrickmodels.com

Edited by conchology

Share this post


Link to post
Share on other sites

Also there are a thousand things one can alter - reflections on the floor, sky view, different light rendering, making the bricks more transparant, etc... It should be fun to show as much as possible.

The aim of this guide is not to provide a complete scenery of POWRay rendering.

We want to create a "ready to use" guide to help a user that is not familiar with POWRay to obtain a good quality rendering without learning to use the involved software.

Anyway some addition will be surely made to the present guide.

PS: the problem with mac software is that no one of us have a mac to test that.

So if you are familiar with POWRay rendering on a mac, you could directly propose the necessary additions.

Share this post


Link to post
Share on other sites

If anyone knows how to do the last step in the Koyan guide (resize image w bicubic antialiasing) please let me know.

This is what I do to get my LDD screenshots looking so smooth. I take screenshots at 3040x1900 and then resize to 512 wide or tall. On larger sets I will do a 1024 as well.

To achieve this:

- Decide the final image size you want. For this example let's use 512x512.

- Disable AA in POV-Ray.

- Render the scene at a multiple of 512x512. So 1024x1024, 1536x1536, 2048x2048, etc...

- Using the graphics program of your choice, resize the image. You should have a few options, some of which will be Bicubic. Bicubic or Bicubic Smooth tend to work best. I tend to use Smooth.

The GIMP and PixBuilder Studio are both free and have this capability.

Share this post


Link to post
Share on other sites

If you could try this out and post a backgroundless image compared to one of your prior renders I'd be interested in seeing that.

I shall certainly look into this, as getting proper PNG transparency with semi-transparent LEGO elements would be useful for adding custom backgrounds in a Photoshop-style program.

b) replace the existing lights with radiosity, HDRI and area light (it's the same as in the brickshelf guide)

I have to admit that I've yet to give radiosity and HDR lighting a go, but I shall certainly try at some point, and then update the guide.

Does it increase rendering times by much?

Why there is nothing to download in the Downloads section?

As @Calabar said, and I mentioned at the beginning, this is still a WIP, so some links don't currently work. I'm still working on the files for this section, to make sure they're all accurate and up-to-date.

This is what I do to get my LDD screenshots looking so smooth. I take screenshots at 3040x1900 and then resize to 512 wide or tall.

I've tried this, and it does produce very nice results (I've tried 5760x3240 resized to 1920x1080), as the default anti-alias option is not great. Of course, you can change this in the “quickres.ini” file to read Antialias_Threshold=0.0, but I believe this will really slow your renders down. It's a matter of what you want – speed or quality. @zinfinion's suggestion is a very good one, though.

Also, any points that need annotations for Mac users, then please specify and I'll add notes.

Share this post


Link to post
Share on other sites

The LGEO library does not work for me in L3P. It says certain .def files, I believe, are missing, or something of the like. Do you know why I am having this problem? I tried in LDView and when I start the rendering in Pov-Ray it gives me some error messages, so I editted the directory a few times, but it just kept on giving me the error message in different places in the file. Does anyone have a clue as to what the problem is?

PS: I was not sure whether to post this here or elsewhere, but...

Share this post


Link to post
Share on other sites

The LGEO library does not work for me in L3P. It says certain .def files, I believe, are missing, or something of the like. Do you know why I am having this problem?

Unfortunately I've not tried L3P, so wouldn't be able to tell you what was going wrong.

I tried in LDView and when I start the rendering in Pov-Ray it gives me some error messages, so I editted the directory a few times, but it just kept on giving me the error message in different places in the file. Does anyone have a clue as to what the problem is?

I've found that some POV-Ray files that are exported from LDView do bring up some errors. This is sometimes due to the colour of parts that it is trying to render having to be created for the POV-Ray file rather than being pulled from the LGEO library. I got around this by creating a custom colour file, which I will be posting soon.

It also seems to misspell certain items, but I have not found a way around this without manually editing the file. If you want to give me a link to the file (via PM if you like), I can have a look at the POV-Ray file that LDView produced and see what was causing the issue.

Share this post


Link to post
Share on other sites

Unfortunately I've not tried L3P, so wouldn't be able to tell you what was going wrong.

I've found that some POV-Ray files that are exported from LDView do bring up some errors. This is sometimes due to the colour of parts that it is trying to render having to be created for the POV-Ray file rather than being pulled from the LGEO library. I got around this by creating a custom colour file, which I will be posting soon.

It also seems to misspell certain items, but I have not found a way around this without manually editing the file. If you want to give me a link to the file (via PM if you like), I can have a look at the POV-Ray file that LDView produced and see what was causing the issue.

Since your LGEO files were not quite ready, I was using Kovan's guide from the link WhiteW0lf gave. Hence, L3P.

I cannot upload the file right now, but I will do so soon, maybe tomorrow or the day after. Thanks!

Share this post


Link to post
Share on other sites

I have to admit that I've yet to give radiosity and HDR lighting a go, but I shall certainly try at some point, and then update the guide.

Does it increase rendering times by much?

Unfortunately it increases rendering time heavily.

Share this post


Link to post
Share on other sites

The LGEO library does not work for me in L3P. It says certain .def files, I believe, are missing, or something of the like. Do you know why I am having this problem? I tried in LDView and when I start the rendering in Pov-Ray it gives me some error messages, so I editted the directory a few times, but it just kept on giving me the error message in different places in the file. Does anyone have a clue as to what the problem is?

PS: I was not sure whether to post this here or elsewhere, but...

You can better use LDview for exporting to an pov ray file. It make things smoother, and you don't get the error. Before I knew LDview was able to export, I tried l3p too, but I had some sort of the same error, and since, I use LDview.

Share this post


Link to post
Share on other sites

You can better use LDview for exporting to an pov ray file. It make things smoother, and you don't get the error. Before I knew LDview was able to export, I tried l3p too, but I had some sort of the same error, and since, I use LDview.

But the thing is I am still having problems with the POV-Ray file after creating it through LDView. It seemed, at first, to not be noticing the directory or something, perhaps I need to install it somewhere else, although I don't think that could be the problem, but...it's possible.

Anyway, here is the POV-Ray file C3POwen. Thanks again!

POV-Ray File

Share this post


Link to post
Share on other sites

But the thing is I am still having problems with the POV-Ray file after creating it through LDView. It seemed, at first, to not be noticing the directory or something, perhaps I need to install it somewhere else, although I don't think that could be the problem, but...it's possible.

Anyway, here is the POV-Ray file C3POwen. Thanks again!

POV-Ray File

If POV-RAy do not recognize LGEO parts probably it is not defined in it's master ini file. To do so in POV-RAy go to 'tools', edit master POVRAY.INI and in the end where is something like this

Library_Path="C:\Windows\Fonts"

add these lines:

Library_Path="C:\LDraw\LGEO"

Library_Path="C:\LDraw\LGEO\lg"

Library_Path="C:\LDraw\LGEO\ar"

(of course the path depends on where the LGEO files are)

I hope this helps.

Share this post


Link to post
Share on other sites

If POV-RAy do not recognize LGEO parts probably it is not defined in it's master ini file. To do so in POV-RAy go to 'tools', edit master POVRAY.INI and in the end where is something like this

Library_Path="C:\Windows\Fonts"

add these lines:

Library_Path="C:\LDraw\LGEO"

Library_Path="C:\LDraw\LGEO\lg"

Library_Path="C:\LDraw\LGEO\ar"

(of course the path depends on where the LGEO files are)

I hope this helps.

That is my directory for the LGEO Library. :classic: It must be the most common one, eh? Or is that default? Must be. Will add those things in POV-Ray and look to see if it helps. Thanks!

Edited by palathadric

Share this post


Link to post
Share on other sites

That is my directory for the LGEO Library. :classic: It must be the most common one, eh? Or is that default? Must be. Will add those things in POV-Ray and look to see if it helps. Thanks!

The guide already include this solution, look at 6.2 :classic:

Share this post


Link to post
Share on other sites

That is my directory for the LGEO Library. :classic: It must be the most common one, eh? Or is that default? Must be. Will add those things in POV-Ray and look to see if it helps. Thanks!

My LGEO directory is set as shown in the guide, which is the default for the LDraw All-In-One installer. As @Calabar says:

The guide already include this solution, look at 6.2 :classic:

I tried rendering the file you posted and it went through without issue, so I imagine that the POV-Ray INI file is not pointing to the correct location for the LGEO files.

Perhaps run a search for "LGEO" on your C: drive and see what location it throws up, and then put this into the INI file, ensuring that you tell it to also look in the "ar" and "lg" folders.

Share this post


Link to post
Share on other sites

Thanks for the guide, I've been building some models in MLCAD and would like to get some nice renders of them. Here's the problem I've found. I have both Pov-Ray 3.6 & 3.7. 3.7 is much faster than 3.6 (multi-core support), but gives different results. Here are two images, the first, lighter image is from 3.7 and the second darker image is from 3.6. I prefer the 3.6 image - any idea what settings I need to change in 3.7 to improve the image? I'm using the same *.pov file for both renders.

POV file - http://sites.google.com/site/legonxtpinball/445.pov

2s6vyj8.jpg

153mvif.jpg

cheers - mark

Share this post


Link to post
Share on other sites

I've got a little problem. Actually it isn't really a problem, but when I render, my black parts always look more like dark grey parts, maybe that's because of the lightning, I don't know, but how can I solve this?

Edited by legolijntje

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.