Povray

From Ghoulwiki
Revision as of 23:53, 18 May 2007 by Ghoulsblade (talk | contribs)
Jump to: navigation, search

explosion generator

  • todo...

skybox

  • todo...
  • renderskybox.php
#!/usr/bin/php <?php /* This script renders 6 sides of a skybox with povray. Written in PHP, to execute "apt-get install php4-cli" */ // resolution in pixels, height=weight=size $size = 256; // 32^x ?? // $size = 128; // $size = 256; $infile = "skybox1.pov"; $outfile_prefix = "ghoulskybox1"; $outfile_postfix = ".png"; $frame_name = array(); // ogre skybox naming sheme $frame_name[0] = "_fr"; // front $frame_name[1] = "_rt"; // right $frame_name[2] = "_bk"; // back $frame_name[3] = "_lf"; // left $frame_name[4] = "_up"; // up $frame_name[5] = "_dn"; // down for ($i=0;$i<6;++$i) { echo "rendering frame ".($i+1)."/6:\n"; $outfile = $outfile_prefix . $frame_name[$i] . $outfile_postfix; shell_exec("povray -I$infile -H$size -W$size +FN16 -D -O$outfile -K$i"); //shell_exec("povray -I$infile -H$size -W$size +FT -D -O$outfile -K$i"); //shell_exec("convert $outfile ".str_replace(".tga",".jpg",$outfile)); } echo "done.\n"; /* ogre sample space skybox named "Examples/SpaceSkyBox" is stored in ogrenew/Samples/Media/materials/scripts/Example.material and looks like this : material Examples/SpaceSkyBox { technique { pass { lighting off depth_write off texture_unit { cubic_texture stevecube.jpg separateUV tex_address_mode clamp } } } } the stevecube.jpg adresses 6 images, which are zipped in ogrenew/Samples/Media/packs/skybox.zip stevecube_UP.jpg stevecube_FR.jpg stevecube_DN.jpg stevecube_BK.jpg stevecube_LF.jpg stevecube_RT.jpg the povray camera for the skybox should be something like this camera { location <0,0,0> angle 90 right <1,0,0> up <0,1,0> // turn the cam based on the current frame=clock : [0-5] #switch (clock) #range (0,3) // first 4 frames : turn from left to right rotate (90*clock)*y #break #case (4) // look at the sky rotate 90*x #break #case (5) // look at the ground rotate -90*x #break #end // End of conditional part } */ ?>

skybox1.pov

//	Persistence of Vision Raytracer Version 3.5 Scene Description File
//*******************************************

global_settings {
  //max_trace_level 5
}

#include "colors.inc"

camera {
  location <0,0,0>
  angle 90
  right <1,0,0> up <0,1,0>
  // turn the cam based on the current frame=clock : [0-5]
  #switch (clock)
    #range (0,3)
      // first 4 frames : turn from left to right
      rotate (90*clock)*y
    #break
    #case (4)
      // look at the sky
      rotate -90*x
    #break
    #case (5)
      // look at the ground
      rotate 90*x
    #break
  #end // End of conditional part
}

background { color rgb <0,0,0> }

// light_source { <100, 100, -200> color White }


sphere { < 0, 0, 0>, 2
	pigment { rgbt 1 } // surface of sphere is transparent
	interior {
		media {
			emission 0.02
			intervals 1
			samples 25
			method 3
			density {
				spherical
				ramp_wave
        translate 1.0*y  // replace 1.0 = t   by time for animation
        warp { turbulence 1.5 }
        translate -1.0*y // replace -1.0 = -t  by time for animation
				color_map {
					[0.0 color rgb <0, 0, 0>]
					[0.1 color rgb <1, 0, 0>]
					[0.5 color rgb <1, 1, 0>]
					[1.0 color rgb <1, 1, 0>]
				}
			}
		}
	}
	scale 25
	hollow
}

explosion

Pov exp1.png

//	Persistence of Vision Raytracer Version 3.5 Scene Description File
//*******************************************

global_settings {
  max_trace_level 5
}

#include "colors.inc"

camera {
	location <-1.5, 30, -150>
	look_at <0, 25, 35>
	angle 35
}

background { color rgb 0 }

// light_source { <100, 100, -200> color White }


sphere { < 0, 0, 0>, 2
	pigment { rgbt 1 } // surface of sphere is transparent
	interior {
		media {
			emission 0.02
			intervals 1
			samples 25
			method 3
			density {
				spherical
				ramp_wave
        translate 1.0*y  // replace 1.0 = t   by time for animation
        warp { turbulence 1.5 }
        translate -1.0*y // replace -1.0 = -t  by time for animation
				color_map {
					[0.0 color rgb <0, 0, 0>]
					[0.1 color rgb <1, 0, 0>]
					[0.5 color rgb <1, 1, 0>]
					[1.0 color rgb <1, 1, 0>]
				}
			}
		}
	}
	scale 25
	translate 25*y
	hollow
}