C3POwen

[Guide] Rendering LDraw models using POV-Ray

Recommended Posts

Thankyou very much for this, it's been a very helpful tutorial!

One thing, Is there a way to stop the bricks from reflecting so crisply? It doesn't seem right in the renders I've done, you can see, for example, the end of the 'display track' reflected in the front of a train I've rendered. I've even un-ticked the 'reflection' box when exporting from LDView and it still occurs in POV-Ray. Any tips?

Thanks!

Share this post


Link to post
Share on other sites

Please search for file lg_color.inc. Usually you can find it in LDraw/LGEO/lg.

You can open this file with povray. You will find the following terms close to the beginning:

/**************************/

/* FINISHES & NORMALS */

/**************************/

#declare lg_solid_finish =

finish {

ambient 0

#if (lg_quality > 1)

diffuse 1

brilliance 1

phong 1

phong_size 40

reflection { 0.025 falloff 1 exponent 1 }

#end

conserve_energy

}

For disabling reflection please manipulate the reflection term as follows:

reflection { 0.0 falloff 1 exponent 1 }

Save this file and render again.

Does it work?

Regards

Papacharly

Share this post


Link to post
Share on other sites

Save this file and render again.

Does it work?

I had no trouble finding the file but it will not let me re-save it; it keeps telling me that access is denied. What do I do? thanks :)

Edit: No worries, I figured it out and it's superb. thankyou so much!!

Edited by Bricksmith

Share this post


Link to post
Share on other sites
On 2017-5-1 at 5:57 PM, ashir said:

All images are down my friend...

That's really unfortunate :(

C3Powen hasn't been online since 2015 so I don't think he'll see your message. :sceptic:
I'll try to contact him, see if we can work something out.

Share this post


Link to post
Share on other sites

Someone knows why when you use radiosity the transparent background is lost???

Share this post


Link to post
Share on other sites

Does anyone know where I can download the full LGEO library?

I'm not sure if this is the proper (full) version:

Please advise me what I should be downloading to get the full library.

Share this post


Link to post
Share on other sites

Complete LGEO library comes with the ldraw AIOI. Then you can add my LGEO parts from the topic you linked above.

Share this post


Link to post
Share on other sites
10 hours ago, Darats said:

Complete LGEO library comes with the ldraw AIOI.

Thanks, I thought that was the case.

10 hours ago, Darats said:

Then you can add my LGEO parts from the topic you linked above.

That's slightly confusing...

Are your LGEO parts different, or better in any way?

Share this post


Link to post
Share on other sites

Mostly it is new parts not present in ldraw AIOI. There are also some improvement on some already existing ones.

As it is said in my topic, my additionnal parts are a WIP and need a few steps to follow to be merged with the official LGEO library.

I can help on that if needed.

Share this post


Link to post
Share on other sites
23 minutes ago, Darats said:

Mostly it is new parts not present in ldraw AIOI. There are also some improvement on some already existing ones.

As it is said in my topic, my additionnal parts are a WIP and need a few steps to follow to be merged with the official LGEO library.

I can help on that if needed.

Okay, thanks, I should be fine now - but I will post here if I have any problems.

Share this post


Link to post
Share on other sites

Hello,

I have a problem with POV-Ray.
If I export from LDView and use XML Mapping File (LGEO.XML) I miss the numbers on the part and it is Moved (middle hole).
If I do not use the mapping file, the representation is okay, but the color is pale as if fog over it.

How can I solve this?

greeting

32016-011.png32016-01.png

Edited by Bluehannover

Share this post


Link to post
Share on other sites

if you check "xml" in LDview a lot of ldraw parts get replaced by lgeo parts. lgeo parts are more nicely shaped, e.g. with rounded edges. Lgeo parts are intended to generate a higher level of realistic renders. You can see this on your renders above. Furthermore Lgeo uses its own color definition file (=> lg_color.inc). Which means that Ldraw colors and Lgeo colors may not be the same. Regarding the missing number I think it's just a human error.

So luckilly you have no problem. It's just the way Ldraw and Lgeo works...

Using pov-ray you may easily tweek all colors to your needs.

Search the pov file (no xml) for the following code:

#ifndef (LDXColor0) // Black
#declare LDXColor0 = LDXOpaqueColor(0.019608,0.07451,0.113725)
#end

If you wish to have it real black change it to:

#ifndef (LDXColor0) // Black
#declare LDXColor0 = LDXOpaqueColor(0,0,0)
#end

