POV-Ray : Newsgroups : povray.general : scaling problem using uv_mapping image_pattern Server Time
2 Nov 2024 09:17:22 EDT (-0400)
  scaling problem using uv_mapping image_pattern (Message 1 to 10 of 13)  
Goto Latest 10 Messages Next 3 Messages >>>
From: Eric Medlin
Subject: scaling problem using uv_mapping image_pattern
Date: 19 Mar 2004 15:16:57
Message: <eric.medlin-7A9A0A.15165719032004@news.povray.org>
I have the following texture attached to a model:
texture{
  normal{ uv_mapping image_pattern{ jpeg "mask.jpg" interpolate 2}
    normal_map{
      [0.5 bump_map{ jpeg "bump.jpg" interpolate 2} scale 0.02]
      [0.5 bozo scale 0.02 bump_size 0.5]
    }
  }
}

Now the normals maps are scaled to 0.02, if I change the uv_mapping
image_pattern... to just image_pattern the normals maps are no longer 
the same scale.  I have to change the normal maps scales to 0.2 to make 
it match the uv mapped image pattern.  How is uv_mapping effecting the 
scale?


Post a reply to this message

From: Eric Medlin
Subject: Re: scaling problem using uv_mapping image_pattern
Date: 22 Mar 2004 12:01:36
Message: <eric.medlin-2340FC.12013022032004@news.povray.org>
In article <eric.medlin-7A9A0A.15165719032004@news.povray.org>,
 Eric Medlin <eri### [at] ipapercom> wrote:

> I have the following texture attached to a model:
> texture{
>   normal{ uv_mapping image_pattern{ jpeg "mask.jpg" interpolate 2}
>     normal_map{
>       [0.5 bump_map{ jpeg "bump.jpg" interpolate 2} scale 0.02]
>       [0.5 bozo scale 0.02 bump_size 0.5]
>     }
>   }
> }
> 
> Now the normals maps are scaled to 0.02, if I change the uv_mapping
> image_pattern... to just image_pattern the normals maps are no longer 
> the same scale.  I have to change the normal maps scales to 0.2 to make 
> it match the uv mapped image pattern.  How is uv_mapping effecting the 
> scale?

OK, I think I figured out what it is doing.  You cannot apply uv_mapping 
to image_pattern, so it is applying it to the normals causing it to 
scale.  If this is correct, then how can I use a uv_mapped mask to 
decided where each normal map should be applied?


Post a reply to this message

From: Eric Medlin
Subject: Re: scaling problem using uv_mapping image_pattern
Date: 22 Mar 2004 15:54:15
Message: <eric.medlin-86B40A.15541422032004@news.povray.org>
In article <eric.medlin-2340FC.12013022032004@news.povray.org>,
 Eric Medlin <eri### [at] ipapercom> wrote:

> In article <eric.medlin-7A9A0A.15165719032004@news.povray.org>,
>  Eric Medlin <eri### [at] ipapercom> wrote:
> 
> > I have the following texture attached to a model:
> > texture{
> >   normal{ uv_mapping image_pattern{ jpeg "mask.jpg" interpolate 2}
> >     normal_map{
> >       [0.5 bump_map{ jpeg "bump.jpg" interpolate 2} scale 0.02]
> >       [0.5 bozo scale 0.02 bump_size 0.5]
> >     }
> >   }
> > }
> > 
> > Now the normals maps are scaled to 0.02, if I change the uv_mapping
> > image_pattern... to just image_pattern the normals maps are no longer 
> > the same scale.  I have to change the normal maps scales to 0.2 to make 
> > it match the uv mapped image pattern.  How is uv_mapping effecting the 
> > scale?
> 
> OK, I think I figured out what it is doing.  You cannot apply uv_mapping 
> to image_pattern, so it is applying it to the normals causing it to 
> scale.  If this is correct, then how can I use a uv_mapped mask to 
> decided where each normal map should be applied?

