[Video] Render 3D images of EAGLE PCB projects

Published on November 27, 2015 . Updated on: -
This is a video follow-up of my previous tutorial about EAGLE and POV-Ray. I will outline below the main steps that you will see in the video and I will continue to improve the result at the end of this post.

If you haven't read about this before, EAGLE is a schematic capture and circuit board design software. The circuit boards can be processed with a set of scripts and converted into POV-Ray files. In this way you can render great looking 3D pictures of the circuit boards. All used software is available for all major operating systems. The video presents only Linux Ubuntu installation and configuration.

EAGLE circuit board rendered with POV-Ray HDR lighting
Here are the main steps required to generate the images:
  1. Download and install CadSoft EAGLE.
  2. Download and unarchive Eagle3D.
  3. Fix Eagle3D bug in 'e3d_special.inc' (replace 0.6.5 with 0.65).
  4. Install POV-Ray (from repositories).
  5. Copy user configuration files (from system-wide folders).
  6. Download an HDRI image.
  7. Download a background texture.
  8. Create the 'e3d_hdr.inc" file.
  9. Edit '3d50.ulp' to:
    • change POV-Ray file version;
    • add include directive for 'e3d_hdr.inc';
    • change light definitions default value (lgt1_inf[10]);
  10. Open EAGLE PCB project and run '3d50.ulp'.
  11. Launch the generated script.
  12. Wait for the rendering process to complete.
Steps 1-9 are the configuration steps. Follow 10-12 each time you want to render a image.

At the end of this video I ended up with the following image:

POV-Ray rendered circuit board

OK. So what can be improved here?
  • There are four missing parts (two electrolytic capacitors and two preset resistors).
  • Improve the saturation for the transistors body and the pinheaders.
  • Replace the 1N4148 diode model with a better one.
  • Adjust a bit the board color.

Missing parts