If you wish to change the lgeo colors you have to modify lg_color.inc.

 

regards

papacharly

 

Share this post


Link to post
Share on other sites

Hello.

I've been reading this guide for a while. This post is what got me interested in POV-Ray. I've been trying a lot of the advices that you guys have posted here. I managed to make an animation of a MOD of the Brick Bank. I think the output it's fine, although far from perfect. Since my goal was to make an animation I can't use Radiosity (which seems to really improve the quality of the images) because I need to create 360 renders for a full video and I'm using an outdated macbook air.

https://bricksafe.com/files/dagupa/others/ebvarias/BrickbankFirstAttemp.mp4

But I have a problem: I put all the images together but the video seems to accelerate around 0:04 I've tried three different programs to put the images together with the same result (even tried with different fps), so I think it's fairly to assume that the problem is in the pictures created with POV-Ray.

I'll be very thankful if anyone have any advice.

The ini file I'm using is very simple and it's supposed to guarantee that each render rotates +1 degree the model

Initial_Frame=1

Final_Frame=360

Initial_Clock=0

Final_Clock=1

The code that actually change the camera is:

#declare Angle=(clock*360);

#declare AngleRadian=radians(Angle); 

#declare CamRadius = 1.65*LDXRadius;

I'm sorry about my English since I'm not a native speaker. Thank you, again.

Share this post


Link to post
Share on other sites
2 hours ago, dagupa said:

I'll be very thankful if anyone have any advice.

Here's two things you can try:

  1. Run the POV-Ray render again, just in case there was a glitch in the system.
  2. Load the model into LDCad, apply the "Camera test" animation, and then export the POV-Ray animation, which you can then render.

Which will look like this: (after a few tweaks to the ini file)

Animation.gif

Edited by mocbuild101

Share this post


Link to post
Share on other sites
22 hours ago, mocbuild101 said:

Here's two things you can try:

  1. Run the POV-Ray render again, just in case there was a glitch in the system.
  2. Load the model into LDCad, apply the "Camera test" animation, and then export the POV-Ray animation, which you can then render.

Hello. Thank you for your reply.

I'm going to install LDCad this weekend. That "Camera Test" feature seems very useful. Until now, I have used trial-and-error with my animations.

I may have to get a PC since BrickSmith is the only CAD for LDraw available for Mac.

Re-render all the images is my last options since the 360 frames take around 120 hours. Now, I think a computer glitch is a very possible cause.

Which software do you use to make GIFs?

Share this post


Link to post
Share on other sites
36 minutes ago, dagupa said:

Re-render all the images is my last options since the 360 frames take around 120 hours.

Wow, that was a lot longer than I was expecting! The render I did (above) only took about 6 hours (for the same 360 frames, at 640x480), and I'm only using a basic laptop!

What resolution are you rendering at? - I makes a LOT of difference to the rendering time...

45 minutes ago, dagupa said:

Which software do you use to make GIFs?

GIMP, which is the same program I use for all my photo editing.

Share this post


Link to post
Share on other sites
2 hours ago, mocbuild101 said:

What resolution are you rendering at? - I makes a LOT of difference to the rendering time...

GIMP, which is the same program I use for all my photo editing.

Each image is 1280x720. The model is over 4000 bricks and that's what takes a lot of time. I'm not using radiosity or anything "fancy", but I have 8 lights above the model and 8 lights inside and that's also time consuming. Each frame takes about 5 minutes to load and 20 to render, which is not bad until you realize you have to multiply by 360

I already installed GIMP. Very good software and Open-Source. I feel like I've been using the wrong tools.

One more question: How did you center the model? Is it something that LDCad does automatically? Because that's another problem I have to deal with. The POVRay camera rotates around the Z axle but the model is not centered. If you pay attention you notice that the model is not always at the same distance from the camera. It's not that bad, but sometimes those details really bother me. In your animation you can see that the model is always at the same distance from the camera.

Share this post


Link to post
Share on other sites

Another tiny improvement: change tire color to "rubber black" (color 256) instead of black, the finish will be less shiny.

Share this post


Link to post
Share on other sites
Just now, dagupa said:

Each image is 1280x720. The model is over 4000 bricks and that's what takes a lot of time. I'm not using radiosity or anything "fancy", but I have 8 lights above the model and 8 lights inside and that's also time consuming. Each frame takes about 5 minutes to load and 20 to render, which is not bad until you realize you have to multiply by 360

