Created
February 19, 2010 07:48
-
-
Save Nokogiri/308534 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Konify3D | |
Copyright (C) 2009 Xyne | |
This program is free software; you can redistribute it and/or | |
modify it under the terms of the GNU General Public License | |
as published by the Free Software Foundation; either version 2 | |
of the License, or (at your option) any later version. | |
This program is distributed in the hope that it will be useful, | |
but WITHOUT ANY WARRANTY; without even the implied warranty of | |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
GNU General Public License for more details. | |
You should have received a copy of the GNU General Public License | |
along with this program; if not, write to the Free Software | |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
*/ | |
//povray +Ikonify3d.pov +P +W1680 +H1050 +D +Q11 +A | |
#include "metals.inc" | |
#include "rand.inc" | |
#include "math.inc" | |
#include "colors.inc" | |
#declare Aspect_Ratio = 1680/1050; | |
#declare Cam_Pos = <0,-1,-5>; | |
#declare Cam_Angle = 80; | |
//width of background array | |
#declare N = 30; | |
//random seed... change this to change the random pattern | |
#declare Random_1 = seed (87341); | |
//Greyscale Range | |
#declare Grey_Min = 0.05; | |
#declare Grey_Max = 0.10; | |
// Enable Colors | |
#declare Colorful = 0; | |
#declare Red_Min = 0; | |
#declare Red_Max = 1; | |
#declare Green_Min = 0; | |
#declare Green_Max = 1; | |
#declare Blue_Min = 0; | |
#declare Blue_Max = 1; | |
// Amount by which the height varies in the background | |
#declare Jitter_Height = 1.2; | |
#declare Height = 2; | |
#declare Rounded_Box_Radius = 0.01; | |
#declare Edge = 0.2; | |
#declare Include_Logo = 1; | |
#declare Only_Logo_Reflection = 1; | |
#declare Arch_Logo_As_Light = 0; | |
#declare Logo_Size = 6; //2 is a good size to start with when not viewing the reflection | |
#declare Arch_Logo_Color_Vector = <23/255, 147/255, 209/255>; | |
/* | |
Careful with these settings, they can greatly increase the render time | |
These look better imo when you remove the light source at the camera below. | |
*/ | |
#declare Random_Arch_Logo_Lights = 0; //This needs work, don't bother | |
#declare Random_Lights_In_Array = 0; | |
#declare Random_Lights_In_Array_Frequency = 0.08; | |
#declare Pattern_Lights_In_Array = 1; | |
#declare Circular_Pattern = 0; | |
#declare Inner_Radius = 10.5; | |
#declare Outer_Radius = 11.8; | |
#declare Random_Color_Lights = 0; | |
#declare Random_Light_Lower_Jitter = 0.2; | |
#declare Random_Light_Upper_Jitter = 0.5; | |
// between 0 and 1 | |
#declare Rainbow_Lights_In_Array = 0; | |
#declare Rainbow_Phase_Shift = -90; | |
#declare Circular_Rainbow_Lights_In_Array = 1; | |
/* | |
// This sets the progression of the rainbow. | |
// 360/x, where x specified the number of | |
// rows or columns before the phase completes | |
// a cycle. e1 specifies the x direction and e2 | |
// specified the y direction in the final image. | |
// | |
// Set the value to zero to suppress progression | |
// in that direction. | |
*/ | |
#declare Rainbow_e1_k = 360/20; | |
#declare Rainbow_e2_k = 360/40 * 0; | |
// Light settings | |
global_settings { ambient_light rgb <2, 2, 2> } | |
light_source { Cam_Pos color rgb <1,1,1>} | |
//background { color White } | |
#declare Vect_0 = <0,0,0>; | |
#declare Vect_A = Edge * <1,0,0>; | |
#declare Vect_B = Edge * <0,1,0>; | |
#declare Vect_C = Height * Edge * <0,0,-1>; | |
#declare Jitter_Height = Jitter_Height * Edge; | |
#declare Max = N; | |
#declare Min = -Max; | |
#declare Cam_Look = Vect_0; | |
#declare Cam_Zoom = 1; | |
camera { | |
up Cam_Zoom * <0,1,0> | |
right Cam_Zoom * Aspect_Ratio * <1,0,0> | |
location Cam_Pos | |
look_at Cam_Look | |
//sky <0,0,1> | |
angle Cam_Angle | |
} | |
/* | |
############################## | |
########## TEXTURES ########## | |
############################## | |
*/ | |
#declare Base_Texture = texture { | |
F_MetalB | |
pigment { color <1,1,1> } | |
} | |
#declare Arch_Logo_Texture = texture { | |
pigment { | |
color rgb Arch_Logo_Color_Vector | |
} | |
finish{ | |
reflection {0.1,0.3} | |
ambient 0.5 diffuse 0.5 | |
specular 0.6 roughness 1/1000 | |
} | |
} | |
/* | |
############################ | |
########## MACROS ########## | |
############################ | |
*/ | |
#macro Get_Reflected_Vector(Vect_U, Surface_Point, Surface_Normal) | |
Vect_U - 2 * VProject_Plane(Vect_U - Surface_Point,Surface_Normal) | |
#end | |
#macro Get_Random_Vector(Min1,Max1,Min2,Max2,Min3,Max3) | |
RRand(Min1,Max1,Random_1) * <1,0,0> + RRand(Min2,Max2,Random_1) * <0,1,0> + RRand(Min3,Max3,Random_1) * <0,0,1>; | |
#end | |
#macro Get_Random_Color_Vector() | |
rgb Get_Random_Vector(Red_Min,Red_Max,Green_Min,Green_Max,Blue_Min,Blue_Max) | |
#end | |
#macro Get_AB_Rainbow_Color_Vector(e1,e2) | |
#local Hue = mod(Rainbow_Phase_Shift + Rainbow_e1_k * e1 + Rainbow_e2_k * e2, 360); | |
CHSV2RGB(<Hue,1,1>); | |
#end | |
#macro Get_AB_Circular_Rainbow_Color_Vector(e1,e2) | |
#local Hue = mod(Rainbow_Phase_Shift + degrees(atan2(e2,e1)), 360); | |
CHSV2RGB(<Hue,1,1>); | |
#end | |
#macro Get_AB_Light_Color_Vector(e1,e2) | |
#if (Random_Color_Lights) | |
Get_Random_Color_Vector() | |
#else | |
#if (Circular_Rainbow_Lights_In_Array) | |
Get_AB_Circular_Rainbow_Color_Vector(e1,e2) | |
#else | |
#if (Rainbow_Lights_In_Array) | |
Get_AB_Rainbow_Color_Vector(e1,e2) | |
#else | |
rgb Arch_Logo_Color_Vector; | |
#end | |
#end | |
#end | |
#end | |
#macro Get_AB_Object(e1,e2,Current_Object) | |
#declare AB_Object = Current_Object; | |
#if (Random_Lights_In_Array) | |
#if Rand_Bernoulli(Random_Lights_In_Array_Frequency,Random_1)) | |
#local Color_Vector = Get_AB_Light_Color_Vector(e1,e2) | |
#declare AB_Object = light_source { | |
<0,0,0> | |
color (Color_Vector) | |
looks_like { | |
object { | |
Current_Object | |
pigment { Color_Vector + (<0,0,0,0.90>)} | |
finish { | |
phong 0.8 phong_size 20 | |
reflection 0.2 | |
} | |
interior { ior 1.2 } | |
translate -RRand(Random_Light_Lower_Jitter,Random_Light_Upper_Jitter,Random_1) * Vect_C | |
} | |
} | |
} | |
#end | |
#else | |
#if (Pattern_Lights_In_Array) | |
#if (Circular_Pattern) | |
#local dist = sqrt((e1*e1) + (e2*e2)); | |
#if (dist > Inner_Radius & dist < Outer_Radius) | |
#local Color_Vector = Get_AB_Light_Color_Vector(e1,e2) | |
#declare AB_Object = light_source { | |
<0,0,0> | |
color (Color_Vector) | |
looks_like { | |
object { | |
Current_Object | |
pigment { Color_Vector + (<0,0,0,0.90>)} | |
finish { | |
phong 0.8 phong_size 20 | |
reflection 0.2 | |
} | |
interior { ior 1.2 } | |
translate -RRand(Random_Light_Lower_Jitter,Random_Light_Upper_Jitter,Random_1) * Vect_C | |
} | |
} | |
} | |
#end | |
#end | |
#end | |
#end | |
AB_Object | |
#end | |
#macro Get_AB_Jitter(e1,e2) | |
RRand(0, Jitter_Height,Random_1) | |
#end | |
#macro Get_AB_Texture(e1,e2) | |
texture{ | |
Base_Texture | |
#if (Colorful) | |
pigment { color rgb Get_Random_Color_Vector() } | |
#else | |
pigment { color rgb RRand(Grey_Min,Grey_Max,Random_1) * <1,1,1> } | |
#end | |
} | |
#end | |
# macro Create_Rounded_Box(Vect_A, Vect_B, Vect_C, Radius, Base_Texture) | |
union { | |
#local Vect_0 = <0,0,0>; | |
#local e1 = 0; | |
#while (e1 <= 1) | |
#local e2 = 0; | |
#while (e2 <= 1) | |
#local e3 = 0; | |
#while (e3 <= 1) | |
sphere { | |
Vect_0 + (e1 * Vect_A) + (e2 * Vect_B) + (e3 * Vect_C) | |
Radius | |
} | |
#local e3 = e3 + 1; | |
#end | |
#local e2 = e2 + 1; | |
#end | |
#local e1 = e1 + 1; | |
#end | |
#local e1 = 0; | |
#while (e1 <= 1) | |
#local e2 = 0; | |
#while (e2 <= 1) | |
#local x1 = (Vect_0 + (e1 * Vect_B) + (e2 * Vect_C)); | |
cylinder { | |
x1 | |
x1 + Vect_A | |
Radius | |
} | |
#local e2 = e2 + 1; | |
#end | |
#local e1 = e1 + 1; | |
#end | |
#local e1 = 0; | |
#while (e1 <= 1) | |
#local e2 = 0; | |
#while (e2 <= 1) | |
#local x1 = (Vect_0 + (e1 * Vect_A) + (e2 * Vect_C)); | |
cylinder { | |
x1 | |
x1 + Vect_B | |
Radius | |
} | |
#local e2 = e2 + 1; | |
#end | |
#local e1 = e1 + 1; | |
#end | |
#local e1 = 0; | |
#while (e1 <= 1) | |
#local e2 = 0; | |
#while (e2 <= 1) | |
#local x1 = (Vect_0 + (e1 * Vect_B) + (e2 * Vect_A)); | |
cylinder { | |
x1 | |
x1 + Vect_C | |
Radius | |
} | |
#local e2 = e2 + 1; | |
#end | |
#local e1 = e1 + 1; | |
#end | |
#local Vect_D = Vect_0 + Vect_A + Vect_B + Vect_C; | |
box { | |
#local Delta_Vect = Radius * vnormalize(Vect_A); | |
Vect_0 - Delta_Vect | |
Vect_D + Delta_Vect | |
} | |
box { | |
#local Delta_Vect = Radius * vnormalize(Vect_B); | |
Vect_0 - Delta_Vect | |
Vect_D + Delta_Vect | |
} | |
box { | |
#local Delta_Vect = Radius * vnormalize(Vect_C); | |
Vect_0 - Delta_Vect | |
Vect_D + Delta_Vect | |
} | |
translate -Vect_A/2 - Vect_B/2 - Vect_C/2 | |
texture {Base_Texture} | |
} | |
#end | |
#macro Create_2D_Array(Rounded_Box,Vect_A,Vect_B,e1_min,e1_max,e2_min,e2_max) | |
#local Vect_C = vnormalize(vcross(Vect_A,Vect_B)); | |
#local e1 = e1_min; | |
#while (e1 <= e1_max) | |
#local e2 = e2_min; | |
#while (e2 <= e2_max) | |
object { | |
Get_AB_Object(e1, e2, Rounded_Box) | |
translate e1 * Vect_A + e2 * Vect_B | |
translate Vect_C * Get_AB_Jitter(e1,e2) | |
Get_AB_Texture(e1,e2) | |
} | |
#local e2 = e2 + 1; | |
#end | |
#local e1 = e1 + 1; | |
#end | |
#end | |
/* | |
############################### | |
########## ARCH LOGO ########## | |
############################### | |
*/ | |
#macro Get_Arch_Logo(Arch_Logo_Depth) | |
// Povray Prism of the Arch Linux Logo generated with Inkscape | |
#local Arch_Logo_MIN_X = 0.00000003; | |
#local Arch_Logo_CENTER_X = 223.05180193; | |
#local Arch_Logo_MAX_X = 446.10360384; | |
#local Arch_Logo_WIDTH = 446.10360381; | |
#local Arch_Logo_MIN_Y = 0.00000390; | |
#local Arch_Logo_CENTER_Y = 223.09375202; | |
#local Arch_Logo_MAX_Y = 446.18750013; | |
#local Arch_Logo_HEIGHT = 446.18749624; | |
#local Arch_Logo_Center = <Arch_Logo_CENTER_X, Arch_Logo_Depth/2, Arch_Logo_CENTER_Y>; | |
prism { | |
linear_sweep | |
bezier_spline | |
Arch_Logo_Depth, | |
0.0, | |
60 | |
<223.00985528, 446.18750013>, <203.15040559, 397.49743103>, <191.17216609, 365.64840403>, <169.06127317, 318.40570807>, | |
<169.06127317, 318.40570807>, <182.61802001, 304.03556324>, <199.25827717, 287.30081220>, <226.28200701, 268.40048878>, | |
<226.28200701, 268.40048878>, <197.22884269, 280.35568163>, <177.41103440, 292.35841967>, <162.60086477, 304.81368542>, | |
<162.60086477, 304.81368542>, <134.30314947, 245.76614394>, <89.96875429, 161.65555199>, <0.00000003, 0.00000390>, | |
<0.00000003, 0.00000390>, <70.71241831, 40.82349808>, <125.52743195, 65.99163601>, <176.61238714, 75.59512615>, | |
<176.61238714, 75.59512615>, <174.41878356, 85.02981162>, <173.17162317, 95.23524348>, <173.25634912, 105.88352957>, | |
<173.25634912, 105.88352957>, <173.25634912, 105.88352957>, <173.34022667, 108.14886202>, <173.34022667, 108.14886202>, | |
<173.34022667, 108.14886202>, <174.46227045, 153.45244091>, <198.02915176, 188.29089114>, <225.94640058, 185.92543916>, | |
<225.94640058, 185.92543916>, <253.86364065, 183.55998718>, <275.56341986, 144.89452515>, <274.44139358, 99.59092877>, | |
<274.44139358, 99.59092877>, <274.23026529, 91.06622292>, <273.26881336, 82.86555207>, <271.58875208, 75.25952847>, | |
<271.58875208, 75.25952847>, <322.11905710, 65.37489546>, <376.34795118, 40.27120068>, <446.10360384, 0.00000390>, | |
<446.10360384, 0.00000390>, <432.34916311, 25.32289985>, <420.07210436, 48.14966452>, <408.34799024, 69.88983440>, | |
<408.34799024, 69.88983440>, <389.88057558, 84.20330722>, <370.61816964, 102.83233705>, <331.32652099, 122.99940483>, | |
<331.32652099, 122.99940483>, <358.33334412, 115.98189729>, <377.66987543, 107.88556172>, <392.74232204, 98.83581212>, | |
<392.74232204, 98.83581212>, <273.53988043, 320.76995305>, <263.88702585, 350.26041767>, <223.00985528, 446.18750013> | |
translate -Arch_Logo_Center | |
scale <1/Arch_Logo_HEIGHT, 1 ,1/Arch_Logo_WIDTH> | |
rotate <-90,0,0> | |
} | |
#end | |
#macro Random_Arch_Logos(Vect_A,Vect_B,e1_min,e1_max,e2_min,e2_max) | |
#local Arch_Logo = Get_Arch_Logo(0.09) | |
#local Vect_C = vnormalize(vcross(Vect_A,Vect_B)) * RRand(1,2,Random_1); | |
#local e1 = e1_min; | |
#while (e1 <= e1_max) | |
#local e2 = e2_min; | |
#while (e2 <= e2_max) | |
#if (rand(Random_1) < 0.1) | |
#local Color_Vector = Get_AB_Light_Color_Vector(e1,e2) | |
light_source { | |
<0,0,0> | |
color (3 * Color_Vector) | |
looks_like { | |
object { | |
Arch_Logo | |
pigment { Color_Vector + (<0,0,0,0.80>)} | |
finish { | |
phong 0.9 phong_size 40 | |
reflection 0.2 | |
} | |
interior { ior 1.5 } | |
rotate rand(Random_1) * 60 * Vect_A | |
rotate RRand(-0.25,0.25,Random_1) * 120 * Vect_C | |
translate (e1) * Vect_A + (e2) * Vect_B - (1 + abs(mod(e1 + e2, 5))) * Vect_C | |
scale RRand(0.3,0.6,Random_1) | |
} | |
} | |
} | |
#end | |
#local e2 = e2 + 1; | |
#end | |
#local e1 = e1 + 1; | |
#end | |
#end | |
/* | |
################################## | |
########## CREATE SCENE ########## | |
################################## | |
*/ | |
#declare Rounded_Box = Create_Rounded_Box(Vect_A, Vect_B, Vect_C, Rounded_Box_Radius, Base_Texture); | |
Create_2D_Array(Rounded_Box, (Vect_A + 2 * Rounded_Box_Radius * vnormalize(Vect_A)), (Vect_B + 2 * Rounded_Box_Radius * vnormalize(Vect_B)), Min, Max, Min, Max) | |
#declare Test= | |
sphere { | |
<0,0,0> | |
0.02 | |
} | |
#if(Include_Logo) | |
#local Arch_Logo = object { | |
#if (Only_Logo_Reflection) | |
Get_Arch_Logo(0.001) | |
#else | |
Get_Arch_Logo(0.2) | |
#end | |
scale Logo_Size | |
texture {Arch_Logo_Texture} | |
photons{ | |
target | |
refraction on | |
reflection on | |
} | |
} | |
#if (Only_Logo_Reflection) | |
object { | |
Arch_Logo | |
translate Get_Reflected_Vector(2 * Cam_Pos, Vect_0, Vect_C) | |
} | |
#else | |
#if (Arch_Logo_As_Light) | |
light_source { | |
Cam_Pos * 0.5 | |
color (3 * Arch_Logo_Color_Vector) | |
looks_like { | |
object { | |
Arch_Logo | |
pigment { rgbf Arch_Logo_Color_Vector + (<0,0,0,0.90>)} | |
finish { | |
phong 0.8 phong_size 20 | |
reflection 0.2 | |
} | |
interior { ior 1.1 } | |
} | |
} | |
} | |
#else | |
object { | |
Arch_Logo | |
translate Cam_Pos * 0.5 | |
pigment { rgbf Arch_Logo_Color_Vector + (<0,0,0,0.90>)} | |
finish { | |
phong 0.8 phong_size 20 | |
reflection 0.2 | |
} | |
interior { ior 1.1 } | |
} | |
#end | |
#end | |
#end | |
#if(Random_Arch_Logo_Lights) | |
Random_Arch_Logos(Vect_A*2.8,Vect_B*2.8,Min,Max,Min,Max) | |
#end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment