Test your textures

Menu

//====================== texturetext.txt ==========================//
// To see the textures
// Put texturetext.txt in the directory InsertMenu
// Don't forget to put textureview.inc in your include directory
// IMPORTANT: keep the names T_Texture or M_Material and My_Shape

// Plane = 0 // silver ball with textured plane
// Ball = 1 // textured ball
// Box = 2 // textured box
// All = 3 // textured box and ball
// Plane = 4 // Z plane
// MyShape = 5 // to test your shape with your texture

//=========================================================//

#include "colors.inc" // Standard color definitions
#include "textures.inc" // Standard texture definitions
#declare yes = 1;
#declare no = 0;
//=========================================================//
#declare Shape_Choice = 5; // Choose the shape
//=========================================================//
#declare Material = no; // Yes or no, if you want interior

//================= Here we develop our texture ====================//

#declare T_Texture = texture {
   pigment {rgb Red}
   // normal {bumps 0.2}
   // finish {ambient 0.3 diffuse 0.6}
}

//================= Here we develop our material ===================//

#declare M_Material = material {
   texture {
     pigment {rgb Blue filter 0.8}
     // normal {spotted 0.5}
   // finish {ambient 0.2 reflection 0.5}
   }
   interior {ior 1.45}
}

//================ Here we put our shape ==========================//

#declare My_Shape = cylinder { // cylinder by example
   <0,0,0>, <0,3,0>, 1
}

//==========================================================//

#declare Shape = object {My_Shape scale 0.2} // needed if you want to see your shape
#include "textureview.inc" // needed
//==========================================================//

// Display the textures
//========================= textureview.inc ======================//
// Put this file in your include directory
// Don't forget to put texturetest.txt in your directory InsertMenu
//==========================================================//
// Persistence of Vision Ray Tracer Scene
// Textureview.inc by © Martial Rameaux: martialrameaux.com
//==========================================================//
camera {
   location <0, 1.5, -2.5>
   up y
   right x*1.33
   look_at <0,1,0>
}
//========================= Lights ============================//
light_source {<0, 50, -50> color rgb 0.5}
light_source {<0, 25, -100 color rgb 0.5 shadowless}
#declare yes = 1;
#declare no = 0;
//============================== Default colors ==================//
#default {    pigment {rgb <0.8, 0.8, 0.2>}
   // finish {ambient 0.2 diffuse 0.6}
}

//====================== Floor and background =====================//
#ifndef (Material)
#declare Material = 0;
#end

//===========================================================//

#ifnded {T_Texture}
#declare T_Texture = texture {
   pigment {color rgb <1, 1, 0>}
}
#end

#declare Ball = 1;
#declare Box = 2;
#declare All = 3;
#declare Plane = 4;
#declare MyShape = 5;
#ifnded (Shape_Choice)
#declare Shape_Choice = 0;
#end

#if (Material = 1)
#switch (Shape_Choice)
   #case (Ball)
sphere {
   <0,0,0>, 1
   material {M_Material} // scale 0.5 //!!! I made a modification here : he wrote material {texture}; I think it's material {M_Material}
   translate y
}
plane {
   y, 0
   texture {
     pigment {checker color rgb 1 color rgb 0}
     finish {ambient 0.4 diffuse 0.6}
     scale 0.75
     rotate y*30
   }
   hollow
}
background {color rgb 1}
#break
//===========================================================//
   #case {Box}
box {
   -1, 1
   material {M_Material}
   scale 0.7
   rotate <-40,40,0>
   translate <0.1, 1, 0>
}
plane {
   y, 0
   texture {
     pigment {checker color rgb 1 color rgb 0}
     finish {ambient 0.4 diffuse 0.6}
     scale 0.75
     rotate y*30
   }
   hollow
}
background {color rgb 1}
#break
//===========================================================//
   #case {All}
