POV-Ray : Newsgroups : povray.newusers : UV texture scale center : Re: UV texture scale center Server Time
30 Apr 2024 21:47:43 EDT (-0400)
  Re: UV texture scale center  
From: Mr
Date: 24 Jan 2015 15:35:00
Message: <web.54c401291bfbdbf6c31ce6010@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 24.01.2015 um 15:30 schrieb clipka:
>
> >> map_type 0  interpolate 2 } translate <0.25,0,-1> scale <1.5,1,1>]
> >
> >                                          ^^^^^^^^^^^
> > Beware - you're moving the texture here, not just scaling it!
> >
> > Note again that scaling /always/ has its origin at <0,0,0>; if you do
> > this /after/ translation, it's no longer the <0,0> of the image, but
> > rather its <-0.25,0>. To scale from the /image's/ <0,0>, you need to
> > scale first, and only then translate; you'll probably need to fix the
> > translation vector though:
> >
> >      scale <1.5,1,1> translate <1.5,1,1>*<0.25,0,-1>
>
> I think I wrote nonsense here: Translating after scaling, but with the
> scaling factor applied to the translation, has /exactly/ the same effect
> as your translating before scaling.
>
> The proper question here would be, why is there a translate in there at
> all, and exactly what effect is it supposed to have?

The translate is there in many 3d editors. it's a bad legacy, but it alows to
offset a texture in the UV space if it's a tiled texture and yu don't want to
change the uv unwraping,  you can offset the texture itself. itc can be used as
a quick hack to hide some visible seam or pattern in textures not repeating too
much. For textures repeating a lot, some people use it to tweak the exact phase
regarding geometry of some tiled patterns (like pavement over some steps,
etc...)

Here is the complete scene for this particular case:


//----------------------------------------------
//--Exported with POV-Ray exporter for Blender--
//----------------------------------------------

#version 3.7;

//--Global settings--

global_settings {
    assumed_gamma 1.0
    max_trace_level 5
    ambient_light rgb<0, 0, 0>
}

//--Custom Code--

#declare CURFRAMENUM = 1;
//#include "/home/user/directory/animation_include_file.inc"

//--Patterns Definitions--


 #declare PAT_Alpha =
pigment {
}

#declare fPAT_Alpha=
function{pigment{PAT_Alpha}}



 #declare PAT_Bump =
pigment {
}

#declare fPAT_Bump=
function{pigment{PAT_Bump}}



 #declare PAT_Diffuse =
pigment {
}

#declare fPAT_Diffuse=
function{pigment{PAT_Diffuse}}



 #declare PAT_Specular =
pigment {
}

#declare fPAT_Specular=
function{pigment{PAT_Specular}}



//--Background--

background {rgbt<0.0509, 0.0509, 0.0509, 0>}

//--Cameras--

#declare camLocation  = <7.481132, 5.343666, 6.507640>;
#declare camLookAt = <-27.098163, 46.688390, -0.903519>;
camera {
    location  <0, 0, 0>
    look_at  <0, 0, -1>
    right <-1.7777777777777777, 0, 0>
    up <0, 1, 0>
    angle  49.134343
    rotate  <-27.098163, 46.688390, -0.903519>
    translate <7.481132, 5.343666, 6.507640>
}

//--Lamps--

light_source {
    < 0,0,0 >
    color rgb<1, 1, 1>
    fade_distance 14.999991
    fade_power 2
    matrix <-0.290865, -0.055189, -0.955171,  -0.771101, 0.604525, 0.199883,
0.566393, 0.794672, -0.218391,  -0.547114, 2.224058, -1.255785>
}
#declare lampTarget1= vrotate(<0.5471,-1.256,-2.224>,<0.6503,0.05522,1.866>);

//--Material Definitions--

#default{ pigment{ color rgb 0.8 }}
#declare shader_ = finish {  //translation of spec and mir levels for when no
map influences them
    diffuse 0.8
    phong 70.0
}

#declare shader_MaterialBlack = finish {  //translation of spec and mir levels
for when no map influences them
    brilliance 1.8
    phong 0.5
    phong_size 25.2
    diffuse 0.8 0
    ambient 1
    emission 0
    conserve_energy
}

