POV-Ray : Newsgroups : povray.unofficial.patches : Applying checker texture to a mass? Server Time
4 Oct 2024 03:58:08 EDT (-0400)
  Applying checker texture to a mass? (Message 1 to 1 of 1)  
From: hjw3001
Subject: Applying checker texture to a mass?
Date: 20 Jan 2008 13:50:01
Message: <web.479397b8e732224cf091c39c0@news.povray.org>
Hi,

I've started playing around with mass and gravity in MegaPOV and am trying to
apply a checkered texture to a mass sphere. The texture isn't moving with the
mass, the texture changes as the mass falls. I'm hoping to see if the mass
spheres rotate as they roll along a curved surface. Is this possible?

The scene file is:

// Halfpipe Physics
//
// Written by: Henry Wagner (hjw### [at] gmailcom)

#version unofficial megapov 1.2;

#include "colors.inc"
#include "mechsim.inc"
#include "iso_csg.inc"

#declare fn_Env=
IC_Merge2(
  IC_Plane(y, 0),
  IC_Difference4 (
      IC_Box (<-22,   0, -8>,   <22,12.5,8>  ),
      IC_Box (< -5, 0.5, -8.1>, < 5,12.6,8.1>),
      IC_Cylinder (<-5, 12.5, -8.1>, <-5, 12.5, 8.1>, 12),
      IC_Cylinder (< 5, 12.5, -8.1>, < 5, 12.5, 8.1>, 12)
    )
)

#declare MSim_Tex_N=texture{
        pigment { checker pigment{Red}, pigment{Blue} scale .5}
}

global_settings {
  assumed_gamma 1.0

  mechsim {
    gravity <0, -9.81, 0>
    method 1

    environment {
      function { fn_Env(x, y, z) }
      stiffness 60000000
      damping 10000
      friction 0.1, 1.001
      method 1
    }

    collision {
      1, 0
      stiffness 60000
      damping 3000
    }

    #if (clock_on)
      step_count 1500
      time_step (1/30)/1500

      topology {
        load_file "halfpipe.dat"
        save_file "halfpipe.dat"
      }
    #else
      step_count 0

      topology {
          mass { < -16.5,22.5,0>, <0, 0, 0>, 0.5 density 5000 }
        save_file "halfpipe.dat"
      }
    #end
  }
}

// ----------------------------------------

camera {
  location  <-10.0, 14.0, -32.0>
  //location < -16, 20, -2 >
  up y
  sky y
  look_at   <0.0, 8, 0.0>
  //look_at < -16.5,22.5,0>
  // angle 30
}

light_source {
  <2000, 3000, -2700>
  color rgb <1.7, 1.5, 1.2>
}

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.2 rgb <0.2,0.3,0.9>]
    }
  }
}

// ----------------------------------------

#declare T_Env=
  texture {
    pigment { color rgb 1.5 }
    finish { ambient 0.05 diffuse 0.6 }
  }

merge {
  plane { y, 0 }
  difference {
    box {<-22,   0, -8>,   <22,12.5,8>}
    union {
        box {< -5, 0.5, -8.1>, < 5,12.6,8.1>}
        cylinder {<-5, 12.5, -8.1>, <-5, 12.5, 8.1>, 12}
        cylinder {< 5, 12.5, -8.1>, < 5, 12.5, 8.1>, 12}
    }
  }
  texture { T_Env }
}

// ----------------------------------------

MechSim_Show_All_Objects(-1, false, -1, "")


Post a reply to this message

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