Jump to content


[Guide] Rendering LDraw models using POV-Ray

LDraw POV-Ray Rendering render

  • Please log in to reply
420 replies to this topic

#76 TK-949

TK-949

    Posts: 19
    Joined: 28-February 12
    Member: 26994

Posted 02 April 2012 - 12:06 AM

 palathadric, on 01 April 2012 - 11:09 PM, said:

First post on this page, mate.


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

Thank you, mate.

#77 DLuders

DLuders

  • Technic Technician


    Posts: 5817
    Joined: 17-October 09
    Member: 7868
    Country: USA (WA State)

Posted 02 April 2012 - 01:57 AM

Posted Image

#78 Palathadric

Palathadric

  • Makes other members' internet speeds seem ridiculously fast


    Posts: 5135
    Joined: 30-July 11
    Member: 19379
    Country: Great Unknown

Posted 02 April 2012 - 07:35 PM

 DLuders, on 02 April 2012 - 01:57 AM, said:

Posted Image
Nice one. :thumbup:  :laugh:
They that love God will never meet for the last time.
This life isn't the end. We will meet again.
Posted Image     Posted Image     Posted Image
Brickshelf Account
See my work in the Official Lego sets made in LDraw topic

#79 LDView Travis

LDView Travis

    Posts: 19
    Joined: 09-April 12
    Member: 27850

Posted 09 April 2012 - 03:10 AM

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).

#80 Palathadric

Palathadric

  • Makes other members' internet speeds seem ridiculously fast


    Posts: 5135
    Joined: 30-July 11
    Member: 19379
    Country: Great Unknown

Posted 09 April 2012 - 06:47 AM

 LDView Travis, on 09 April 2012 - 03:10 AM, said:

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:
They that love God will never meet for the last time.
This life isn't the end. We will meet again.
Posted Image     Posted Image     Posted Image
Brickshelf Account
See my work in the Official Lego sets made in LDraw topic

#81 LDView Travis

LDView Travis

    Posts: 19
    Joined: 09-April 12
    Member: 27850

Posted 10 April 2012 - 03:21 AM

 palathadric, on 09 April 2012 - 06:47 AM, said:

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.

#82 legolijntje

legolijntje

    Posts: 1928
    Joined: 06-June 10
    Member: 11214
    Country: The Netherlands

Posted 10 April 2012 - 07:58 AM

 LDView Travis, on 10 April 2012 - 03:21 AM, said:

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, 10 April 2012 - 07:58 AM.


#83 C3POwen

C3POwen

    Posts: 398
    Joined: 01-November 10
    Member: 14029
    Country: United Kingdom

Posted 16 April 2012 - 06:24 PM

 palathadric, on 24 March 2012 - 12:13 AM, said:

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.

 LDView Travis, on 09 April 2012 - 03:10 AM, said:

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, 16 April 2012 - 06:57 PM.


#84 Palathadric

Palathadric

  • Makes other members' internet speeds seem ridiculously fast


    Posts: 5135
    Joined: 30-July 11
    Member: 19379
    Country: Great Unknown

Posted 17 April 2012 - 11:17 AM

 C3POwen, on 16 April 2012 - 06:24 PM, said:

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, 17 April 2012 - 11:22 AM.

They that love God will never meet for the last time.
This life isn't the end. We will meet again.
Posted Image     Posted Image     Posted Image
Brickshelf Account
See my work in the Official Lego sets made in LDraw topic

#85 C3POwen

C3POwen

    Posts: 398
    Joined: 01-November 10
    Member: 14029
    Country: United Kingdom

Posted 17 April 2012 - 05:34 PM

 palathadric, on 17 April 2012 - 11:17 AM, said:

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.

#86 Palathadric

Palathadric

  • Makes other members' internet speeds seem ridiculously fast


    Posts: 5135
    Joined: 30-July 11
    Member: 19379
    Country: Great Unknown

Posted 17 April 2012 - 10:52 PM

 C3POwen, on 17 April 2012 - 05:34 PM, said:

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:
They that love God will never meet for the last time.
This life isn't the end. We will meet again.
Posted Image     Posted Image     Posted Image
Brickshelf Account
See my work in the Official Lego sets made in LDraw topic

#87 LDView Travis

LDView Travis

    Posts: 19
    Joined: 09-April 12
    Member: 27850

Posted 23 April 2012 - 06:26 PM

 C3POwen, on 16 April 2012 - 06:24 PM, said:

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.

#88 Palathadric

