Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Rotating Second Life Sculpties

by strredwolf (Chaplain)
on Sep 04, 2007 at 14:53 UTC ( #636955=snippet: print w/replies, xml ) Need Help??
Description: Short few bits of code to bash out a sculptie from a 127x256 Gimp-made PGM (greyscale plain pixmap, not raw!). The plain PGM was made with the first and last rows completely white, and what I needed to rotate around the Z axis in black. The one-liner extracts the radii, the following script generates a plain PPM that takes those radii and rotates it around the Z axis, stepping through every 1.4 degrees (roughly).
 tail -n +5 Sculptie.pgm | perl -nle 'BEGIN{$l=$c=0;} $c++ unless($_);
+if(++$l==127){$l=0;print $c; $c=0;}' > Sculptie.zr


# Use: < Sculptie.zr > Sculptie.ppm

#4 * atan2 1, 1;

my $step= 4*atan2(1,1)/128;
my $i=0;
my $a=$step*255;
my @r,$j,$k,$z,$zi;

while(<>) {
print "P3\n256 256 255\n";

for($j=$z;$j>-1;$j--) {
  for($i=0;$i<256;$i++) {
    my $x=127+int($r[$j]*cos($a));
    my $y=127+int($r[$j]*sin($a));
    print "$x $y $j\n";

Replies are listed 'Best First'.
Re: Rotating Second Life Sculpties
by aplonis (Pilgrim) on May 02, 2008 at 18:30 UTC

    Okay, I too make sculpties. In my case I generate them as NURBS in Rhino 4 then translate them with 3dm2sculpt and preview/smooth/expand them with sculptypaint.

    So I'm staring at your (admittedly interesting) Perl script and even sort of understand it. But I'm having to wonder, "Why?"

    I mean it costs L$10 for uploading every sculptmap and nothing at all to clone/rotate any number of them in-world.

    So... Am I missing something fundamental?

    Aplonis Ember of SL

      I didn't have Rhino 4, 3dm2sculpt, and sculptypaint back then. But then, the item I was sculpting was fairly simple to do.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: snippet [id://636955]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2018-02-22 05:08 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (288 votes). Check out past polls.