This just seems like a bug to me.  It is actually uv mapping the mask to 
the object, but it is scaling the normal maps also.  I changed it to a 
texture map as a test and it still does the uv mapping for the mask and 
scales the pattern.  Why would the pattern be a different scale if the 
image pattern is uv mapped or not?  The image pattern should just give a 
value for the map not scale whats in the map.  I plan to move this to 
povray.bugreports if I or someone else don't find figure this out.


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: scaling problem using uv_mapping image_pattern
Date: 23 Mar 2004 03:29:28
Message: <405ff568$1@news.povray.org>
In article <eric.medlin-7A9A0A.15165719032004@news.povray.org> , Eric Medlin
<eri### [at] ipapercom>  wrote:

> I have the following texture attached to a model:
> texture{
>   normal{ uv_mapping image_pattern{ jpeg "mask.jpg" interpolate 2}
>     normal_map{
>       [0.5 bump_map{ jpeg "bump.jpg" interpolate 2} scale 0.02]
>       [0.5 bozo scale 0.02 bump_size 0.5]
>     }
>   }
> }
>
> Now the normals maps are scaled to 0.02, if I change the uv_mapping
> image_pattern... to just image_pattern the normals maps are no longer
> the same scale.  I have to change the normal maps scales to 0.2 to make
> it match the uv mapped image pattern.  How is uv_mapping effecting the
> scale?

I think you are confused about what uv-mapping does and what not.  Please
read section "6.7.7 UV Mapping" of the manual.  As you do not provide a full
scene, nobody cannot help you better because the uv-mapping depends on the
object type as described in the manual.  The image-pattern is always one by
one (by one) unit in space, while your uv-vectors may very well be
different.  Without a small but complete scene or at least knowing the
object type, one cannot help you!

Another thing I don't really understand is why you are using a JPEG
image-pattern ... it does not make much sense to use a JPEG for this at all.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Eric Medlin
Subject: Re: scaling problem using uv_mapping image_pattern
Date: 23 Mar 2004 09:33:19
Message: <eric.medlin-8CEC8E.09331923032004@news.povray.org>
> I think you are confused about what uv-mapping does and what not.  Please
> read section "6.7.7 UV Mapping" of the manual.  As you do not provide a full
> scene, nobody cannot help you better because the uv-mapping depends on the
> object type as described in the manual.  The image-pattern is always one by
> one (by one) unit in space, while your uv-vectors may very well be
> different.  Without a small but complete scene or at least knowing the
> object type, one cannot help you!
> 
> Another thing I don't really understand is why you are using a JPEG
> image-pattern ... it does not make much sense to use a JPEG for this at all.
> 
>     Thorsten
> 
> ____________________________________________________
> Thorsten Froehlich, Duisburg, Germany
> e-mail: tho### [at] trfde
> 
> Visit POV-Ray on the web: http://mac.povray.org

My understanding is uv mapping allows you to map vertex coord. to points 
on a texture.  I have used them before in opengl, povray, and different 
modeling programs.  A full sample scene is provide below.  By removing 
the uv_mapping you will see the scale changes.  I don't think it should 
though because the patterns used for the normal maps are a function of 
the 3d space they are in and that does not change.  The only think that 
changes is the mapping for the image_pattern that tells which normal map 
to apply where.  You will need to make a simple mask.tga file for the 
image pattern.  I didn't have any reason to use a jpeg.  I just used it.  
Why is it a bad choice?  Compress artifacts?  Anyway here is a sample 
scene that shows my problem.

light_source {
   <5, 5, -5>, rgb <1, 1, 1>
}

global_settings {
   assumed_gamma 1.5
}

camera {
   perspective
   location <0, 0, -1>
   sky <0, 1, 0>
   direction <0, 0, 1>
   right <1.3333, 0, 0>
   up <0, 1, 0>
   look_at <0, 0, 0>
}

box {
   <-0.5, -0.5, -0.5>, <0.5, 0.5, 0.5>
   
   texture {
      normal {
         uv_mapping image_pattern{tga "mask.tga"}
         //image_pattern{tga "mask.tga"}   
         turbulence <0, 0, 0>
         
         normal_map {
            [ 0.5 bozo
            scale 0.02
            ]
            [ 0.5 quilted
            scale 0.02
            ]
         }
      }
      
      pigment {
         color rgb <1, 1, 1>
      }
   }
   scale 1
   rotate <0, 0, 0>
   translate <0, 0.5, 0.5>
}