If you missed the information dialog displayed when you run 3d50.ulp you can find the message in the *.pov.none.txt file which should be in the same folder with the POV-Ray file and the bash script. My file looks like:
Parts not found in 3dpack.dat or 3dusrpac.dat are:
//C8 1u/16V E2-4
//C9 1u/16V E2-4
//P1 2k5 LI10
//P2 1k LI10
This situation can be easily solved because the missing parts are defined by POV-Ray macros but are not assigned to EAGLE packages. The assignments list is 3dpack.dat (in the ulp folder) and if we open it we will find lines like below:
E2-5:0:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:CAP_DIS_ELKO_2MM_5MM(:Elko 2mm Pitch, 5mm Durchmesser, 11mm Hoehe:Elko 2mm Pitch, 5mm  Diameter, 11mm High
E2,5-5:0:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:CAP_DIS_ELKO_2MM5_5MM(:Elko 2,5mm Pitch, 5mm Durchmesser, 11,2mm Hoehe:Elko 2,5mm Pitch, 5mm  Diameter, 11,2mm High
In these lines, E2-5 and E2,5-5 are EAGLE package names and CAP_DIS_ELKO_2MM_5MM and CAP_DIS_ELKO_2MM5_5MM are POV-Ray macro names. Suppose I want to modify the electrolytic capacitor, I will look for CAP_DIS_ELKO_2MM_5MM in all the included files from povray folder (it will be in e3d_cap.inc).

I want an E2-4 capacitor but I cannot simply duplicate one of these lines and use the macro CAP_DIS_ELKO_2MM_4MM. It probably doesn't exist and I will end up with an error. So let's look it up in e3d_cap.inc.
#macro CAP_DIS_ELKO_2MM_5MM(value)
#macro CAP_DIS_ELKO_2MM5_5MM(value)
#macro CAP_DIS_ELKO_2MM5_6MM3(value)
We can see that all capacitors macro call a generic macro with different parameters. I guess for the E2-4 capacitor I could write:
#macro CAP_DIS_ELKO_2MM_4MM(value)
Feel free to experiment with these. You're editing text files and you can come back anytime later if the result is not as expected.

Now I have a macro for my part. But I must tell Eagle3D that I have it. So I add a new line in 3dpack.dat like this:
E2-4:0:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:CAP_DIS_ELKO_2MM_4MM(:Elko 2mm Pitch, 5mm Durchmesser, 11mm Hoehe:Elko 2mm Pitch, 5mm  Diameter, 11mm High
Now let's move to the preset resistors. I guess that LI10 is the same as PT-10 so all I do is duplicate PT-10 line and replace it with LI10 like this:
First line is the original one and the second is my modified copy of it. Let's hope for the best and re-run the 3d50.ulp script (from EAGLE!). Any modification made to files in the ulp folder require re-running the script from EAGLE. Modifications made to POV-Ray include directory require only a new render.

Note: In the video, it is said you shouldn't check that box to automatically call POV-Ray and render the image. I just did it and it works great (unless there are syntax errors or not found included files).

EAGLE PCB rendered with POV-Ray HDRI

Well, so far so good. Missing parts fitted perfectly. Note that certain numbers from those strange lines in 3dpack.dat represent parts coordinates that cab be used to place the part correctly on the PCB.

Things won't always work as smooth as here. Sometimes, you will have to create the macro from scratch. For this you will need some knowledge of POV-Ray language.


I don't like presets, pinheaders, ceramic capacitors and transistors. I need to find their macros and see what color/texture they use and change it.

Open the main pov file (the one resulted after running the ULP) and search for #if(pcb_parts=on). Everything that's between this and the first #end represents parts included in the current board. Here is how one part declaration looks like:
#ifndef(pack_IC1) #declare global_pack_IC1=yes; object {TR_TO92_G("78L05Z",)translate<0,0,0> rotate<0,0.000000,0>rotate<0,-180.000000,0> rotate<0,0,0> translate<18.415000,0.000000,93.980000>}#end  //TO92 bend vertical IC1 78L05Z TO92
I emphasized macro name which I will look up in e3d_transistor.inc (if it isn't there, where else should it be?). Looking at the code, the author left some useful comments:
// plastic body
 difference{                                                                                  //Transistorkoerper
  cylinder{<0,14,0><0,19.2,0>2.4 pigment{ Gray30}translate<0.12,0,0>}
            box{<-3,13.9,-1><3,20,-3> pigment{ Gray30}}}
All I have to do is replace Gray30 with a darker shade of gray. Let's try with Gray10. it looks good. Now I have to do the same for the pinheaders (in e3d_connector.inc, macro #macro PH()) and presets (in e3d_resistor.inc, macro #macro RES_DIS_TRIM_PT10_BODY(value)).

Ceramic capacitors and the other transistor need this too. For the transistor (BFY90) I used the col_silver texture that is used for solder too. I replaced pigment{P_Silver3} with texture{col_silver}. For the capacitors I replaced the Yellow pigment with Orange.

I will also edit board colors using Jaime Vives Piqueres instructions. They are declared in e3d_tools.inc. This is the preliminary result:

EAGLE PCB rendered with POV-Ray HDRI lighting


I don't like the diode capsule so I will replace it. I got the macro from here. The original macro name is DIODE_DIS_DO35_076MM_H and EAGLE package is DO35-7. The new macro is DIODE_DO35_7_UVEG. I will just copy the entire macro code to my e3d_diode.inc and replace name in POV-Ray file.

Other tweaks

  • Rotated board: #local pcb_rotate_y = -10;
  • Set resistor color to blue: #declare global_res_col = 2;
  • Added focus blur to camera: focal_point < 0, 0, -3> aperture 0.7 blur_samples 20
The result is the first image in this post. Here is another one with a different HDR:

EAGLE PCB rendered with POV-Ray HDRI lighting

What's next? POV-Ray can be configured to render successive images with a variable parameter in order to make a short video.

From the same category:

Share this page:


Post a Comment

Please read the comments policy before posting.