Anybody interested in a carbon texture for povray?

Anybody interested in a carbon texture for povray?

Post by Richard Pfeiffe » Sun, 27 Jul 2003 01:40:10



Hi raytracing group,

some time ago, i've been looking for a carbon texture.
Because I couldn't find one, i did my own one.
Here it is. See the files carbon.inc and carbon.pov below.
If anybody uses them as basis for further development,
i'm certainly interested in the results.

I needed the texture for the work, that i submitted to
the Ducati design contest "design your dream Ducati".
Have a look at
http://www.ducati.com/scoopage.jhtml?area=bikes&scoopNum=079
- click "vote now"
- register
- search entry list for Pfeiffer Richard
- vote 5 points if you like the work

Have fun using carbon.inc

Richard

// --snip-- begin carbon.inc ----------------------
// carbon texture

#declare N_Carbon = normal {
  #local loc_sc = <.5,.5,1>;
  gradient x
  normal_map{
    [ 0.25
      gradient y
      normal_map {
        [ .25 gradient y scallop_wave scale loc_sc translate .25*y ]
        [ .25 gradient x scallop_wave scale loc_sc ]
        [ .5  gradient x scallop_wave scale loc_sc ]
        [ .5  gradient x scallop_wave scale loc_sc translate .25*x ]
        [ .75 gradient x scallop_wave scale loc_sc translate .25*x ]
        [ .75 gradient y scallop_wave scale loc_sc translate .25*y ]
      }
    ]
    [ 0.25
      gradient y
      normal_map {
        [ .25 gradient x scallop_wave scale loc_sc translate .25*x ]
        [ .25 gradient x scallop_wave scale loc_sc ]
        [ .5  gradient x scallop_wave scale loc_sc ]
        [ .5  gradient y scallop_wave scale loc_sc ]
        [ .75 gradient y scallop_wave scale loc_sc ]
        [ .75 gradient y scallop_wave scale loc_sc ]
      }
    ]
    [ 0.5
      gradient y
      normal_map {
        [ .25 gradient x scallop_wave scale loc_sc translate .25*x ]
        [ .25 gradient x scallop_wave scale loc_sc ]
        [ .5  gradient x scallop_wave scale loc_sc ]
        [ .5  gradient y scallop_wave scale loc_sc ]
        [ .75 gradient y scallop_wave scale loc_sc ]
        [ .75 gradient y scallop_wave scale loc_sc ]
      }
    ]
    [ 0.5
      gradient y
      normal_map {
        [ .25 gradient x scallop_wave scale loc_sc translate .25*x ]
        [ .25 gradient y scallop_wave scale loc_sc translate .25*y ]
        [ .5  gradient y scallop_wave scale loc_sc translate .25*y ]
        [ .5  gradient y scallop_wave scale loc_sc translate .25*y ]
        [ .75 gradient y scallop_wave scale loc_sc translate .25*y ]
        [ .75 gradient x scallop_wave scale loc_sc ]
      }
    ]
    [ 0.75
      gradient y
      normal_map {
        [ .25 gradient x scallop_wave scale loc_sc translate .25*x ]
        [ .25 gradient y scallop_wave scale loc_sc translate .25*y ]
        [ .5  gradient y scallop_wave scale loc_sc translate .25*y ]
        [ .5  gradient y scallop_wave scale loc_sc translate .25*y ]
        [ .75 gradient y scallop_wave scale loc_sc translate .25*y ]
        [ .75 gradient x scallop_wave scale loc_sc ]
      }
    ]
    [ 0.75
      gradient y
      normal_map {
        [ .25 gradient y scallop_wave scale loc_sc ]
        [ .25 gradient y scallop_wave scale loc_sc ]
        [ .5  gradient y scallop_wave scale loc_sc ]
        [ .5  gradient x scallop_wave scale loc_sc translate .25*x ]
        [ .75 gradient x scallop_wave scale loc_sc translate .25*x ]
        [ .75 gradient x scallop_wave scale loc_sc ]
      }
    ]
  }

Quote:}

#declare T_Carbon_A = texture {
  normal { N_Carbon }
  pigment{rgb 0}
  finish { phong .5 phong_size 4 }
Quote:}

#declare T_Carbon_B = texture {
  normal {bumps 0}
  pigment{rgb 0}
  finish {
    reflection 1
    phong 1 phong_size 60
  }
Quote:}

#declare T_Carbon = texture {
    average
    texture_map {
      [5 T_Carbon_A ]
      [4 T_Carbon_B ]
    }
Quote:}

// --snip-- end carbon.inc ----------------------

// --snip-- begin carbon.pov ----------------------

// based on POV Normal_map example normmap.pov

global_settings { assumed_gamma 2.2 }

#include "carbon.inc"

camera {
  location <0,3,-31>
  direction 3*z

Quote:}

light_source { <200, 200, -500> color <1,1,1>}

// box with concave bump
#declare myObj = difference {
  box {
    <-2,-2,0>,<2,2,1>
  }
  sphere {
    <0,0,0>,1.5
    scale <1,1,.1>
    translate .0*z
  }

Quote:}

// red cylinder - just to show reflections
#declare redCyl = cylinder {<0.5,-2,-1>,<0.5,2,-1>,.2 texture {pigment{rgb<1,0,0>} finish { ambient .5} } }

// 1. Just the carbon fibres w/o reflecting surface
union {
  object {
    myObj
    texture { T_Carbon_A }
  }
  redCyl
  translate <-3,5.50>

Quote:}

// 2. reflections at the surface
union {
  object {
    myObj
    texture { T_Carbon_B }
  }
  redCyl
  translate <3,5.50>

Quote:}

// 3. carbon !!!
union {
  object {
    myObj
    texture { T_Carbon }
  }
  redCyl
  translate <3,1,0>
Quote:}

// --snip-- end carbon.pov ----------------------