Following this simple code, you can create a small brick wall covered by a layer of stucco. The stucco could be ruined and aged using only a parameter of a Macro. Here is the code:
#version 3.7;
global_settings { assumed_gamma 1.0
noise_generator 2 } // modificare in 2 o 3
light_source {
< 800, 800,-800>
rgb 1
}
camera {
location <0.2, 0.0,-28.0>
look_at <0.0, 0.0, 0.0>
right x*image_width/image_height // mantenere le proporzioni dell'immagine
angle 65
}
//====== Preparare lo stucco Stucco ======
#declare L2=0.33; //clock; //Set amount of decay of stucco, higher value is more decay. animate
#declare PRugoso= pigment { //Cemento
wrinkles
scale 0.25
colour_map {
[0, rgb 0.5]
[L2, rgb 0.89]
}
}
#declare Stucco= pigment { //Stucco
granite
scale 0.15
colour_map {
[0, rgb 0.96]
[1, rgb 1]
}
}
#declare Stucem= pigment { //Stucco & Cemento
pigment_pattern{
wrinkles
scale 0.25
}
pigment_map {
[L2, PRugoso]
[L2, Stucco]
}
}
#declare HF_Stucco=height_field { //Viene trasformato in hightfield
function 1000, 1000{ //500,500 per il test, valori superiori vanno meglio ma controllare la memoria
pigment{Stucem }
}
translate -0.5
rotate -90*x
scale <20,20,2>
pigment { //Usare il cemento per colorare lo stucco
pigment_pattern {
wrinkles
scale 0.25
}
color_map {
[L2, rgb 0.5]
[L2, rgb <1,1,0.95>]
}
warp {planar z, 0}
translate <-0.5, -0.5, 0>
rotate <180,0,0>
scale <40,40,2>
}
}
//====== Mettere alcuni mattoni ======
//Taglia : dimensioni del mattone nel vettore x, y, z
//Cemento : larghezza della giunzione.
//Turbolenza etc : controlla la deformazione della pietra.
#macro Muromatt(Taglia, Cemento, Turbolenza, Octaves, Lambda, Omega)
#local Mattone= pigment {
boxed // un mattone singolo ...
scale <Taglia.x/2,Taglia.y/2,Taglia.z/2>
translate <Taglia.x/2+Cemento,Taglia.y/2+Cemento,0>
warp {repeat x*(Taglia.x+Cemento)} // ... ripetuto molte volte.
warp {repeat y*(2*(Taglia.y+Cemento))}
}
#declare FMuromatt= function {
pigment {
pigment_pattern {
gradient y
warp {repeat y}
scale <1,2*(Taglia.y+Cemento),1>
}
pigment_map {
[0.5, Mattone
warp { // deformare i mattoni ...
turbulence Turbolenza
octaves Octaves
lambda Lambda
omega Omega
}
translate <0,-(Cemento/2),0>
]
[0.5, Mattone // ... riga per riga.
warp {
turbulence Turbolenza
octaves Octaves
lambda Lambda
omega Omega
}
translate <(Taglia.x/2)+Cemento,(Taglia.y+(Cemento/2)),0>
]
}
}
}
#end
#declare Parete=pigment {
Muromatt(<4,1.25,1>,0.3,<0.15,0.1,0>,6,0.7,0.5)
function{FMuromatt(x,y,z).gray}
pigment_map { // dare struttura ai giunti ...
[0, granite
scale 0.1
colour_map {
[0, rgb 0][1, rgb 0.3]
}
]
[0.05, crackle // ... e ai mattoni.
scale <3,1,1>
turbulence 0.5
colour_map {
[0, rgb 0.34][1, rgb 0.5]
}
]
}
scale 0.04
}
#declare HF_Parete=height_field { // Costruire la parete
function 1000, 1000 { //500,500 per il test, valori superiori vanno meglio, ma controllare la memoria
pigment{Parete}
}
smooth
translate -0.5
rotate <-90,0,0>
scale <33,33,1>
pigment {
Parete
pigment_map {
[0, rgb 0.6]
[0.05, wrinkles
turbulence 0.3
scale <2,0.3,1>
colour_map {
[0.0, rgb <0.5,0.3,0.25>]
[0.15, rgb <0.5,0.3,0.25>/1.3]
[0.3, rgb <0.5,0.3,0.25>]
[0.6, rgb <0.6,0.3,0.25>/1.6]
[0.8, rgb <0.5,0.3,0.25>]
[1.0, rgb <0.5,0.3,0.35>/2]
}
]
}
translate <-0.5, -0.5, 0>
rotate -90*x
warp {planar y, 0}
scale <33,33,1>
}
}
object {HF_Stucco}
object {HF_Parete translate <0,0,-0.75>}
And the picture generated by the code written above.
Nessun commento:
Posta un commento