Render 3D realistic images of EAGLE circuit boards

 Posted by:   Posted on:   Updated on:  2023-01-07T21:23:00Z

POV-Ray is able to render amazing images. This time we'll use it to generate 3D images of PCBs designed with EAGLE.

Have you ever wanted to see how some of your electronic projects would look before you actually get to build them? This post will show you how to create really good-looking 3D renderings of your PCB designs that you can use in presentations, websites or only to get an idea of how it will look. The process is the following: your PCB design created with Cadsoft (now Autodesk) EAGLE is converted to a POV-Ray source file with a script. POV-Ray uses ray tracing, a rendering technique for generating an image by tracing the path of light as pixels in an image plane and simulating the effects of its encounters with virtual objects.

This is an old post that I decided to update in 2020. Unfortunately, this method was never too popular and required software is now out of date and hard to find. Most of the links are dead by now. Meanwhile, the most important software, Cadsoft EAGLE was bought by Autodesk and included in Fusion 360. Fortunately, I was able to find an official download link for EAGLE 7.4.0, released in 2015. Everything will be done in a Windows 7 virtual machine.

Arduino Mega rendered with POV-Ray

Arduino Mega rendered with POV-Ray

The first step is to download and install EAGLE. I'm not using EAGLE to design PCBs and I have no idea if newer versions still include the ULP scripting functionality. If so, it may work. Installation is straightforward, the default install folder being C:\EAGLE-7.4.0.

Let's extract and copy Eagle3D script. This is an ULP (user language program) for EAGLE. It was originally created by Matthias Weißer and the last version was released in 2011. Since it is no longer available from the original site, yet GPL licensed, here is a copy: eagle3d_20110101. You need 7-Zip to open that archive. Extract it twice until you get the eagle3d folder. Copy this folder to any location you have permission to write to. I prefer C:\EAGLE-7.4.0\ulp. Therefore, I get the path C:\EAGLE-7.4.0\ulp\eagle3d\povray. Note the path to this povray subfolder in Eagle3D, because you will need to configure POV-Ray later.

At last, let's install POV-Ray. No longer maintained, the last version is 3.7 from 2019. Fortunately, still available to download. It comes with a common installer, just accept the defaults. It will ask you to download an additional package, a DLL for the editor. Accept it, otherwise, it does not run. This one is a simple installer as well. The bad part is that the installer creates a broken shortcut in Start Menu for POV-Ray itself. You have to launch it from C:\Program Files\POV-Ray\v3.7\bin. The executable is pvengine32-sse2 (it's recommended to create a Desktop shortcut for it).

Launch POV-Ray. You should see the main window with the code editor. Click Open Ctrl + O and browse to that povray subfolder we talked about. Open e3d_special.inc. There is a bug in this file. Perform a search Ctrl + F for "0.6.5". This isn't a valid numeric constant, therefore replace it with 0.65 and you're done. Save the file and close it.

Fix 0.6.5 bug in Eagle 3D script

Fix 0.6.5 bug in Eagle 3D script

Keep POV-Ray open. Go to Tools - Edit master POVRAY.INI and, at the end of this file add the following:

Library_Path="C:\EAGLE-7.4.0\ulp\eagle3d\povray"

It's the same povray folder I've talked about (adjust the path if yours is different). Close file povray.ini. Go to Options - Script I/O Restrictions and choose No Restrictions. I recommend rendering a sample scene that is already opened (biscuit or woodbox) to familiarize with the interface. By default, a bitmap image is generated. Since this is not desired, you can pass the arguments +fn to get PNG output. I like to use also +ua to get transparent background when no other background object or texture is defined. The checkbox allows you to change image resolution. Better resolution means longer processing time. Choose one with antialiasing to get the best rendering.

POV-Ray resolution and image output settings

POV-Ray resolution and image output settings

Let's make our first PCB rendering. Open a PCB design in EAGLE and run the Ratsnest command to fill any PCB areas. Go to File - Run ULP and select 3d50.ulp from eagle3d/ulp (or browse to where you extracted Eagle 3D and find 3d50.ulp). The first time you run the script you are asked to select a language, a copyright message is shown, then you are prompted to select an output folder. This is where the pov scene file will be created, and once you render it, in this folder you will get the PNG image. I recommend making a folder in My Documents. I like to go to Board tab and add a rotation angle of 10 degrees on Y axis. Leave other options as they are in main window and click create POV-File and Exit.

Eagle 3D main window

Eagle 3D main window

Some additional dialog windows will appear if the case. One example is the manufacturer logo selection for ICs. Others are LED colours, crystal capsule height. At last, if there are parts in the current PCB design which do not have a 3D model assigned, a message box will list all of them. Nothing will appear on the PCB (unpopulated slot).

IC manufacturer logo selection dialog

IC manufacturer logo selection dialog

Open the folder where you have chosen to generate POV file and open this file with POV-Ray. Make sure a resolution with 4:3 aspect ratio is selected and hit Run. Your image should be rendering.

I took the Arduino Mega sample project from EAGLE (see the result at the top of the post). If you like how it looks, it can be rendered better than that. You can find out how to improve rendered images in this follow-up post.

1 comment :

  1. very good ... sorry, I'm still learning and interested in the tutorial on this web ...
    I tried to make it from the step file (to-264) to render a big POV image ... is there a special setting for rendering it to a POV that matches the 0riginal to-264 ....
    I hope I can help ... thank you

    ReplyDelete