User:Le Forgeron/UVMapping
Jump to navigation
Jump to search
- Everything about HgPovray38 in User:Le_Forgeron/HgPovray38
- Code is available on branch hgpovray38 at https://github.com/LeForgeron/povray
UV mapping of shapes
The origin of the mapping for u=0 (at v=0) can be controlled by adding uv_reference <vector>
.
So far the addition, when compared to official master, covers:
- cone
- cylinder
- disc
- lemon
- sphere_sweep
#version 3.7;
global_settings { assumed_gamma 1.0 }
camera
{ orthographic
location - 30 * z
direction z
up y
right image_width* x / image_height
angle 30
}
light_source { -40 * z, 1 }
#declare Angle=-25*z;
#include "colors.inc"
#include "golds.inc"
#include "metals.inc"
#declare Hori=24;
#declare Hori2=8;
#declare Verti=12;
#declare VS=4;
#declare HS=4;
#declare HO=2;
#declare Trans = transform{ scale 2 rotate 65*y rotate 25*x };
#declare Texture1s= texture { uv_mapping checker texture { pigment { Black } }, texture { pigment {Gray50}} scale <1/Hori,1/Verti,1> rotate Angle }
#declare Texture1e= texture { uv_mapping checker texture { pigment { Gray20 }}, texture { pigment {Gray80}} scale <1/Hori,1/Verti,1> rotate Angle }
#declare T2s0=texture{ pigment { Green } };
#declare T2s0e=texture{ pigment { Cyan } };
#declare T2s1=texture{ pigment { NavyBlue } };
#declare Texture2s= texture
{
uv_mapping
gradient x texture_map
{
[0 T2s0]
[1 T2s1]
}
//scale <1/Hori,1/Verti,1>
}
#declare Texture2e= texture { uv_mapping
gradient x texture_map
{
[0 T2s0e]
[1 T2s1]
}
//scale <1/Hori,1/Verti,1>
}
#declare Texture3s= texture { uv_mapping checker texture { pigment { Black } }, texture { pigment {Yellow}} scale <1/Hori2,1/Verti,1> }
#declare Texture3e= texture { uv_mapping checker texture { pigment{Gray80} }, texture { pigment {Cyan}} scale <1/Hori2,1/Verti,1> }
//
#declare Verso = texture
{
uv_mapping gradient y texture_map
{
[0.0 Texture2e ]
[0.25 Texture2s ]
[0.25 Texture1s ]
[0.75 Texture1e ]
[0.75 Texture3e ]
[1.00 Texture3s ]
}
}
#declare Fin=finish {ambient 1 diffuse 0};
#declare Texture1sf= texture { checker texture { pigment { Black } finish{ Fin }}, texture { pigment {Gray50}finish{ Fin}} scale <1/Hori,1/Verti,1>
}
#declare Texture1ef= texture { checker texture { pigment { Gray20}finish{ Fin}}, texture { pigment {Gray80}finish{ Fin}} scale <1/Hori,1/Verti,1>
}
#declare T2s0=texture{ pigment { Green }finish{ Fin} };
#declare T2s0e=texture{ pigment { Cyan }finish{ Fin} };
#declare T2s1=texture{ pigment { NavyBlue }finish{ Fin} };
#declare Texture2sf= texture { gradient x texture_map{
[0 T2s0]
[1 T2s1]
}
//scale <1/Hori,1/Verti,1>
}
#declare Texture2ef= texture { gradient x texture_map{
[0 T2s0e]
[1 T2s1]
}
//scale <1/Hori,1/Verti,1>
}
#declare Texture3sf= texture { checker texture { pigment { Black }finish{ Fin} }, texture { pigment {Yellow}finish{ Fin}} scale <1/Hori2,1/Verti,1>
}
#declare Texture3ef= texture { checker texture { pigment{Gray80} finish{ Fin}}, texture { pigment {Cyan}finish{ Fin}} scale <1/Hori2,1/Verti,1>
}
#declare Flat = texture { gradient y texture_map{
[0.0 Texture2ef ]
[0.25 Texture2sf ]
[0.25 Texture1sf rotate Angle ]
[0.75 Texture1ef rotate Angle ]
[0.75 Texture3ef ]
[1.00 Texture3sf ]
}
}
cone { -y * 0.5, 0.5, 0.5 * y, 0.25 uv_reference x texture { Verso } transform{ Trans } translate VS* y + HS * x-HO*x }
cylinder { -y * 0.5, 0.5 * y, 0.5 uv_reference x texture { Verso } transform { Trans } translate HS * x -HO*x}
lemon
{
-0.5 * y, .5, 0.5 * y, .25, 1.5 uv_reference x texture
{
Verso
} transform { Trans } translate - VS* y + HS * x
-HO*x}
ovus { 0.5, 0.25 distance 1 radius 2.5 texture { Verso } transform { Trans } translate - VS * y-HO*x}
disc { 0, -y, 1, 0.125 uv_reference x texture { Verso } transform { Trans } translate +VS*y-HO*x }
//
sphere { 0, 0.5 texture { Verso } transform { Trans} translate - VS* y - HS * x-HO*x}
torus { 0.65, 0.25 texture { Verso } transform { Trans } translate - HS * x-HO*x}
box{ -0.5, 0.5 texture { Verso } transform { Trans } translate VS* y - HS * x-HO*x }
//
sphere_sweep{ cubic_spline 5 ,
0, .5,
1*y,0.35
2*y,0.5
3*y,0.35
4*y,0.5
uv_reference x texture { Verso } transform { Trans } translate -VS*y+2*HS*x-HO*x}
box { 0, <1, 1, 0> texture { Flat } scale 3 translate - 3/2 * x - y -HO*x}