Difference between revisions of "User:Le Forgeron/UVMapping"
Jump to navigation
Jump to search
Le Forgeron (talk | contribs) |
Le Forgeron (talk | contribs) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
{{User:Le_Forgeron/HgPovray38/available}} | {{User:Le_Forgeron/HgPovray38/available}} | ||
− | + | ==UV mapping of shapes== | |
− | The origin of the mapping for u=0 (at v=0) can be controlled by adding <code | + | The origin of the mapping for u=0 (at v=0) can be controlled by adding <code>uv_reference <vector></code>, to define with the axis of symmetry a half-plane in which the origin is to be found. |
So far the addition, when compared to official master, covers: | So far the addition, when compared to official master, covers: | ||
* cone | * cone | ||
* cylinder | * cylinder | ||
+ | * lemon | ||
+ | ** first point is at v=0 | ||
+ | ** second point is at v=1 | ||
+ | ** outer first disc is at v=1/4 | ||
+ | ** outer second disc is at v=3/4 | ||
* disc | * disc | ||
− | * | + | ** inner circle is at v=0 |
+ | ** outer circle is at v=1 | ||
* sphere_sweep | * sphere_sweep | ||
+ | ** the first segment is the axis of symmetry for the purpose of <code>uv_reference</code> | ||
+ | ** the first sphere is at v=0 | ||
+ | ** the last sphere is at v=1 | ||
+ | ** the progression of v is proportional to the length of the segment, when compared to the cumulated length of all segments | ||
+ | ** v is constant on each sphere, and u transfers to the next segment | ||
[[Image:LeForgeronUVMapping.png]] | [[Image:LeForgeronUVMapping.png]] |
Latest revision as of 20:26, 12 September 2018
- 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>
, to define with the axis of symmetry a half-plane in which the origin is to be found.
So far the addition, when compared to official master, covers:
- cone
- cylinder
- lemon
- first point is at v=0
- second point is at v=1
- outer first disc is at v=1/4
- outer second disc is at v=3/4
- disc
- inner circle is at v=0
- outer circle is at v=1
- sphere_sweep
- the first segment is the axis of symmetry for the purpose of
uv_reference
- the first sphere is at v=0
- the last sphere is at v=1
- the progression of v is proportional to the length of the segment, when compared to the cumulated length of all segments
- v is constant on each sphere, and u transfers to the next segment
- the first segment is the axis of symmetry for the purpose of
#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}