C3POwen

[Guide] Rendering LDraw models using POV-Ray

Recommended Posts

First post on this page, mate.

This board needs an emoticon that smashes its head with a keyboard.

Thank you, mate.

Share this post


Link to post
Share on other sites

Hopefully the invalid part references that LDView was spitting out have been fixed in the 4.2 Beta 1 release that I just announced today. Also, C3POwn, if you would be so kind as to send me your updated LGEO.xml, I'll investigate including it in the next official LDView release (with your permission).

Share this post


Link to post
Share on other sites

Hopefully the invalid part references that LDView was spitting out have been fixed in the 4.2 Beta 1 release that I just announced today. Also, C3POwn, if you would be so kind as to send me your updated LGEO.xml, I'll investigate including it in the next official LDView release (with your permission).

C3POwen hasn't been on for almost a month. Maybe you could try PMing him. :sceptic:

Share this post


Link to post
Share on other sites

C3POwen hasn't been on for almost a month. Maybe you could try PMing him. :sceptic:

I just created my account here, and it's not allowed to view other member profiles, so I don't think I'm capable of sending a PM.

Share this post


Link to post
Share on other sites

I just created my account here, and it's not allowed to view other member profiles, so I don't think I'm capable of sending a PM.

Well, I can send an PM to him if you want?

Edited by legolijntje

Share this post


Link to post
Share on other sites

I wonder when C3POwen will get around to updating this tutorial. He hasn't been around in over a week. :cry_sad:

Does the lg_colour.inc downloadable file here contain the correct colours for all the original brick colours?

It will get a bit more of an update, although not much, as a lot of the "specialist" usage of POV-Ray is better covered elsewhere.

Also, the colour file is nearly as complete as I can make it, although some "official" RGB values for transparent colours still don't look right, although I think that's more of a limitation with POV-Ray's rendering of transparent pieces, rather than the colour values.

Hopefully the invalid part references that LDView was spitting out have been fixed in the 4.2 Beta 1 release that I just announced today. Also, C3POwn, if you would be so kind as to send me your updated LGEO.xml, I'll investigate including it in the next official LDView release (with your permission).

I've removed a few elements that didn't work properly when rendering the LGEO library in POV-Ray (which seems to be an issue with the LGEO library, and not your file), so my XML file does not contain all of the elements the bundled LDView one contains, but I'm more than happy to let you have a copy. It has a much-updated set of colours, which is useful.

UPDATE: @@LDView Travis I've added my current LGEO.xml file to the Downloads section.

Edited by C3POwen

Share this post


Link to post
Share on other sites

It will get a bit more of an update, although not much, as a lot of the "specialist" usage of POV-Ray is better covered elsewhere.

Also, the colour file is nearly as complete as I can make it, although some "official" RGB values for transparent colours still don't look right, although I think that's more of a limitation with POV-Ray's rendering of transparent pieces, rather than the colour values.

I've removed a few elements that didn't work properly when rendering the LGEO library in POV-Ray (which seems to be an issue with the LGEO library, and not your file), so my XML file does not contain all of the elements the bundled LDView one contains, but I'm more than happy to let you have a copy. It has a much-updated set of colours, which is useful.

UPDATE: I've added my current LGEO.xml file to the Downloads section.

Okay, great, I'll get going with renders! Good to see you around again. Forgive me if I sound completely stupid, but where does POV-Ray get it's colours from, the .XML document or the .inc document? For some reason, I didn't quite understand what it said in the guide. Maybe my brain is a bit :sick: right now. :laugh:

Edited by palathadric

Share this post


Link to post
Share on other sites

Forgive me if I sound completely stupid, but where does POV-Ray get it's colours from, the .XML document or the .inc document? For some reason, I didn't quite understand what it said in the guide. Maybe my brain is a bit :sick: right now. :laugh:

POV-Ray looks to the lg_color.inc file for its colour definitions, BUT the colour definitions need to be available in the LGEO.xml file for them to translate properly, otherwise LDView just creates its own interpretation of the colour based on the values from LDraw and then POV-Ray ignores the relevant values in the lg_color.inc file. *Phew!*

Hope that makes some sort of sense.

I'll review what I've written and see if I can clarify it some more.

Share this post


Link to post
Share on other sites

Hope that makes some sort of sense.

Yep, perfect sense. Thanks! Maybe that's why my colours weren't looking the best even after I downloaded the .inc file. :blush:

Share this post


Link to post
Share on other sites

UPDATE: @@LDView Travis I've added my current LGEO.xml file to the Downloads section.

