POV-Ray : Newsgroups : povray.binaries.images : Trying to understand Megapov's cloth... : Trying to understand Megapov's cloth... Server Time
4 Nov 2024 15:45:23 EST (-0500)
  Trying to understand Megapov's cloth...  
From: William Tracy
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


 

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