Sign in to follow this  
Balrog

LDD/POV-Ray random colors

Recommended Posts

I have searched and found nothing that answers my question. If this has been answered before, please point it out to me.

I want to make a render of a Lego creation. So far, the model contains two colors. I thought about replacing the one color by random colors, but doing this by hand and brick by brick is a feasable task. it would be optimal if certain brick colors could be excluded. Is there a chance to do this in either LDD or POV-Ray?

Alternatively, if this is possible with LDraw, I would give this a shot.

Any ideas??

Share this post


Link to post
Share on other sites

In PovRay, the rand() function generates random numbers. You can use it in your RGB colors definitions, and you will have random colors each time you render you scene.

Share this post


Link to post
Share on other sites

In PovRay, the rand() function generates random numbers. You can use it in your RGB colors definitions, and you will have random colors each time you render you scene.

So I edit the .pov file and edit the substitute color for e.g. black from a fixed value to rand()?

I don't want to render a color in a single random color, but many bricks of the same color in many different colors. From what you described, it won't work the way I want it.

Edited by Balrog

Share this post


Link to post
Share on other sites

OK then, don't edit the color definition itself, but replace each brick color definition by a rgb value with the random values. I guess it should work.

Share this post


Link to post
Share on other sites

I'll try that when my current render is finished.

update:

This doesn't work. I tried replacing one of the color codes with rand(). This, of course, doesn't work. I checked the documentation and found I need to declare a seed, which I did. Still, POV-Ray gives this error: "Parse Error: Cannot assign uninitialized identifier." with highlight to the line with the rand.

This would be one of the lines in the .pov file:

ldd_3023(array[1]{RAND(R1)},array[1]{0},array[1][12]{{0,0,1,0,1,0,-1,0,0,-1.1999994516372681,1.5999996662139893,-4.4000000953674316}})

opposed to this:

ldd_3023(array[1]{26},array[1]{0},array[1][12]{{0,0,1,0,1,0,-1,0,0,-1.9999998807907104,0.63999998569488525,-4.4000005722045898}})

Also, your first suggestion doesn't work as well, because I obviously cannot replace the RGB value by a simple rand. But it would work like this:

#declare ldd_black = rgb <rand(R1)/255,rand(R2)/255,rand(R3)/255>;

This is acceppted by POV-Ray, but does not result in a color change. Very strange. At this point, giving LDD2POV-Ray a certain different number to replace the Lego Black with, still results in the color not being replaced. So there is something else broken here.

Edited by Balrog

Share this post


Link to post
Share on other sites

#declare ldd_black = rgb <rand(R1)/255,rand(R2)/255,rand(R3)/255>;

This is what I meant. I haven't really been into details but, that's what I was thinking of. A random value devided by 255 for each R, G and B color.

This would work I guess, but this will give you the same random color for each black brick, try to directly implement the rgb color for each brick.

I guess you are using ldd2pov, and I don't know the kind of pov file it generates so I cannot try myself.

As a workround, If you where using Ldraw, I would simply write a quick code in C++ or VBA to edit the ldraw file and change randomly color values. I don't know if this would be feasable with LDd...

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.