Thanks, C3POwen. Unfortunately, it doesn't look like I'm going to be able to include the colors as-is, since they rely on your custom lg_color.inc file. I'll have to think about whether I want to allow for a separate custom color file, and then include that with LDView.

I also investigated your removal of 51011.dat. I discovered that lg_51011 works fine as long as the POV-Ray version is set to 3.1 prior to the lg_51011.inc #include, so I think I'll add a POVVersion element to my XML syntax, and then update LDView to use that as a trigger to generate save version/update version/#include file/restore version in place of just #include file.

Share this post


Link to post
Share on other sites

Hi, all, I'm back. I have started rendering the models in POV-Ray and just wanted to ask a couple of things. Some of the round bricks, such as cannons, do not appear round in the POV-Ray rendering, apparently you can change this by using primitives. I just wanted to know what settings you use in the "Primitives" section of LDView? Also, what changes the angle of the lights. I figure it is the "LDX Radius things, but there are three different ones, so do they affect width, length, and depth, or what? I've tried esperimenting around with the figures, but I didn't see much positive improvement, so I would be interested in knowing this.

Also there seems to be an error with lg_4475.inc do you know what I can to fix this?

Sorry to bother once again.

Share this post


Link to post
Share on other sites

Hi, all, I'm back. I have started rendering the models in POV-Ray and just wanted to ask a couple of things. Some of the round bricks, such as cannons, do not appear round in the POV-Ray rendering, apparently you can change this by using primitives. I just wanted to know what settings you use in the "Primitives" section of LDView? Also, what changes the angle of the lights. I figure it is the "LDX Radius things, but there are three different ones, so do they affect width, length, and depth, or what? I've tried esperimenting around with the figures, but I didn't see much positive improvement, so I would be interested in knowing this.

Also there seems to be an error with lg_4475.inc do you know what I can to fix this?

Sorry to bother once again.

Selecting the "Primitive Substitution" option in the POV-Ray export options causes LDView to use precise POV objects to replace LDraw primitives, where possible. For example, an LDraw cylinder primitive is replaced with a POV cylinder object (properly configured), instead of being made up of triangles. This can cause gaps in the POV objects where surfaces that use primitives meet surfaces that don't, but generally looks quite good.

In addition to this, LDView has a "Smooth curves" option in the POV-Ray export options. This uses the original geometry from the LDraw file, but smooths out curves visually by giving shared surface normals for points on the curve. Unfortunately, LDView's curve smoothing algorithm isn't perfect, so sometimes surfaces that should be smoothed, aren't. However, I would definitely recommend selecting this option.

I did a quick render of the cannon (518.dat), and it looked pretty good.

LDView automatically generates three default lights. The comments next to the lights give their locations in spherical coordinates relative to the center of the model. LDXRadius is a value calculated by LDView and stored in the POV file as a variable, and it represents the radius of the smallest possible sphere centered at the model's bounding box center and encompassing the whole model. So, if you want your own lights, I would recommend putting them into a top include. The top include has access to all of the model's bounding information: LDX{Min|Max}{X|Y|Z}, LDXCenter{X|Y|Z}, LDXRadius. You'll have to do your own math to decide where to put them. If you do this, you can define LDXSkipLight{1|2|3} to prevent LDView's default lights from being used.

Share this post


Link to post
Share on other sites

Selecting the "Primitive Substitution" option in the POV-Ray export options causes LDView to use precise POV objects to replace LDraw primitives, where possible.

In addition to this, LDView has a "Smooth curves" option in the POV-Ray export options. This uses the original geometry from the LDraw file, but smooths out curves visually by giving shared surface normals for points on the curve. Unfortunately, LDView's curve smoothing algorithm isn't perfect, so sometimes surfaces that should be smoothed, aren't. However, I would definitely recommend selecting this option.

I have been working with these presets already, but the cannon is not looking great. Is there anything else that you think it could be? I could post a picture if you like, but I don't know if that would be particularly helpful.

Share this post


Link to post
Share on other sites

I have been working with these presets already, but the cannon is not looking great. Is there anything else that you think it could be? I could post a picture if you like, but I don't know if that would be particularly helpful.

Unless you're looking at a different cannon, it should look fairly good. Not perfect, but fairly good. However, some parts (like minifig heads) just don't look good, and there's not really anything you can do. Feel free to post a picture of the cannon so that I can verify you're getting the same results I got.

Share this post


Link to post
Share on other sites

