C3POwen

[Guide] Rendering LDraw models using POV-Ray

Recommended Posts

Since you already managed to wait for the first pass(collection of the radiosity data) to finish, the second pass (rendering) will not be faster without radiosity. Actually rendering takes almost the same time with or without radiosity, collection of radiosity data is the extra time. And renderings with radiosity look better, especialy with some skysphere lighting image.

Hey, sorry, just back from putting my son to bed (it took time, he didn't want to sleep).

No, in the end, I stopped and made a new rendering, and it took only about 15 minutes, against the over one hour the other took (without completing).

Share this post


Link to post
Share on other sites

Another one: is there any CAD-like GUI for POV-Ray, so as to make it easier to manage the camera position and angle for the renderings?

Share this post


Link to post
Share on other sites

Use LDD. Open it when POVRay is not running, change the camera angle and position and when you're happy, save it. Then run it through LDD2POVRay. I'd suggest using low res like 320x240 so you can check if the project is correctly centered and in view before spending many hours waiting on the computer.

Share this post


Link to post
Share on other sites

Use LDD. Open it when POVRay is not running, change the camera angle and position and when you're happy, save it. Then run it through LDD2POVRay. I'd suggest using low res like 320x240 so you can check if the project is correctly centered and in view before spending many hours waiting on the computer.

Yeah, that's how I'm currently working.

I hoped there was a way to avoid switching software continuously.

Share this post


Link to post
Share on other sites

Ok, help needed!

I've tried different light setups,

The current one is with this lights setup:

light_source {
<100,100,0>
color 100/100*ldd_light_color
area_light 200, 200, 10, 10
shadowless
transform { ldd_camera_transformation }
}

light_source {
<-100,100,0>
color 100/100*ldd_light_color
area_light 200, 200, 10, 10
shadowless
transform { ldd_camera_transformation }
}

light_source {
<0,100,0>
color 100/100*ldd_light_color
area_light 200, 200, 10, 10
adaptive 1
jitter
circular
orient
transform { ldd_camera_transformation }
}

This appeared to be the only setup which didn't give me a dark picture, but there is still an issue.

Look at the rendering:

Ambushonthebridgeset_zpsfb55d565.png

Everything appears to reflect the rest of the scene, as if the bricks were all polished metal.

How can I fix it?

As side questions:

  • Is the position of lights (left/right) related to the camera, or to some absolute within the scene?
  • Is it possible to determine the exact position of an object, in order to put a light inside of it?

Share this post


Link to post
Share on other sites

Everything appears to reflect the rest of the scene, as if the bricks were all polished metal.

How can I fix it?

As side questions:

  • Is the position of lights (left/right) related to the camera, or to some absolute within the scene?
  • Is it possible to determine the exact position of an object, in order to put a light inside of it?

You can try to define custom values for definitions from ldd_finishes.inc, which allow you to define material properties.

Position of lights in POV-Ray are absolute in scene. But LDD2POVRay use lights relative to camera. That's why there is "transform { ldd_camera_transformation }". Lights are moving with camera.

Yes, it is possible to put light into object. Each brick in POV file contains 12 coordinates which represent transformation from origin. The same transformation can be used for lights. See LDD2POVRay talk for more info.

Share this post


Link to post
Share on other sites

LGEO UPDATE: I have updated the LGEO-Update.zip file in the Downloads section with 6 new parts (the magnet counts as two!) and 3 fixed parts.

LGEO%202014-11-23.png

The FIXED and NEW LGEO parts from the 2014-11-23 update

It's been a while since my last update (over five months) and progress has been slow due to other interests taking up more time, but I certainly haven't abandoned LGEO and POV-Ray. There are more parts I'd like to implement, but my handle on POV-Ray's advanced maths functions is still not as good as I'd like. :wacko:

Share this post


Link to post
Share on other sites

Once again, many thanks!

Yes, thank you for all your hard work, C3POwen.

I also wish to say "thank you" as I highly appreciate to be able to rely on these great Lgeo parts.

Thanks everyone! :blush:

I've started looking at a few more parts to add to the collection (usually based on nothing more than what takes my interest) and have already finished one since the update a couple of days ago:

lg_92690.png

(My version is the part on the right, and you might be able to make out the slight differences to the LDView-generated part on the left.)

I also have a list of about 15-20 parts I started working on but never finished, so should probably get going on those!

Share this post


Link to post
Share on other sites

How you creat parts?

I think someone asked this before, but I never got around to going into detail, so I've put together a very brief explanation of how it works below.

POV-Ray shapes are based on geometric shapes (spheres, cylinders, boxes, etc.) that are defined based on X, Y and Z coordinates, unlike other 3D programs which create shapes using polygons. Therefore to create an LGEO part for POV-Ray I have to combine various shapes to get the desired result. This can make it difficult to create complex parts, but for your basic Lego brick it works like a charm.

You can also set declarations and call them when placing your shapes. In the LGEO library, the height of a brick is set as follows:

#declare LG_BRICK_HEIGHT = 0.96;

This means that rather than setting the height of a regular brick as 0.96 or a double-height brick as 1.92, you can use LG_BRICK_HEIGHT or 2*LG_BRICK_HEIGHT.

So, as an example, here's how I would construct the classic 2x2 brick:

How to build a 2x2 LGEO brick in POV-Ray

I start with the corners of the brick. As these are rounded I use tiny spheres, four at the bottom and four at the top:

001.png

I then start connecting the spheres using cylinders:

002.png

Once complete I have a nice wire-frame-effect box:

003.png

Next I have to create the solid part of the box. For this I use three boxes set to slightly different sizes:

004.png

When I combine these I get a nice solid box with rounded edges:

005.png

Lego bricks aren't solid boxes, so I need to hollow it out underneath. For this POV-Ray has a "difference" function where you take a shape (such as the above box) and use another shape to cut away from the first one. For the Lego brick I need a box shape to create the main hollow, and four cylinders to create the holes you see underneath the studs:

006.png

I then take the above shape and use that to hollow out the main box, creating four holes in the top and a hole in the bottom:

007a.png

007b.png

Next up are the finishing touches. First I add the underside cylinder. The cylinder is pre-defined in a definitions file, so it's as simple as specifying "lg_brick_cylinder":

008.png

I then add four studs to the top to get the final 2x2 brick. Again, the stud is a pre-defined part, so I can simply add four of them at the appropriate positions (although I use a macro for setting multiple studs):

009.png

And we're done!

You can add further details, but this is basically how LGEO parts are created.

As time has gone on I've created various macros (such as one mentioned above) and tried to increase some details (like the small seams that show where the stud joins the brick), but the core of it is based on spheres, cylinders, boxes, etc.

I hope that goes some way to explaining!

BONUS: Here's what the above part looks like when it's been dissected down the middle:

010.png

Share this post


Link to post
Share on other sites

Thanks for explaining your work. Most interesting! I would never have expected that LGEO is based on Povray. As I now have a better understanding of LGEO parts being mostly handcrafted, I will even more appreciate using LGEO.

Share this post


Link to post
Share on other sites

C3POwen,

That’s seems like a lot of work. i cannot imagine doing a more complex(geometrically speaking) model.

Do you know if there is a way to use a 3d modeling application and then convert it to ldraw format?

Edited by TotalyWicked

Share this post


Link to post
Share on other sites

I was attempting to render a model today and ran into this error:

...line 987: Parse Error: Expected

'undeclared identifier', float function 'float constant' found instead

Render failed

Here is the offending line (and those after it, if it matters):

#declare 48/LDX_48_slash_t08o5000_dot_dat_in_part = torus // Torus 0.125

{

1,0.5

clipped_by

{

plane

{

<0,0,-1>,0

}

plane

{

<-0.70710678118654746,0,0.70710678118654757>,0

}

difference

{

cylinder

{

<0,0,0>,<0,1,0>,2 }

cylinder

{

<0,0,0>,<0,1,0>,1 }

}

}

}

I'm fairly certain that the part in question is this one.

Does anyone know of a workaround or fix for this error? I seem to recall getting it before and finding one, but I honestly don't remember how.

Share this post


Link to post
Share on other sites

I'm fairly certain that the part in question is this one.

Does anyone know of a workaround or fix for this error? I seem to recall getting it before and finding one, but I honestly don't remember how.

It does indeed appear to be this part.

The problem is that LDView exports the torus used in this part as "48/LDX_48_slash_t08o5000_dot_dat_in_part", and it is the "48/" that is causing the problem. POV-Ray thinks you are trying to divide 48 by "LDX_48_slash_t08o5000_dot_dat_in_part", which is impossible!

There are two work-arounds for this:

  1. Export the model from LDView with "Primitive Substitution" turned off.
  2. Keep "Primitive Substitution" turned on and modify the POV-Ray file.

To turn off Primitive Substitution, open your model in LDView and do the following:

  • Select "File > Export..."
  • Click "Options..."
  • Under "Geometry" untick "Primitive Substitution"
  • Click "OK"
  • Click "Save" to export your model

Alternatively, to fix the problem within the POV-Ray file, do the following:

  • Select "Search > Replace..."
  • In the "Find" field type "48/LDX" (without quotes)
  • In the "Replace with" field, type "LDX" (without quotes)
  • Click "Replace All"
  • Click "Save"

Hopefully this will fix it for you!

I would recommend using the first option, as you only have to remember to turn it off once, and it won't affect your renders too much.

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

I'm creating my "Pov-Ray friendly" parts into Catia. I don't like that much LGEO's syntax, and found it easier to work directly in LDU units. I'm also able to create complexe shapes and smooth everything even on wavy edges.

Problems is that what I'm making is meshes, and some of my parts weight more than 50MB (my .inc files or sometimes more than 1 million lines).

I would love to share them, but my custom LGEO library is more than 1GB...

If someone is interested, I can maybe try to rar it, to see how much it goes.

I can share them in my onedrive if you like. I have 50gb in Onedrive and I don't see that getting full anytime soon. :classic:

Share this post


Link to post
Share on other sites

This guide is terrific! I've had much good use of it when learning how to render.

Anyway, I have a texture issue when rendering certain base plates. I use SR3D Builder for construction, then LDView and POV-Ray 3.7 for the rendering (as described in this guide).

As you can see in the image attached I get a weird texture problem on the baseplates. Note the white/green "noise" around the edges of the pave and in the middle "island", and how the lines doesn't follow the edge of the green areas like it should or bend at the end of the road. It's like the actual road pattern has been mirrored or something... It is not supposed to look like this. Anyone who has experienced the same thing or has any ideas?

I have drawn some arrows to point out what I mean:

1iN4BWV.png

Share this post


Link to post
Share on other sites

Hello all,

I've been out of the game for a year or so but am jumping back in. Is POVRay still the best way to render? I see it hasn't been updated for quite some time.

Share this post


Link to post
Share on other sites

POV-Ray hasn't seen major updates in years and really looks like an outdated piece of software today.

That being said, I would still rate it the best rendering software for LDraw when you factor in the quality of faster rendering solutions (bluerender) or the amount of work (not to mention the price of the software) needed to export LDRaw to Blender and create renderings in MODO like virtualrepublic did.

I can render an image like this (2560 x 1440 pixels) in about one hour with very few adjustments needed and I'm quite happy with the result:

22138379173_babddcf116_c.jpg

LEGO MAN TGS Hooklift Truck - Wechselladerfahrzeug by Niklas-B, auf Flickr

Share this post


Link to post
Share on other sites

Okay, this seems like a silly question since I have installed this in the past. But I got a new computer and had to reinstall everything. The only thing I don't have back on is the updated color files. So I grabbed the update. At simple enough, its instructions:

Firstly, all files that begin with “lg_” need to be copied to LGEO’s “lg” folder. If you have installed LGEO via the LDraw All-in-One Installer, it should be found at the following location:

C: \Programs Files\LDraw\LGEO \lg

If you have installed it elsewhere, then you will need to locate this folder. Also, if you are using a 64-bit operating system, the “Program Files” folder will be named “Program Files (x86)”.

But when I go to drop all the "lg_" files in place, I can't find an "lg" folder in my LDraw folder. Did I not install LGEO? or has the location changed? or am I missing something here?

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.