Well yes, that is a lot to render... But here's some suggestions to reduce the render time: (other than decreasing the resolution)

  • only use a maximum of 3 lights, but change them to area lights - they should actually look better than the 8 lights you currently have.
  • remove some of the internal bricks from the model - because if they're never going to be seen, why render them?
Just now, dagupa said:

One more question: How did you center the model? Is it something that LDCad does automatically?

I assume so, as I never adjusted it myself... But you can always preview the animation in LDCad, so you can make any adjustments before exporting to POV-Ray.

 

Just now, Philo said:

Another tiny improvement: change tire color to "rubber black" (color 256) instead of black, the finish will be less shiny.

Thanks for the tip! I tried so much to get rid of the shiny finish, I never thought it would be affected by the color...

But just one question, where exactly do I change it? - in LDCad, or in POV-Ray?

Share this post


Link to post
Share on other sites
3 hours ago, mocbuild101 said:

But just one question, where exactly do I change it? - in LDCad, or in POV-Ray?

In LDCad. Select -say- the second color bin, choose "Rubber" bin. Select the tires, then choose rubber black in the wheel and click on (now) rubber black current color to change tire color. Or double click rubber black in the wheel. Changing color of an existing part is not the most user friendly thing in LDcad...

Share this post


Link to post
Share on other sites

I just noticed the 'black transparent' on the IR sesnsor of mocbuild101's rendering isn't very realistic.

Anyone has some idea on how to improve that, as the LDCad export uses material interior for transparency which clearly doesn't work well with black transparent.

Also, @mocbuild101, are you sure you have smoothing enabled (prefs/ldraw/vertex processing), the rendering looks a bit flat shading-y to me.

 

13 hours ago, dagupa said:

One more question: How did you center the model? Is it something that LDCad does automatically? Because that's another problem I have to deal with. The POVRay camera rotates around the Z axle but the model is not centered. If you pay attention you notice that the model is not always at the same distance from the camera. It's not that bad, but sometimes those details really bother me. In your animation you can see that the model is always at the same distance from the camera.

It uses the current 'lookat' so if you center the model on whatever brick ('c') you want to use as the center you should be ok. You can also create your own animation script for (alternative) hardcoded coordinates/distances/angles.

Share this post


Link to post
Share on other sites
9 hours ago, mocbuild101 said:

*only use a maximum of 3 lights, but change them to area lights - they should actually look better than the 8 lights you currently have.

*remove some of the internal bricks from the model - because if they're never going to be seen, why render them?

I prefer to use single lights because you can position them precisely according to the needs. With area lights you are stuck to the plane created by the area light. That plane is orthogonal to the vector formed by the location point of the area and the (0,0) coordinate. Area lights work great with radiosity, but radiosity is a NO NO for animations.

lights-a4356as.png

White models (like Brick Bank's 2do floor) are very difficult because the light "intensity" has to be very low, so you have to compensate with more lights in those spots that are not reached by the "general lighting". I think area lights are more time-consuming when rendering the frames. After all, a simple 2x2 area is 4 lights; a 3x3 is 9.

I'll try to remove some of the internal bricks. Oh, the LDraw code for Rubber Black is 256

 

1 hour ago, roland said:

It uses the current 'lookat' so if you center the model on whatever brick ('c') you want to use as the center you should be ok. You can also create your own animation script for (alternative) hardcoded coordinates/distances/angles.

Hello. I've been using the center of the model as the look_at point, but in big models you can notice how the camera path describes an ellipse instead of a circle. I've tried trigonometry to calculate each point but I haven't been able to figure out a solution to manage the 360 points inside one loop. Right now, I'm thinking about using Linear Algebra to calculate a second vector space but I have to find my college notebooks :)  

Any suggestion is welcome.

camera-a4356as.png

 

Share this post


Link to post
Share on other sites

I'm assuming you're talking about the POV-Ray camera script.

Don't forget to add look-at to location when using a non zero look-at.

 

Share this post


Link to post
Share on other sites
10 hours ago, roland said:

I just noticed the 'black transparent' on the IR sesnsor of mocbuild101's rendering isn't very realistic.

Yeah, that's really annoying... :sceptic:

9 hours ago, roland said:

Also, @mocbuild101, are you sure you have smoothing enabled (prefs/ldraw/vertex processing), the rendering looks a bit flat shading-y to me.

I don't know... where could I check it?

7 hours ago, dagupa said:

I prefer to use single lights because you can position them precisely according to the needs.

That makes sense...

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.