I also investigated your removal of 51011.dat. I discovered that lg_51011 works fine as long as the POV-Ray version is set to 3.1 prior to the lg_51011.inc #include, so I think I'll add a POVVersion element to my XML syntax, and then update LDView to use that as a trigger to generate save version/update version/#include file/restore version in place of just #include file.

Later versions of POV-Ray require the #version x.x; declaration to be at the beginning of the file anyway, so perhaps insert this by default just after the LDView information and before the #declare LDXQual? Adding an option within LDView's POV-Ray export feature to either manually specify the version number or select a version using radio buttons (3.1, 3.6, for example) would be very useful.

Also, testing palathadric's lg_4475.inc error using #version 3.1; allowed the element to be rendered without issue, whereas anything from 3.5 upward kicked up an error.

I did a quick render of the cannon (518.dat), and it looked pretty good.

I think I've also come across why palathadric's cannon is not rendering very well:

LDraw%20cannons.png

2533c01.dat (and the incomplete 2533.dat piece) is the firing version of the cannon, whereas 518.dat is the non-firing version, and you can see from the above LDView screenshot that the firing version has not been coded in LDraw as well as the non-firing piece.

Edited by C3POwen

Share this post


Link to post
Share on other sites

Yeah, that must be it. I always use the firing cannon in my models. I hate the non-firing one with a vengeance, but perhaps I shall have to let that be in the past. :look: But what use is a cannon anyway, if it can't fire? :laugh:

I don't understand. What do I need to do to get the lg_4475.inc working properly?

Share this post


Link to post
Share on other sites

I don't understand. What do I need to do to get the lg_4475.inc working properly?

I think if you add the following to the top of your file, it will work:

#version 3.1;

The above line triggers other changes in POV's behavior, though (as far as I know), so it's possible it will change the final result. The other option is to put the above right above the #include for lg_4475.inc, and then put another #version line right below specifying whatever version of POV-Ray you have (like #version 3.7; if you're using 3.7).

Share this post


Link to post
Share on other sites

Thank you, Travis and C3POwen. I guess I'll post some pictures later on so you can critique and help me to see how I can improve them. :sweet:

Share this post


Link to post
Share on other sites

I also investigated your removal of 51011.dat. I discovered that lg_51011 works fine as long as the POV-Ray version is set to 3.1 prior to the lg_51011.inc #include, so I think I'll add a POVVersion element to my XML syntax, and then update LDView to use that as a trigger to generate save version/update version/#include file/restore version in place of just #include file.

A quick question about the references within the XML file: After installing the new beta of LDView, I noticed that a few references to "a" and "b" LDraw DAT files were still missing (such as 4032a.dat in LDraw can be assigned to use lg_4032.inc from the LGEO library). Would it be worth compiling a list of these as people come across them so that they can be added to the official LDView XML file, or perhaps email them to you via the address from the LDView site?

Share this post


Link to post
Share on other sites

A quick question about the references within the XML file: After installing the new beta of LDView, I noticed that a few references to "a" and "b" LDraw DAT files were still missing (such as 4032a.dat in LDraw can be assigned to use lg_4032.inc from the LGEO library). Would it be worth compiling a list of these as people come across them so that they can be added to the official LDView XML file, or perhaps email them to you via the address from the LDView site?

This list would definitely be useful. I plan to add all the ones that you already added to your custom LGEO.xml, but any others that are found would be good too.

Share this post


Link to post
Share on other sites

I have one question C3POwen. You use both LDD and LDraw. What would you say are the benefits of using LDD? I worked with it for a while, but found it very slow, and quite unwieldy in comparison to, say, SR 3D Builder.

Share this post


Link to post
Share on other sites

I have one question C3POwen. You use both LDD and LDraw. What would you say are the benefits of using LDD? I worked with it for a while, but found it very slow, and quite unwieldy in comparison to, say, SR 3D Builder.

IMO LDD is more user friendly and easier to get started but it's more limited in certain situation plus occasionally LDD won't let me place the part exactly where I want it. Instead LDD may assume I want it below the entire project, or off to the side 100 studs away, etc.

LDraw is a bit more tricky to get it working with all the parts as not everything are in one convenient install package and I had some trouble getting it working the first couple times. People less experienced with computer will likely find LDraw too hard to start using.

LDD has some quirks but you probably should start with LDD if you're not used to working in 3D enviroment.

Share this post


Link to post
Share on other sites

Or use sr3d builder. It "feels" like ldd, but it has all the benefits of LDraw. :thumbup:

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.