POV-Ray : Newsgroups : povray.binaries.images : Trying to understand Megapov's cloth... Server Time
5 Nov 2024 22:24:19 EST (-0500)
  Trying to understand Megapov's cloth... (Message 1 to 3 of 3)  
From: William Tracy
Subject: Trying to understand Megapov's cloth...
Date: 3 Jul 2007 17:44:18
Message: <468ac332$1@news.povray.org>
Here is the code for this scene:

// Begin code
#version unofficial MegaPov 1.21;

// Macro straight from Megapov documentation
#macro WriteClothFile(filename, n1, n2, nlng, ks, ht)
   #fopen file filename write
   #write(file, n1, ", ", n2, ", ", nlng, ", ", ks, ",\n")
   #local l1 = nlng*(n1-1);
   #local l2 = nlng*(n2-1);
   #local st = seed(1234);
   #local i=0;
   #while (i < n1)
     #local j=0;
     #while (j < n2)
       #local tempx = -l1/2 + i*nlng;
       #local tempz = -l2/2 + j*nlng;
       #local tempy = ht + (-1+2*rand(st))*nlng*0.1;
       #write(file, tempx, ",", tempy, ",", tempz, ", 0.0, 0.0, 0.0,\n")
       #set j=j+1;
     #end
     #set i=i+1;
   #end
   #fclose file
#end

WriteClothFile("temp.cth", 50, 50, 0.2, 0.95, 0)

#declare stuff =
   sphere {
     <02.5, -2, 02.5>, 1
     pigment {color rgb <0, 1, 0>}
   };

simcloth {
   environment stuff
   friction 0
   gravity -0.4*y
   damping 0.9
   intervals 0.03
   iterations 1000
   input "temp.cth"
   mesh_output "cloth.msh"
   smooth_mesh on
   uv_mesh on
}

mesh {
   #include "cloth.msh"
   uv_mapping
   texture {
     pigment {
       checker
       color rgb <1, 0, 0>
       color rgb 1
       scale 0.1
     }
   }
}

object {stuff}

camera {
   location <5, 1, -10>
   look_at <5, 0, 5>
}

light_source {
   <5, 15, -5>
   color rgb 1
}
// end code

Why is the sphere showing through the cloth in the final scene? I'm 
going nuts trying to figure out what I screwed up. Did I just hit a bug 
in Cloth-ray?

-- 
William Tracy
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|a|f|i|s|h|i|o|n|a|d|o|@|g|m|a|i|l|.|c|o|m|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|w|t|r|a|c|y|@|c|a|l|p|o|l|y|.|e|d|u|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
You know you've been raytracing too long when www.povray.org is your 
default homepage in your web browser.
fish-head


Post a reply to this message


Attachments:
Download 'clthtest.png' (7 KB)

Preview of image 'clthtest.png'
clthtest.png


 

From: Thomas de Groot
Subject: Re: Trying to understand Megapov's cloth...
Date: 4 Jul 2007 03:36:42
Message: <468b4e0a@news.povray.org>
This is fairly normal behaviour with ClothRay. It happens because the two 
surfaces are almost coincident. I think it is explained somewhere in the 
docs, or I remember this from earlier comments. What you should do is to 
scale up a tiny bit the final cloth so that it covers nicely the sphere. 
Alternatively, you can start by scaling up a tiny bit the sphere before 
processing and use the resulting cloth over your original sphere. Very small 
amounts will be enough.

Thomas


Post a reply to this message

From: William Tracy
Subject: Re: Trying to understand Megapov's cloth...
Date: 4 Jul 2007 16:38:06
Message: <468c052e$1@news.povray.org>
Thomas de Groot wrote:
> This is fairly normal behaviour with ClothRay.

Okay. I'd just never seen ClothRay do this before, and was wondering how 
  I'd triggered it in this scene.

I was originally using this scene to play with some macros of my own, 
and this was making me think I'd screwed up my macros. But between being 
able to reproduce it with the "default" macro, and your reassurance that 
this is normal :-) I'm feeling better now.

-- 
William Tracy
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|a|f|i|s|h|i|o|n|a|d|o|@|g|m|a|i|l|.|c|o|m|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|w|t|r|a|c|y|@|c|a|l|p|o|l|y|.|e|d|u|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
You know you've been raytracing too long when your ophthalmologist 
examines you for complaints of eye strain and blurred vision and asks 
you why the words Pov, #declare, #include, sphere, translate, rotate, 
texture, and pigment are permanently burned into your retina.
Ken Tyler


Post a reply to this message

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