Jump to content

Recommended Posts

Posted

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??

Posted

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.

Posted (edited)

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
Posted

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.

Posted (edited)

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
Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...