#declare shader_MaterialTex = finish {  //translation of spec and mir levels for
when no map influences them
    brilliance 1.8
    phong 0.5
    phong_size 25.2
    diffuse 0.2 0
    ambient 1
    emission 0
    conserve_energy
}

#declare shader_MaterialTex0 = finish {  //No specular nor Mirror reflection
    brilliance 1.8
    specular 0
    diffuse 0.2 0
    ambient 1
    emission 0
    conserve_energy
}

#declare shader_MaterialTex1 = finish {  //Maximum Spec and Mirror
    specular 1
    diffuse 0.2 0
    ambient 1
    emission 0
    conserve_energy
}


//--Mesh objects--

#declare DATACube =
mesh2 {
    vertex_vectors {
        8,
        <1.000000, 1.000000, -1.000000>,
        <1.000000, -1.000000, -1.000000>,
        <-1.000000, -1.000000, -1.000000>,
        <-1.000000, 1.000000, -1.000000>,
        <1.000000, 0.999999, 1.000000>,
        <0.999999, -1.000001, 1.000000>,
        <-1.000000, -1.000000, 1.000000>,
        <-1.000000, 1.000000, 1.000000>
    }
    normal_vectors {
        6,
        <0.000000, 0.000000, -1.000000>,
        <-0.000000, -1.000000, -0.000000>,
        <1.000000, -0.000000, 0.000000>,
        <-1.000000, 0.000000, -0.000000>,
        <0.000000, 1.000000, 0.000000>,
        <0.000000, -0.000000, 1.000000>
    }
    uv_vectors {
        14,
        <0.000000, 1.000000>,
        <1.000000, 2.000000>,
        <-1.000000, 1.000000>,
        <0.000000, 0.000000>,
        <-1.000000, 0.000000>,
        <1.000000, -2.000000>,
        <2.000000, 1.000000>,
        <0.000000, 2.000000>,
        <2.000000, 0.000000>,
        <0.000000, -1.000000>,
        <0.000000, -2.000000>,
        <1.000000, 0.000000>,
        <1.000000, -1.000000>,
        <1.000000, 1.000000>
    }


 #declare MAT_MaterialTex =
texture{
    pigment_pattern {
        uv_mapping image_map{
"F:\BlenDivers\Scenes\blenderpovrayTestScenes\TexturesTest\textures\SpecularTest.png"
map_type 0  interpolate 2 }
        translate <-0,0,0> scale <1,1,1>

    }
    texture_map {
        [0
            pigment {
                pigment_pattern {
                uv_mapping image_map{
"F:\BlenDivers\Scenes\blenderpovrayTestScenes\TexturesTest\textures\AlphaTest.png"
map_type 0  interpolate 2 } translate <-0,-0,0> scale <1,1,1>}
                pigment_map {
                    [0 color rgbft<0,0,0,1,1>]
                    [1 uv_mapping image_map {
"F:\BlenDivers\Scenes\blenderpovrayTestScenes\TexturesTest\textures\DiffuseTest.png"
map_type 0  interpolate 2 } scale <1.333,1,1> translate <1.333,1,1>*<0,0,0>]
                }
            }
            finish {shader_MaterialTex0}
            normal {uv_mapping bump_map {
"F:\BlenDivers\Scenes\blenderpovrayTestScenes\TexturesTest\textures\BumpTest.png"
map_type 0  interpolate 2   bump_size 10 } translate <-0,-0,0> scale <1,1,1>}
        ]
        [1
            pigment {pigment_pattern {uv_mapping image_map{
"F:\BlenDivers\Scenes\blenderpovrayTestScenes\TexturesTest\textures\AlphaTest.png"
map_type 0  interpolate 2 }translate <-0,-0,0> scale <1,1,1>}
                pigment_map {
                    [0 color rgbft<0,0,0,1,1>]
                    [1 uv_mapping image_map {
"F:\BlenDivers\Scenes\blenderpovrayTestScenes\TexturesTest\textures\DiffuseTest.png"
map_type 0  interpolate 2 } scale <1.333,1,1> translate <1.333,1,1>*<0,0,0>]
                }
            }
            finish {shader_MaterialTex1}
            normal {uv_mapping bump_map {
"F:\BlenDivers\Scenes\blenderpovrayTestScenes\TexturesTest\textures\BumpTest.png"
map_type 0  interpolate 2   bump_size 10 } translate <-0,-0,0> scale <1,1,1>}
        ]
    }
}


 #declare MAT_MaterialBlack =
texture{
pigment {rgbft<0, 0, 0, 0, 0>}
finish {shader_MaterialBlack}
}


 #declare MAT_MaterialTex =
texture{
pigment_pattern {
    uv_mapping image_map{
"F:\BlenDivers\Scenes\blenderpovrayTestScenes\TexturesTest\textures\SpecularTest.png"
map_type 0  interpolate 2 }
    translate <-0,0,0> scale <1,1,1>

}
texture_map {
    [0
        pigment {
            pigment_pattern {
            uv_mapping image_map{
"F:\BlenDivers\Scenes\blenderpovrayTestScenes\TexturesTest\textures\AlphaTest.png"
map_type 0  interpolate 2 } translate <-0,-0,0> scale <1,1,1>}
            pigment_map {
                [0 color rgbft<0,0,0,1,1>]
                [1 uv_mapping image_map {
"F:\BlenDivers\Scenes\blenderpovrayTestScenes\TexturesTest\textures\DiffuseTest.png"
map_type 0  interpolate 2 } scale <1.333,1,1> translate <1.333,1,1>*<0,0,0>]
            }
        }
        finish {shader_MaterialTex0}
        normal {uv_mapping bump_map {
"F:\BlenDivers\Scenes\blenderpovrayTestScenes\TexturesTest\textures\BumpTest.png"
map_type 0  interpolate 2   bump_size 10 } translate <-0,-0,0> scale <1,1,1>}
    ]
    [1
        pigment {pigment_pattern {uv_mapping image_map{
"F:\BlenDivers\Scenes\blenderpovrayTestScenes\TexturesTest\textures\AlphaTest.png"
map_type 0  interpolate 2 }translate <-0,-0,0> scale <1,1,1>}
            pigment_map {
                [0 color rgbft<0,0,0,1,1>]
                [1 uv_mapping image_map {
"F:\BlenDivers\Scenes\blenderpovrayTestScenes\TexturesTest\textures\DiffuseTest.png"
map_type 0  interpolate 2 } scale <1.333,1,1> translate <1.333,1,1>*<0,0,0>]
            }
        }
        finish {shader_MaterialTex1}
        normal {uv_mapping bump_map {
"F:\BlenDivers\Scenes\blenderpovrayTestScenes\TexturesTest\textures\BumpTest.png"
map_type 0  interpolate 2   bump_size 10 } translate <-0,-0,0> scale <1,1,1>}
    ]
}
}
texture_list {
        2
 texture{MAT_MaterialBlack}

 texture{MAT_MaterialTex}
}
face_indices {
    12,
    <0,1,2>, 0,0,0,
    <0,2,3>, 0,0,0,
    <4,7,6>, 1,1,1,
    <4,6,5>, 1,1,1,
    <0,4,5>, 0,0,0,
    <0,5,1>, 0,0,0,
    <1,5,6>, 0,0,0,
    <1,6,2>, 0,0,0,
    <2,6,7>, 0,0,0,
    <2,7,3>, 0,0,0,
    <4,0,3>, 0,0,0,
    <4,3,7>, 0,0,0
}
normal_indices {
    12,
    <0,0,0>,
    <0,0,0>,
    <5,5,5>,
    <5,5,5>,
    <2,2,2>,
    <2,2,2>,
    <1,1,1>,
    <1,1,1>,
    <3,3,3>,
    <3,3,3>,
    <4,4,4>,
    <4,4,4>
}
uv_indices {
    12,
    <3,11,13>,
    <3,13,0>,
    <9,10,5>,
    <9,5,12>,
    <3,9,12>,
    <3,12,11>,
    <11,8,6>,
    <11,6,13>,
    <13,1,7>,
    <13,7,0>,
    <4,3,0>,
    <4,0,2>
}
interior {
    ior 1.000000
    caustics 0.5
}
radiosity {
    importance 0.5
}
}
//----Blender Object Name:OBCube----
object {
    DATACube
    matrix <-1.000000, -0.000000, -0.000000,  -0.000000, 0.000000, 1.000000,
0.000000, 1.000000, -0.000000,  0.000000, 0.000000, 0.000000>

}


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.