Palathadric

  • Makes other members' internet speeds seem ridiculously fast


    Posts: 5135
    Joined: 30-July 11
    Member: 19379
    Country: Great Unknown

Posted 11 May 2012 - 08:51 PM

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.
They that love God will never meet for the last time.
This life isn't the end. We will meet again.
Posted Image     Posted Image     Posted Image
Brickshelf Account
See my work in the Official Lego sets made in LDraw topic

#89 LDView Travis

LDView Travis

    Posts: 19
    Joined: 09-April 12
    Member: 27850

Posted 11 May 2012 - 09:12 PM

 palathadric, on 11 May 2012 - 08:51 PM, said:

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.

#90 Palathadric

Palathadric

  • Makes other members' internet speeds seem ridiculously fast


    Posts: 5135
    Joined: 30-July 11
    Member: 19379
    Country: Great Unknown

Posted 12 May 2012 - 01:45 AM

 LDView Travis, on 11 May 2012 - 09:12 PM, said:

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.
They that love God will never meet for the last time.
This life isn't the end. We will meet again.
Posted Image     Posted Image     Posted Image
Brickshelf Account
See my work in the Official Lego sets made in LDraw topic

#91 LDView Travis

LDView Travis

    Posts: 19
    Joined: 09-April 12
    Member: 27850

Posted 12 May 2012 - 02:14 AM

 palathadric, on 12 May 2012 - 01:45 AM, said:

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.

#92 C3POwen

C3POwen

    Posts: 398
    Joined: 01-November 10
    Member: 14029
    Country: United Kingdom

Posted 12 May 2012 - 10:17 AM

 LDView Travis, on 23 April 2012 - 06:26 PM, said:

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.

 LDView Travis, on 11 May 2012 - 09:12 PM, said:

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:

Posted Image

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, 12 May 2012 - 03:55 PM.


#93 Palathadric

Palathadric

  • Makes other members' internet speeds seem ridiculously fast


    Posts: 5135
    Joined: 30-July 11
    Member: 19379
    Country: Great Unknown

Posted 12 May 2012 - 09:04 PM

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?
They that love God will never meet for the last time.
This life isn't the end. We will meet again.
Posted Image     Posted Image     Posted Image
Brickshelf Account
See my work in the Official Lego sets made in LDraw topic

#94 LDView Travis

LDView Travis

    Posts: 19
    Joined: 09-April 12
    Member: 27850

Posted 12 May 2012 - 09:59 PM

 palathadric, on 12 May 2012 - 09:04 PM, said:

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).

#95 Palathadric

Palathadric

  • Makes other members' internet speeds seem ridiculously fast


    Posts: 5135
    Joined: 30-July 11
    Member: 19379
    Country: Great Unknown

Posted 12 May 2012 - 10:23 PM

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:
They that love God will never meet for the last time.
This life isn't the end. We will meet again.
Posted Image     Posted Image     Posted Image
Brickshelf Account
See my work in the Official Lego sets made in LDraw topic

#96 C3POwen

C3POwen

    Posts: 398
    Joined: 01-November 10
    Member: 14029
    Country: United Kingdom

Posted 13 May 2012 - 03:38 PM

 LDView Travis, on 23 April 2012 - 06:26 PM, said:

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?

#97 LDView Travis

LDView Travis

    Posts: 19
    Joined: 09-April 12
    Member: 27850

Posted 13 May 2012 - 06:16 PM

 C3POwen, on 13 May 2012 - 03:38 PM, said:

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.

#98 Palathadric

Palathadric

  • Makes other members' internet speeds seem ridiculously fast


    Posts: 5135
    Joined: 30-July 11
    Member: 19379
    Country: Great Unknown

Posted 17 May 2012 - 09:46 PM

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.
They that love God will never meet for the last time.
This life isn't the end. We will meet again.
Posted Image     Posted Image     Posted Image
Brickshelf Account
See my work in the Official Lego sets made in LDraw topic

#99 Lego Otaku

Lego Otaku

    Posts: 1011
    Joined: 16-September 10
    Member: 13293

Posted 18 May 2012 - 04:19 AM

 palathadric, on 17 May 2012 - 09:46 PM, said:

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.

#100 legolijntje

legolijntje

    Posts: 1928
    Joined: 06-June 10
    Member: 11214
    Country: The Netherlands

Posted 18 May 2012 - 08:35 AM

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





Also tagged with one or more of these keywords: LDraw, POV-Ray, Rendering, render

2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users