Jump to content


[Guide] Rendering LDraw models using POV-Ray

LDraw POV-Ray Rendering render

  • Please log in to reply
445 replies to this topic

#126 Palathadric

Palathadric

  • Makes other members' internet speeds seem ridiculously fast


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

Posted 27 May 2012 - 11:38 PM

View PostC3POwen, on 27 May 2012 - 11:39 AM, said:

GUIDE UPDATE: I have updated the lg_color.inc file so that transparent neon colours do not appear so bright or washed out.
If you modified the lg_color.inc file does that mean that there is also a new LGEO.xml file that I need to download? I know you explained this to me already, but from what I understand, maybe I should read over it again, is that the changes on this file would not do anything unless I have a new LGEO.xml as well, right?
Currently playing in TinyPiesRUs' "Ragarnok Now 3" Mafia Game as Patrekr the Red.

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

#127 C3POwen

C3POwen

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

Posted 28 May 2012 - 09:34 AM

View PostPalathadric, on 27 May 2012 - 11:38 PM, said:

If you modified the lg_color.inc file does that mean that there is also a new LGEO.xml file that I need to download? I know you explained this to me already, but from what I understand, maybe I should read over it again, is that the changes on this file would not do anything unless I have a new LGEO.xml as well, right?
As I've only modified some of the colour definitions, and not added any new ones, you don't need to download the LGEO.xml file again.

If you need to download a different version again, I'll make sure it's clear.

#128 Palathadric

Palathadric

  • Makes other members' internet speeds seem ridiculously fast


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

Posted 28 May 2012 - 09:55 AM

Ah, thanks for explaining. I must have missed this the first time around. I have the feeling I will need to go back and render all my models again. :cry_sad:
Nah! I didn't really use many transparent neon colours. :sweet:

Edited by Palathadric, 28 May 2012 - 09:55 AM.

Currently playing in TinyPiesRUs' "Ragarnok Now 3" Mafia Game as Patrekr the Red.

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

#129 C3POwen

C3POwen

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

Posted 28 May 2012 - 01:55 PM

View PostPalathadric, on 21 May 2012 - 10:18 PM, said:

For some reason piece 2539 gets rotated by 90 degrees on its X axis somewhere between LDView and POV-Ray. In LDView I still see it properly, but when I render the model it comes out the rotated, any idea why this is?

View PostLDView Travis, on 22 May 2012 - 12:31 AM, said:

The LEGO logo on studs is rotated 90 degrees vs. in LDView; LDView uses the orientation from the LDraw file, and while that's likely to be correct, it's not guaranteed. There's no way in LGEO.xml to rotate the rest of the geometry of the part without rotating the studs.)
I know this was brought up last week, but it appears that the stud orientation is correct in the LGEO file, and incorrect in LDraw.

If it's of use, I've attached a zip file containing a corrected LDraw DAT file.

Attached Files


Edited by C3POwen, 28 May 2012 - 02:02 PM.


#130 Palathadric

Palathadric

  • Makes other members' internet speeds seem ridiculously fast


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

Posted 28 May 2012 - 03:54 PM

So with this I won't need to change the rotation in POV-Ray, right?
Currently playing in TinyPiesRUs' "Ragarnok Now 3" Mafia Game as Patrekr the Red.

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

#131 LDView Travis

LDView Travis

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

Posted 28 May 2012 - 06:20 PM

View PostPalathadric, on 28 May 2012 - 03:54 PM, said:

So with this I won't need to change the rotation in POV-Ray, right?

No. C3POwen just rotated the studs, not the rest of the part. Rotating the rest of the part would cause it to no longer match the official one, which would break any models using it. The LGEO part is wrong, so my posted LGEO.xml fix is still needed.

C3POwen's fix is only visible if you have stud logo textures enabled in LDView, or have a custom stud primitive that includes the "LEGO" text.

#132 C3POwen

C3POwen

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

Posted 28 May 2012 - 06:38 PM

View PostPalathadric, on 28 May 2012 - 03:54 PM, said:

So with this I won't need to change the rotation in POV-Ray, right?

View PostLDView Travis, on 28 May 2012 - 06:20 PM, said:

No. C3POwen just rotated the studs, not the rest of the part. Rotating the rest of the part would cause it to no longer match the official one, which would break any models using it. The LGEO part is wrong, so my posted LGEO.xml fix is still needed.
The DAT file is for LDraw/LDView only and, like LDView Travis said, it only fixes the stud rotation.

If you want a fixed LGEO part, I have modified the default "lg_2539.inc" file to rotate the entire part by 90 degrees, so should now match the official part when exporting models directly from LDView to POV-Ray.