sphere {
   <0,0,0>, 1
   material {M_Material} // scale 0.5
   translate <0,3,1>
   scale 0.5
   hollow
}
box {
   -1, 1
   material {M_Material}
   rotate <-0, 45, 0>
   translate <0, 1, 1>
   scale 0.5
   hollow
}
plane {
   y, 0
   material {M_Material scale 2}
   hollow
}
plane {
   z, 20
   pigment {checker rgb 0, rgb 0.5}
}
#break
//===========================================================//
   #case {Plane}
camera {
   orthographic
   location <0,0,-10>
   right <21*1.33, 0, 0>
   up <0,21,0>
   direction <0,0,1>
   look_at <0, -1, 0>
}
plane {
   z, 500
   material {M_Material} // scale 0.5
   hollow
}
#break
//===========================================================//
   #case {MyShape}
object {Shape material {M_Material} translate y}
background {color rgb 0.8}
#break
//===========================================================//
   #else // Silver ball with textured plane
background {color rgb 1}
plane {
   y, 0
   material {M_Material scale 2}
   hollow
}
plane {
   y, -10
   texture {
     pigment {checker color rgb 1 color rgb 0}
     finish {ambient 1 diffuse 0}
     scale 2
     rotate y*30
   }
   hollow
}
// Silver sphere
sphere {
   <0, 1.2, 0>, 0.75
   texture {
     pigment {color rgb <0.9, 0.91, 0.98>}
     finish {
      metallic
      ambient 0.2
      diffuse 0.7
      brilliance 6
      reflection 0.25
      phong 0.75
      phong_size 80
     }
   }
}
#end
//==========================================================//
#else // if Material = 0
#switch (Shape_Choice)
   #case (Ball)
sphere {
   <0,0,0>, 1
   texture {T_Texture} // scale 0.5
   translate y
}
plane {
   y, 0
   texture {
     pigment {checker color rgb 1 color rgb 0}
     finish {ambient 0.4 diffuse 0.6}
     scale 0.75
     rotate y*30
   }
   hollow
}
background {color rgb 1}
#break
//===========================================================//
   #case {Box}
box {
   -1, 1
   texture {T_Texture}
   scale 0.7
   rotate <-40,40,0>
   translate <0.1, 1, 0>
}
plane {
   y, 0
   texture {
     pigment {checker color rgb 1 color rgb 0}
     finish {ambient 0.4 diffuse 0.6}
     scale 0.75
     rotate y*30
   }
   hollow
}
background {color rgb 1}
#break
//===========================================================//
   #case {All}
sphere {
   <0,0,0>, 1
   texture {T_Texture} // scale 0.5
   translate <0,3,1>
   scale 0.5
   hollow
}
box {
   -1, 1
   texture {T_Texture}
   rotate <-0, 45, 0>
   translate <0, 1, 1>
   scale 0.5
   hollow
}
plane {
   y, 0
   texture {T_Texture scale 2}
   hollow
}
plane {
   z, 20
   pigment {checker rgb 0, rgb 0.5}
}
#break
//===========================================================//
   #case {Plane}
camera {
   orthographic
   location <0,0,-10>
   right <21*1.33, 0, 0>
   up <0,21,0>
   direction <0,0,1>
   look_at <0, -1, 0>
}
plane {
   z, 500
   texture {T_Texture} // scale 0.5
   hollow
}
#break
//===========================================================//
   #case {MyShape}
object {Shape texture {T_Texture} translate y}
background {color rgb 0.8}
#break
//===========================================================//

   #else // Silver ball with textured plane
background {color rgb 1}
plane {
   y, 0
   texture {T_Texture scale 2}
   hollow
}
plane {
   y, -10
   texture {
     pigment {checker color rgb 1 color rgb 0}
     finish {ambient 1 diffuse 0}
     scale 2
     rotate y*30
   }
   hollow
}
// Silver sphere
sphere {
   <0, 1.2, 0>, 0.75
   texture {
     pigment {color rgb <0.9, 0.91, 0.98>}
     finish {
      metallic
      ambient 0.2
      diffuse 0.7
      brilliance 6
      reflection 0.25
      phong 0.75
      phong_size 80
     }
   }
}
#end // SWITCH
#end // IF