box {
   <-0.5, -0.5, -0.5>, <0.5, 0.5, 0.5>
   
   texture {
      normal {
         bozo
         scale 0.02
      }
      
      pigment {
         color rgb <1, 1, 1>
      }
   }
   scale 1
   rotate <0, 0, 0>
   translate <0, -0.5, 0.5>
}


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: scaling problem using uv_mapping image_pattern
Date: 23 Mar 2004 10:38:26
Message: <406059f2@news.povray.org>
In article <eric.medlin-8CEC8E.09331923032004@news.povray.org> , Eric Medlin
<eri### [at] ipapercom>  wrote:

> My understanding is uv mapping allows you to map vertex coord. to points
> on a texture.  I have used them before in opengl, povray, and different
> modeling programs.  A full sample scene is provide below.  By removing
> the uv_mapping you will see the scale changes.  I don't think it should
> though because the patterns used for the normal maps are a function of
> the 3d space they are in and that does not change.

It does, and for a box it is explained in the manual using a nice image.
Taking a look at it <http://www.povray.org/documentation/images/boxmap.png>
clearly shows how a one by one unit is mapped onto the box, and if you
render your scene with a checker pattern and a 0.1 scale (see scene below),
you will notice that POV-Ray functions exactly as expected.

> I didn't have any reason to use a jpeg.  I just used it.
> Why is it a bad choice?  Compress artifacts?  Anyway here is a sample
> scene that shows my problem.

Yes, if you want a map with precise borders (it appears you want that
because you only have two different types of patterns), then artifacts at
those borders could get into your way.  I would use a grayscale PNG for
this.

    Thorsten



light_source
{
   <5, 5, -5>, rgb <1, 1, 1>
}

camera
{
   perspective
   location <1, 0, -1>
   sky <0, 1, 0>
   direction <0, 0, 1>
   right <1.3333, 0, 0>
   up <0, 1, 0>
   look_at <0, 0, 0>
}

box
{
   <-0.5, -0.5, -0.5>, <0.5, 0.5, 0.5>

   texture
   {
      normal
      {
         uv_mapping image_pattern{tga "mask.tga"}
         //image_pattern{tga "mask.tga"}

         normal_map { [ 0.5 checker ] }
         scale 0.1
     }

      pigment
      {
         color rgb <1, 1, 1>
      }
   }
   scale 1
   rotate <0, 0, 0>
   translate <0, 0.5, 0.5>
}

box
{
   <-0.5, -0.5, -0.5>, <0.5, 0.5, 0.5>

   texture
   {
      normal
      {
         checker
         scale 0.1
      }

      pigment
      {
         color rgb <1, 1, 1>
      }
   }
   scale 1
   rotate <0, 0, 0>
   translate <0, -0.5, 0.5>
}


Post a reply to this message

From: Eric Medlin
Subject: Re: scaling problem using uv_mapping image_pattern
Date: 23 Mar 2004 11:48:29
Message: <eric.medlin-E8CB45.11482823032004@news.povray.org>
In article <406059f2@news.povray.org>,
 "Thorsten Froehlich" <tho### [at] trfde> wrote:

> In article <eric.medlin-8CEC8E.09331923032004@news.povray.org> , Eric Medlin
> <eri### [at] ipapercom>  wrote:
> 
> > My understanding is uv mapping allows you to map vertex coord. to points
> > on a texture.  I have used them before in opengl, povray, and different
> > modeling programs.  A full sample scene is provide below.  By removing
> > the uv_mapping you will see the scale changes.  I don't think it should
> > though because the patterns used for the normal maps are a function of
> > the 3d space they are in and that does not change.
> 
> It does, and for a box it is explained in the manual using a nice image.
> Taking a look at it <http://www.povray.org/documentation/images/boxmap.png>
> clearly shows how a one by one unit is mapped onto the box, and if you
> render your scene with a checker pattern and a 0.1 scale (see scene below),
> you will notice that POV-Ray functions exactly as expected.