All you need to do is download the below file and save it to the "C:\Program Files\LDraw\LGEO\lg" folder (or wherever LGEO is installed), overwriting the previous version. This means you don't have to modify the LGEO.xml file, but if you reinstall LGEO, it will overwrite my modified version.

DOWNLOAD: lg_2539.inc

If it's useful, I can post any other "broken" LGEO files that I come across and am able to fix. The actual POV-Ray language it's written in is a bit beyond me, but I can often work out what needs to be changed to fix a file.

#133 Palathadric

Palathadric

  • Makes other members' internet speeds seem ridiculously fast


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

Posted 28 May 2012 - 11:49 PM

So I just replace the .inc file and the renders should come out perfectly? And then the .dat file is so the bricks will look perfectly in LDraw, but it doesn't affect renders at all, I guess?
Yes, it probably would be great if there were any other files that need fix-ups. If I run into any errors, I will definitely let you know. :sweet:  Thanks, again!
Currently playing in TinyPiesRUs' "Ragarnok Now 3" Mafia Game as Patrekr the Red.

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

#134 C3POwen

C3POwen

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

Posted 03 June 2012 - 12:02 PM

GUIDE UPDATE: I have now added a section on radiosity, although there are as of yet no example images and some information needs to be added regarding floor settings.

I also plan on adding render time, and have added a note at the beginning of the tutorial in regards to this.

I'm also toying with changing the example model to something a bit more recent/complex. Suggestions welcome.

EDIT: I think I'm going to use the tipper from 4201 Loader and Tipper.

EDIT 2: I have also added some fixed and new LGEO parts to the guide.

Edited by C3POwen, 04 June 2012 - 10:23 AM.


#135 C3POwen

C3POwen

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

Posted 06 June 2012 - 04:22 PM

GUIDE UPDATE: I have added a zip file containing more new LGEO parts, as well as modified lg_color.inc and LGEO.xml files, alongside some simple instructions on how to install them.

#136 Calabar

Calabar

    Posts: 2378
    Joined: 11-April 10
    Member: 10232
    Country: Italy

Posted 06 June 2012 - 04:43 PM

Great Work C3POwen.
Do you think the guide could be considered "complete" now, even if still a work in progress?
"Official LEGO Sets made in LDD" topic: Read guidelines before posting!

#137 C3POwen

C3POwen

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

Posted 06 June 2012 - 05:08 PM

View PostCalabar, on 06 June 2012 - 04:43 PM, said:

Great Work C3POwen.
Do you think the guide could be considered "complete" now, even if still a work in progress?
Thanks, Calabar!

I would say it is pretty much complete. The only other thing that could be added is a section about HDR lighting, but I've yet to get this working to my satisfaction yet.

For those that are wondering what HDR lighting is, it involves creating a giant sphere around that model and mapping an image on to the sphere, and using this as part of the light source so that you get realistic-looking reflections.

The test renders that I've tried this with come out with colours that look too dark and washed out, and adding extra lights does not seem to help.

#138 Palathadric

Palathadric

  • Makes other members' internet speeds seem ridiculously fast


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

Posted 06 June 2012 - 09:16 PM

Good work, C3POwen! This has been a fantastic guide!
Currently playing in TinyPiesRUs' "Ragarnok Now 3" Mafia Game as Patrekr the Red.

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

#139 whitew0lf

whitew0lf

    Posts: 21
    Joined: 17-January 12
    Member: 24397

Posted 07 June 2012 - 08:27 AM

Okay everybody. Since I have a lot of work to do in my workplace, I have less time to render LEGO models, and adjust POV-Ray settings,so I will now post my render settings that I used. Use it, adjust it, enjoy it :)

PS: I usually copy these lines after camera settings, replace the original lights created by Ldraw. I rendered the model in 3200x2400 and then resize it with Photoshop bicubic option to 1600x1200.

//Radiosity
global_settings{
assumed_gamma  1.4
max_trace_level 10
radiosity
{
	pretrace_start 0.08
	  pretrace_end   0.005
	  count  800
	  nearest_count 1
	  error_bound 0.02
	  recursion_limit 1
	  low_error_factor 0.2
	  gray_threshold 0
	  minimum_reuse 0.015
	  brightness 1.0
	  adc_bailout 0.01/2
	}
}

//Light
light_source {
	  <1.5*LDXRadius,-2*LDXRadius,-1.5*LDXRadius> + LDXCenter	
  color rgb .4	
	  area_light 200, 200, 10, 10
	  adaptive 1
	  jitter
	  circular
	  orient
	}

