POV-Ray : Newsgroups : povray.advanced-users : Crushed box corner : Re: Crushed box corner Server Time: 23 Jul 2019 11:42:45 GMT
  Re: Crushed box corner  
From: William F Pokorny
Date: 29 Jan 2018 16:28:47
On 01/29/2018 09:08 AM, Bald Eagle wrote:
> I'm looking to model a crushed box corner.
> 
> This is likely something trivial to do in a mesh-based package like Blender,
> etc, but it seems to me to be rather complicated to work out the mechanism by
> which to model the folding of the faces and especially the corner - where there
> is by necessity actual crushing.
> 
Understand your looking for mesh functionality, but you can fairly 
quickly get a dented box look with an isosurface by routing a box 
function through pigment(1) so as to have access to the pigment pattern 
modifiers.

Bill P.

(1) - The pigment wrapper slows things down quite a bit. I'm not aware 
of a better way at the moment - at least one which is relatively quick 
to code.

//--------------- dentedBox.pov
#version 3.8;
global_settings { assumed_gamma 1 }
#default { finish {ambient 0.000 diffuse 1.0} }
#declare Grey50 = srgb <0.5,0.5,0.5>;
background { color Grey50 }
#declare Camera00 = camera {
     perspective
     location <3,3,-3.001>
     sky y
     angle 35
     right x*(image_width/image_height)
     look_at <0,0,0>
}
#declare White = srgb <1,1,1>;
#declare Light00 = light_source {
     <150,150,-250>, White*<0.3,0.1,0.0>
}
#declare Red = srgb <1,0,0>;
#declare CylinderX = cylinder { -1*x, 1*x, 0.01 pigment { Red } }
#declare Green = srgb <0,1,0>;
#declare CylinderY = cylinder { -1*y, 1*y, 0.01 pigment { Green } }
#declare Blue = srgb <0,0,1>;
#declare CylinderZ = cylinder { -1*z, 1*z, 0.01 pigment { Blue } }
#include "functions.inc"
#declare Fn00 = function (x,y,z) {
     -min(0,f_rounded_box(x,y,z,0.05,0.9,0.9,0.9))
     // NOTE. The corner rounding value (0.05) is the most
     // negative value as f_rounded_box implemented. Smaller
     // values likely to drive up run time & drive tweak of
     // isosurface function call.
}
#declare Pigment00 = pigment {
     function { Fn00(x,y,z) }
     warp {black_hole <0.7,0.6,0.2>, 0.7 strength 1 falloff 2 inverse}
     warp {black_hole <0.7,0.7,0>, 0.5 strength 1 falloff 2}
     warp {black_hole <0.7,0.7,0>, 0.6 strength 1 falloff 2}
     warp {black_hole <0.7,0.7,0>, 0.7 strength 1 falloff 2}
     warp {turbulence 0.02}
}
#declare Fn01 = function { pigment { Pigment00 } }
#declare Iso99 = isosurface {
     function { 0.025-Fn01(x,y,z).red }
     contained_by { box { <-1,-1,-1>,<1,1,1> } }
     threshold 0.0
     accuracy 0.0005
     max_gradient 3.0
     texture {
         pigment { color White*0.7 }
         normal { wrinkles 0.9 scale 0.01 }
     }
}

//--- scene ---
    camera { Camera00 }
    light_source { Light00 }
    object { CylinderX }
    object { CylinderY }
    object { CylinderZ }
    object { Iso99 }
//--- end


Post a reply to this message

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