The manual and that image show how uv mapping for a box is done.  I 
understand that it should scale the image pattern.  Bu where does it say 
it will scale the normal map that uses that image pattern.  Your example 
seems to prove my point also.  Without uv mapping you get 10x10 squares 
on each side of the box.  That makes perfect since.  Unit box normal 
mapped with checker which is 1 unit scaled by 0.1 to give 10 squares on 
each side of the 1 unit box.  Now uv map the image pattern.  The image 
pattern will be scaled and wrapped around the box like the manual says 
and can be seen in the link you provided.  Now I would think that when a 
ray intersects the cube it would convert the intersection point on the 
cup to uv coords on the image pattern. Then get the value from the image 
pattern and look in the normal_map and find the correct normal to apply.  
It would then get that normal which in this case by sampling the checker 
pattern using the point of intersection on the box.  This point of 
intersection would not change if the image pattern is uv mapped or not.  
Also note if you don't uv map but change the map type to say sphere or 
torus this does not change the normals at all.


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: scaling problem using uv_mapping image_pattern
Date: 23 Mar 2004 12:00:44
Message: <40606d3c$1@news.povray.org>
In article <eric.medlin-E8CB45.11482823032004@news.povray.org> , Eric Medlin
<eri### [at] ipapercom>  wrote:

> The manual and that image show how uv mapping for a box is done.  I
> understand that it should scale the image pattern.  Bu where does it say
> it will scale the normal map that uses that image pattern.  Your example

UV-mapping is a modifier that applies to the normal statement, as explained
in the manual.  The fact that it is set directly in front of the
image-pattern implies nothing.  It still applies to the normal statement,
not the image-pattern statement!  This is exactly like all modifiers in
POV-Ray work.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Eric Medlin
Subject: Re: scaling problem using uv_mapping image_pattern
Date: 23 Mar 2004 12:28:32
Message: <eric.medlin-37D475.12283223032004@news.povray.org>
In article <40606d3c$1@news.povray.org>,
 "Thorsten Froehlich" <tho### [at] trfde> wrote:

> In article <eric.medlin-E8CB45.11482823032004@news.povray.org> , Eric Medlin
> <eri### [at] ipapercom>  wrote:
> 
> > The manual and that image show how uv mapping for a box is done.  I
> > understand that it should scale the image pattern.  Bu where does it say
> > it will scale the normal map that uses that image pattern.  Your example
> 
> UV-mapping is a modifier that applies to the normal statement, as explained
> in the manual.  The fact that it is set directly in front of the
> image-pattern implies nothing.  It still applies to the normal statement,
> not the image-pattern statement!  This is exactly like all modifiers in
> POV-Ray work.

I also thought it was applying it to the normal statement only, but it 
is applying it to the image pattern statement also.  In my example I 
used two normals statments one for below 0.5 and one for above 0.5.  
When uv mapping is applied you can clearly see that the image pattern is 
being uv mapped.  It is probly applying it to the normals to though 
causing the scaling.  Either way I don't see where it says it will apply 
it to both.


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: scaling problem using uv_mapping image_pattern
Date: 23 Mar 2004 12:52:35
Message: <40607963$1@news.povray.org>
In article <eric.medlin-37D475.12283223032004@news.povray.org> , Eric Medlin
<eri### [at] ipapercom>  wrote:

>> UV-mapping is a modifier that applies to the normal statement, as explained
>> in the manual.  The fact that it is set directly in front of the
>> image-pattern implies nothing.  It still applies to the normal statement,
>> not the image-pattern statement!  This is exactly like all modifiers in
>> POV-Ray work.
>
> I also thought it was applying it to the normal statement only, but it
> is applying it to the image pattern statement also.  In my example I
> used two normals statments one for below 0.5 and one for above 0.5.
> When uv mapping is applied you can clearly see that the image pattern is
> being uv mapped.  It is probly applying it to the normals to though
> causing the scaling.  Either way I don't see where it says it will apply
> it to both.

You are not understanding at all what an image-pattern does!  It does only
define a pattern of the image in the unit cube.  The pattern (the checker
pattern makes this easy to see) together with the normal map is part of the
the surface normal function, and that is then mapped onto the surface (this
is what the uv-mapping modifier specifies) using uv-mapping, which is a
2d-function, rather than specifying 3d-function.  This is exactly like it
works for every pattern and every other statement using patterns in POV-Ray.
In fact, it would not make any sense to just pick arbitrary parts of the
normal statement and use only them for uv-mapping.

Just imagine what would happen if what you seem to be expecting was the case
when using pigments.  The image-map would be uv-mapped and a pigment-map
would not? - This could never work in a predictable manner at all!

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

Goto Latest 10 Messages Next 3 Messages >>>

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