POV-Ray : Newsgroups : povray.advanced-users : how to create a random coil : Re: how to create a random coil Server Time
5 Jul 2024 15:34:33 EDT (-0400)
  Re: how to create a random coil  
From: Chris B
Date: 20 Oct 2007 06:58:01
Message: <4719df39$1@news.povray.org>
"zj905" <zj9### [at] hotmailcom> wrote in message 
news:web.471935d2144555e34849a21c0@news.povray.org...
> Thanks for your detailed help. I really appreciate that. Another reader 
> also
> mentioned spline method. 
> http://www.geocities.com/ccolefax/spline/index.html
> The question is: this method can build one random chain. If the surface 
> were
> grafted with hundreds or thousands of chains, how to do? Is there any 
> random
> function available to generate the spline path?

Hundreds sounds a lot (thousands sound a lot more). Depending upon the 
effect that you're trying to achieve and the resolution you're planning to 
render in, you're unlikely to actually see most of them as distincts 
links/chains, so you may want to consider simulating most of the chains, 
with maybe 3 or 4 more 'authentic' ones in the foreground to give the 
impression that you've done them all.

IMO, the shape of a coil of chain beyond a certain distance could be 
simultated with a blob using a randomised ring of spherical components 
scaled vertically to squash it down a bit. You could apply a speckled 
semi-transparent texture to make it look like a vague heap of something.

At a middle distance you could use the same shape with a load of randomly 
placed chain links sticking out the surface, so that people can see some 
real links there.

Then, for a small number of chains that are close to the camera, I'd go for 
randomised splines to give chains that you can see in detail.

You could write a macro to generate a randomised path. For a coil you can 
use a while loop with the rand() function to adjust the distance from the 
centre of the coil and the amount of rotation in each step. For each point 
you identify on the circular sweep you can check back along the spline for 
points that are within a certain distance in x and z, then take the existing 
y value and add one chain width to raise the current position above the 
coincident position.

If you want to track a length of chain across other coils of chains you 
could build a CSG composite of the 'simulated' shapes and use the trace 
function to find the height of the top surface at the x,z location you wish 
to use in your spline.

Regards,
Chris B.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.