//HDRI lighting
sphere {
  <0,0,0>,10000		  
  pigment {
	image_map { hdr "rnl_probe.hdr" once interpolate 2 map_type 7 }
  }
  finish { ambient 1 diffuse 0 }
  hollow
}

Edited by Calabar, 07 June 2012 - 05:47 PM.
Added "code" tag


#140 LDView Travis

LDView Travis

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

Posted 07 June 2012 - 05:28 PM

View Postwhitew0lf, on 07 June 2012 - 08:27 AM, said:

PS: I usually copy these lines after camera settings, replace the original lights created by Ldraw. I rendered the model in 3200x2400 and then resize it with Photoshop bicubic option to 1600x1200.

Note: you should be able to put this code into an include file, set that file as the top include in LDView's export settings, and then add the following to the include file to have LDView's generated lights be ignored:

#declare LDXSkipLight1 = 1;
#declare LDXSkipLight2 = 1;
#declare LDXSkipLight3 = 1;


#141 C3POwen

C3POwen

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

Posted 07 June 2012 - 06:00 PM

View Postwhitew0lf, on 07 June 2012 - 08:27 AM, said:

I usually copy these lines after camera settings, replace the original lights created by Ldraw. I rendered the model in 3200x2400 and then resize it with Photoshop bicubic option to 1600x1200.

// Radiosity
global_settings {
		assumed_gamma 1.4
}
I've been doing a bit of reading on the gamma of the lg_color.inc file, and it looks like it may need tweaking to be able to render at different gamma settings, but will add something later for those that need it.

Your settings are also almost identical to the Radiosity_Final macro included with POV-Ray, but with a few tweaks. I'll have to give them a go and see how they turn out!

View PostLDView Travis, on 07 June 2012 - 05:28 PM, said:

Note: you should be able to put this code into an include file, set that file as the top include in LDView's export settings, and then add the following to the include file to have LDView's generated lights be ignored:

#declare LDXSkipLight1 = 1;
#declare LDXSkipLight2 = 1;
#declare LDXSkipLight3 = 1;
I think I'm going to add this to the guide, as it's a useful thing to use, rather than manually deleting the lights. Thanks, LDView Travis!

#142 FMP

FMP

    Posts: 18
    Joined: 16-June 12
    Member: 29229

Posted 16 June 2012 - 02:11 PM

Hey man , I have some troubles with POV-Ray ...
When I complete my model in MLCad , I convert it to .pov file & then ready to render it but ...
The trouble is : POV-Ray often render image in low-res : 320x240 ( although I set resolution to 1280x1024 - [1280x1024, AA 0.3] )

Low-res problem ?

Posted Image

LDView :

Posted Image

Hope you guys will help me , " I'm Noob " ...

Edited by FMP, 16 June 2012 - 02:28 PM.


#143 C3POwen

C3POwen

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

Posted 17 June 2012 - 11:06 AM

View PostFMP, on 16 June 2012 - 02:11 PM, said:

When I complete my model in MLCad , I convert it to .pov file & then ready to render it but ...
The trouble is : POV-Ray often render image in low-res : 320x240 ( although I set resolution to 1280x1024 - [1280x1024, AA 0.3] )
Have you checked the quickres.ini file to make sure that the resolution preset has not been altered to something else by accident?

You should be able to do this from Tools > Edit resolution INI file within POV-Ray.

[You may also want to resize the images you posted, so they stay within the 800x600 limit on Eurobricks.]

#144 FMP

FMP

    Posts: 18
    Joined: 16-June 12
    Member: 29229

Posted 17 June 2012 - 12:47 PM

View PostC3POwen, on 17 June 2012 - 11:06 AM, said:

Have you checked the quickres.ini file to make sure that the resolution preset has not been altered to something else by accident?

You should be able to do this from Tools > Edit resolution INI file within POV-Ray.

[You may also want to resize the images you posted, so they stay within the 800x600 limit on Eurobricks.]

@C3P - Thank for your reply ...
Can you explain more detail ? - I'm using default quickres.ini of POV-Ray
Sometimes POV-Ray render with nice result - " rarely " ( high-res ) & sometime it render with low-res ,I don't know why ?

I try to render your model with same result :  :oh3:

Posted Image

Edited by FMP, 17 June 2012 - 12:54 PM.


#145 C3POwen

C3POwen

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

Posted 17 June 2012 - 03:08 PM

View PostFMP, on 17 June 2012 - 12:47 PM, said:

Sometimes POV-Ray render with nice result - " rarely " ( high-res ) & sometime it render with low-res ,I don't know why ?

