// (C) 2015 Christoph Lipka // +w1200 +h900 +am3 +r9 +a0.01 +ac0.9 // +w1920 +h1200 +am3 +r9 +a0.002 +ac0.99 // +w1920 +h1200 +am3 +r9 +a0.5 +ac0.9 #version unofficial patch 3.71; #patch 0.99; global_settings { assumed_gamma 1.0 } #include "colors_lego_.inc" #declare Brightness = 1.0; #declare Radiosity = on; #declare FocalBlur = on; #declare AreaLight = on; #declare mm = 1; #declare cm = 10*mm; #declare m = 1000*mm; #declare BrickPitch = 8.0*mm; #declare BrickXUnit = 1.0*BrickPitch; #declare BrickYUnit = 0.4*BrickPitch; #declare BrickUnit = ; #declare Bevel = 0.1*mm; #declare XGap = 0.1*mm; #declare YGap = 0.0*mm; #declare Gap = ; #declare Overlap = 0.01*mm; #declare StudlessGap = 0.48*mm; #declare StudlessGapDepth = 0.24*mm; #declare StudDiameter = BrickXUnit-BrickYUnit; #declare StudRadius = StudDiameter/2; #declare StudHeight = 1.8*mm; #declare StudBevel = 0.4*mm; #declare PlasticSpecularity = 1.0; #declare PlasticRoughness = 0.001; #declare PlasticTranslucency = 0.0; global_settings { #if (Radiosity) radiosity { pretrace_start 0.1 pretrace_end 0.001 recursion_limit 2 count 3 nearest_count 20,10 always_sample off maximum_reuse 0.1 minimum_reuse 0.001 no_cache } #end mm_per_unit 1/mm adc_bailout 0.001 max_trace_level 2 subsurface { samples 5, 5 } } #declare Stud = difference { merge { cylinder { <0.5,0,0.5>*BrickUnit-y*YGap-y*Overlap, <0.5,0,0.5>*BrickUnit+y*StudHeight-y*StudBevel, StudRadius } cylinder { <0.5,0,0.5>*BrickUnit-y*YGap-y*Overlap, <0.5,0,0.5>*BrickUnit+y*StudHeight, StudRadius-StudBevel } torus { StudRadius-StudBevel, StudBevel translate <0.5,0,0.5>*BrickUnit+y*StudHeight-y*StudBevel } cylinder { <0.5,0,0.5>*BrickUnit-y*YGap-y*Overlap, <0.5,0,0.5>*BrickUnit-y*YGap+y*Bevel, StudRadius+Bevel } } torus { StudRadius+Bevel, Bevel translate <0.5,0,0.5>*BrickUnit-y*Gap+y*Bevel } } #macro SimpleStudlessBrick(W,D,H) #local Size=; merge { box { Gap+(x+y)*Bevel, Size*BrickUnit-Gap-(x+y)*Bevel } box { Gap+(x+z)*Bevel, Size*BrickUnit-Gap-(x+z)*Bevel } box { Gap+(y+z)*Bevel, Size*BrickUnit-Gap-(y+z)*Bevel } #for (X,0,1) #for (Y,0,1) #for (Z,0,1) sphere { Size**BrickUnit+(1-2*)*(Gap+Bevel), Bevel } #end #end #end #for (X,0,1) #for (Y,0,1) cylinder { Size**BrickUnit+(1-2*)*(Gap+Bevel), Size**BrickUnit+(1-2*)*(Gap+Bevel), Bevel } #end #end #for (X,0,1) #for (Z,0,1) cylinder { Size**BrickUnit+(1-2*)*(Gap+Bevel), Size**BrickUnit+(1-2*)*(Gap+Bevel), Bevel } #end #end #for (Y,0,1) #for (Z,0,1) cylinder { Size*<0,Y,Z>*BrickUnit+(1-2*<0,Y,Z>)*(Gap+Bevel), Size*<1,Y,Z>*BrickUnit+(1-2*<1,Y,Z>)*(Gap+Bevel), Bevel } #end #end } #end #macro Brick(W,D,H) merge { SimpleStudlessBrick(W,D,H) #for (X,1,W) #for (Z,1,D) object { Stud translate *BrickUnit } #end #end } #end #macro StudlessBrick(W,D,H) #local Size=; merge { box { Gap+(x+y)*Bevel+y*StudlessGap, Size*BrickUnit-Gap-(x+y)*Bevel } box { Gap+(x+z)*Bevel+y*StudlessGap, Size*BrickUnit-Gap-(x+z)*Bevel } box { Gap+(y+z)*Bevel+y*StudlessGap, Size*BrickUnit-Gap-(y+z)*Bevel } box { Gap+(x+z)*Bevel+(x+z)*StudlessGapDepth, Size*BrickUnit-Gap-(x+z)*Bevel-(x+z)*StudlessGapDepth-y*Overlap } #for (X,0,1) #for (Y,0,1) #for (Z,0,1) sphere { Size**BrickUnit+(1-2*)*(Gap+Bevel)+y*(1-Y)*StudlessGap, Bevel } #end #end #end #for (X,0,1) #for (Y,0,1) cylinder { Size**BrickUnit+(1-2*)*(Gap+Bevel)+y*(1-Y)*StudlessGap, Size**BrickUnit+(1-2*)*(Gap+Bevel)+y*(1-Y)*StudlessGap, Bevel } #end #end #for (X,0,1) #for (Z,0,1) cylinder { Size**BrickUnit+(1-2*)*(Gap+Bevel)+y*StudlessGap, Size**BrickUnit+(1-2*)*(Gap+Bevel), Bevel } #end #end #for (Y,0,1) #for (Z,0,1) cylinder { Size*<0,Y,Z>*BrickUnit+(1-2*<0,Y,Z>)*(Gap+Bevel)+y*(1-Y)*StudlessGap, Size*<1,Y,Z>*BrickUnit+(1-2*<1,Y,Z>)*(Gap+Bevel)+y*(1-Y)*StudlessGap, Bevel } #end #end } #end #declare Brick2x4 = Brick(2,4,3) #declare PlasticFinish = finish { emission 0 ambient 0.1 diffuse albedo 0.9 specular albedo PlasticSpecularity roughness PlasticRoughness fresnel on reflection { PlasticSpecularity fresnel on roughness PlasticRoughness } conserve_energy #if (vlength(PlasticTranslucency)>0) subsurface { translucency PlasticTranslucency } #end } #declare PlasticInterior = interior { ior 1.5 } #declare White = material { texture { pigment { colour LegoClassicWhite } finish { PlasticFinish } } interior { PlasticInterior } } #declare Red = material { texture { pigment { colour LegoClassicRed } finish { PlasticFinish } } interior { PlasticInterior } } #declare Blue = material { texture { pigment { colour LegoClassicBlue } finish { PlasticFinish } } interior { PlasticInterior } } #declare Black = material { texture { pigment { colour LegoClassicBlack } finish { PlasticFinish } } interior { PlasticInterior } } #declare Grey = material { texture { pigment { colour LegoClassicGrey } finish { PlasticFinish } } interior { PlasticInterior } } #declare Yellow = material { texture { pigment { colour LegoClassicYellow } finish { PlasticFinish } } interior { PlasticInterior } } object { Brick2x4 material { Blue } translate <-2, 0,-1>*BrickUnit } object { Brick2x4 material { Red } translate < 0, 0,-3>*BrickUnit } object { Brick2x4 material { Black } rotate y*90 translate <-2, 3, 1>*BrickUnit } object { Brick(1,1,3) material { White } translate -0.5*BrickUnit rotate y*-5 translate < 0, 6,-1>*BrickUnit+0.5*BrickUnit } object { Brick(1,3,1) material { Yellow } rotate y*90 translate <-1, 0, 4>*BrickUnit } camera { angle 30 up y right x*image_width/image_height direction -z location vnormalize(<1,0.7,1>)*30*cm look_at <2,0,0>*cm + y*BrickYUnit*0 #if (FocalBlur) focal_point <0,0,0>*cm + y*BrickYUnit*6 aperture 3*mm blur_samples 1 #end } light_source { vnormalize(<-0.5,1,2>)*2*m #if (Radiosity) colour rgb <1.35,1.15,0.50>*Brightness #else colour rgb 1.5*Brightness #end #if (AreaLight) area_light x*50*cm, y*50*cm, 17,17 adaptive 0 circular orient area_illumination #end } union { plane { y,0 } #for(X,-11,10) #for(Z,-11,10) object { Stud translate *BrickUnit } #end #end material { Grey } } sky_sphere { pigment { planar poly_wave 2 pigment_map { [0.0 colour rgb <0.20,0.40,0.90>] [1.0 colour rgb <0.60,0.70,0.95>] } } emission Brightness } sphere { <0,1,0>*cm, 1*cm texture { pigment { colour rgb 0.8 } finish { diffuse 0 specular albedo 1.0 roughness 0.0001 metallic on reflection { 1.0 metallic on } conserve_energy } } translate <6,1,2>*BrickUnit } sphere { <0,1,0>*cm+y*StudHeight/2, 1*cm material { White } translate <-6,0,0>*BrickUnit } #for (X,0,3) #for (Z,0,3) object { StudlessBrick(2,2,1) #if (mod(X+Z,2)) material { Black } #else material { White } #end translate <2+2*X,0,2*Z-2>*BrickUnit } #end #end