I try to render your model with same result :oh3:
Can you attach one of your *.pov files in a zip file, so I can see if there's anything odd going on in it? It looks like something isn't working properly in POV-Ray.

Looking at the file will help me determine if it's a declaration in the file that's causing a problem, or POV-Ray itself.

Could you also copy the details of the "Messages" pane into a text document (open the "Messages" tab, go to Edit > Copy Pane and then paste into a text file) and include that in the zip file as well?

#146 FMP

FMP

    Posts: 18
    Joined: 16-June 12
    Member: 29229

Posted 17 June 2012 - 03:43 PM

View PostC3POwen, on 17 June 2012 - 03:08 PM, said:

Can you attach one of your *.pov files in a zip file, so I can see if there's anything odd going on in it? It looks like something isn't working properly in POV-Ray.

Looking at the file will help me determine if it's a declaration in the file that's causing a problem, or POV-Ray itself.

Could you also copy the details of the "Messages" pane into a text document (open the "Messages" tab, go to Edit > Copy Pane and then paste into a text file) and include that in the zip file as well?

Thank for your help ...  :thumbup:
This is my files : [199KB] - http://www.mediafire...1sl1b83rjb15gfj
Hope that you will reply soon ... :thumbup:

#147 C3POwen

C3POwen

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

Posted 17 June 2012 - 04:33 PM

View PostFMP, on 17 June 2012 - 03:43 PM, said:

This is my files : [199KB] - http://www.mediafire...1sl1b83rjb15gfj
Could you please supply a copy of the "Messages" window from AFTER you have run a render that has not rendered at the selected size.

#148 FMP

FMP

    Posts: 18
    Joined: 16-June 12
    Member: 29229

Posted 17 June 2012 - 06:30 PM

View PostC3POwen, on 17 June 2012 - 04:33 PM, said:

Could you please supply a copy of the "Messages" window from AFTER you have run a render that has not rendered at the selected size.

Sorry man , my bad ... :thumbup:
" Render -> Edit Settings\Render -> INI File - Clear " & then " Render " ? This is your mean , right ?
This is 2nd message file : [Attachments File] - Attached File  Message II.txt   1.78K   2 downloads

#149 C3POwen

C3POwen

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

Posted 17 June 2012 - 07:01 PM

Looking at your file, POV-Ray is rendering the file at 320x240 -- look at the first line under Output Options:

Output Options
  Image resolution 320 by 240 (rows 1 to 240, columns 1 to 320).
  Output file: C:\Users\admin\Documents\6941 Battrax.bmp, 24 bpp (system format)
  Graphic display......On  (gamma: 2.2)
  Mosaic preview.......Off
  CPU usage histogram..Off
  Continued trace......Off
Can you go to Render > Edit Settings/Render and under INI File click on Browse and select the "quickres.ini" file. Now from the dropdown to the right of Section select the resolution you want to use (e.g. 1280x1024, No AA) and click on the Set but don't render button. This will close the window.

Now render the image and, if it does not render at a size higher than 320x240, can you please attach the subsequent "Messages" information.

#150 FMP

FMP

    Posts: 18
    Joined: 16-June 12
    Member: 29229

Posted 17 June 2012 - 08:06 PM

View PostC3POwen, on 17 June 2012 - 07:01 PM, said:

Looking at your file, POV-Ray is rendering the file at 320x240 -- look at the first line under Output Options:

Output Options
  Image resolution 320 by 240 (rows 1 to 240, columns 1 to 320).
  Output file: C:\Users\admin\Documents\6941 Battrax.bmp, 24 bpp (system format)
  Graphic display......On  (gamma: 2.2)
  Mosaic preview.......Off
  CPU usage histogram..Off
  Continued trace......Off
Can you go to Render > Edit Settings/Render and under INI File click on Browse and select the "quickres.ini" file. Now from the dropdown to the right of Section select the resolution you want to use (e.g. 1280x1024, No AA) and click on the Set but don't render button. This will close the window.

Now render the image and, if it does not render at a size higher than 320x240, can you please attach the subsequent "Messages" information.

Thank man but no change ??? ... :wacko:
This is the best " crazy " problem I have never met before ...
Message III : [Attachments File] - Attached File  Message III.txt   1.95K   4 downloads

Hey man, I have just known that there are more way to render " .ldraw " models ( by using : L3P + MLCAD + POV-Ray [Old] - MLCAD + LDView + POV-Ray [Your Way] - LEOCAD + Blender [3] - LEOCAD + MLCAD + Blender [4] )

Well , see you later ... :thumbup:

Edited by FMP, 17 June 2012 - 08:09 PM.






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

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users