POV-Ray : Newsgroups : povray.general : A normal question Server Time
11 Aug 2024 13:15:40 EDT (-0400)
  A normal question (Message 1 to 5 of 5)  
From: Rune S  Johansen
Subject: A normal question
Date: 1 Aug 1999 11:15:50
Message: <37a464a6@news.povray.org>
I have a problem when I make a texture (say Texture1) with a normal and use
it in a texture_map.

I scale the Texture1 hundred times smaller inside a texture_map entry of
another texture (say Texture2). I then scale Texture2 hundred times bigger.

Now I thought the normal would look the same in Texture1 and Texture2 but it
doesn't.

Why is that?

What can I make to make them look the same?

I need to scale Texture2 bigger without the entries in the pattern are
affected.

// Here's an example of the problem:

camera {
   location 3*x
   look_at 0
}

light_source {100*<1,2,-1>, color 1}

#declare Texture1 =
texture {
   pigment {bozo  scale 0.5}
   normal {bozo 2 scale 0.5}
   finish {ambient 0.2 diffuse 0.8}
}

#declare Texture2 =
texture {
   gradient x
   scale 100
   texture_map {
      [0.5 Texture1 scale 1/100]
      [0.5 Texture1 scale 1/100]
   }
}

sphere {
   0, 1
   texture {Texture1} // Change to Texture2 and see the difference!
}


Post a reply to this message

From: Nathan Kopp
Subject: Re: A normal question
Date: 1 Aug 1999 15:19:58
Message: <37A49DA5.CE0B5F47@Kopp.com>
"Rune S. Johansen" wrote:
> 
> I have a problem when I make a texture (say Texture1) with a normal and use
> it in a texture_map.
> 
> I scale the Texture1 hundred times smaller inside a texture_map entry of
> another texture (say Texture2). I then scale Texture2 hundred times bigger.
> 
> Now I thought the normal would look the same in Texture1 and Texture2 but it
> doesn't.
> 

My first suggestion is to use a 'bumps' instead of 'bozo' for your normal.
Using 'bozo' means you are using a slope_map (albiet a default slope_map)
with a pattern that wasn't intended for use with normals, while
'bumps' was specifically designed for normals.  Using bumps will fix
the problem.

The second suggestion is to use the reset_children warp that is included in
both UVPov and the Superpatch.  Instead of scaling the children (entries in
the texture_map) by 1/100, just don't let POV apply the parent's scale
transformation to the children:

#declare Texture2 =
texture {
   gradient x
   texture_map {
      [0.5 Texture1 /*scale 1/100*/]  // commented out the scale factor
      [0.5 Texture1 /*scale 1/100*/]
   }
   scale 100
   warp{reset_children} // this undoes the scale 100 for the child textures
}

-Nathan


Post a reply to this message

From: Rune S  Johansen
Subject: Re: A normal question
Date: 1 Aug 1999 16:09:20
Message: <37a4a970@news.povray.org>
Nathan Kopp wrote:
>"Rune S. Johansen" wrote:
>>
>> I have a problem when I make a texture (say Texture1) with a normal and
use
>> it in a texture_map.
>>
>> I scale the Texture1 hundred times smaller inside a texture_map entry of
>> another texture (say Texture2). I then scale Texture2 hundred times
bigger.
>>
>> Now I thought the normal would look the same in Texture1 and Texture2 but
it
>> doesn't.
>
>My first suggestion is to use a 'bumps' instead of 'bozo' for your normal.
>Using 'bozo' means you are using a slope_map (albiet a default slope_map)
>with a pattern that wasn't intended for use with normals, while
>'bumps' was specifically designed for normals.  Using bumps will fix
>the problem.

That works for the example but unfortunately in my actual scene I need to
use a gradient pattern and I also need to use sine_wave.

>The second suggestion is to use the reset_children warp that is included in
>both UVPov and the Superpatch.  Instead of scaling the children (entries in
>the texture_map) by 1/100, just don't let POV apply the parent's scale
>transformation to the children:
>
>#declare Texture2 =
>texture {
>   gradient x
>   texture_map {
>      [0.5 Texture1 /*scale 1/100*/]  // commented out the scale factor
>      [0.5 Texture1 /*scale 1/100*/]
>   }
>   scale 100
>   warp{reset_children} // this undoes the scale 100 for the child textures
>}
>
>-Nathan

I wasn't aware of that feature. It sounds very convenient.

However, what I'm working on is for an include file for use in multiple
scenes so I have to stick to official POV.

Thanks for the suggestions anyway.

The texture is only scaled small and then big again, so why does the normal
look different (same size but "deeper" bumps)?


Post a reply to this message

From: Nathan Kopp
Subject: Re: A normal question
Date: 1 Aug 1999 16:25:41
Message: <37A4AD0B.69F11D2F@Kopp.com>
"Rune S. Johansen" wrote:
> 
> The texture is only scaled small and then big again, so why does the normal
> look different (same size but "deeper" bumps)?

It's a bug relating to slope_maps.  See my post "Patterned slope_map bug
(and Ghost of POV)" in povray.bugreports for more information.  In that
article I only mentioned the problem (and fix) as it related to normal_map
patterns, but it appears that texture_map patterns have the same problem.

To summarize, the problem is this:  When dealing with a slope map, POV must
sample a few points (it uses 4) around the intersection point and
interpolate between the results to get the normal at a point.  But which
points to use?  Unfortunately, it chooses the points after the warps
(transformations) of the parent pattern have been applied but before the
warps of the child pattern.  Therefore, the sample points are not the same:

find intersection point
scale intersection point by 100
choose 4 points evenly spaced around the intersection point
scale these 4 points by 1/100
now the distances between the points are 1/100 what they used to be

The solution is to choose the 4 points before anything else is done.  But the
problem is that you only want to apply transformations to these 4 extra points
throughout the process if they will be needed (i.e. if the texture has a
slope_map).  Otherwise, you do extra work and slow down the process for no
reason.

-Nathan


Post a reply to this message

From: Rune S  Johansen
Subject: Re: A normal question
Date: 1 Aug 1999 17:08:32
Message: <37a4b750@news.povray.org>
Nathan Kopp wrote:
>"Rune S. Johansen" wrote:
>>
>> The texture is only scaled small and then big again, so why does the
normal
>> look different (same size but "deeper" bumps)?
>
>It's a bug relating to slope_maps.  See my post "Patterned slope_map bug
>(and Ghost of POV)" in povray.bugreports for more information.  In that
>article I only mentioned the problem (and fix) as it related to normal_map
>patterns, but it appears that texture_map patterns have the same problem.

Oh, so it WAS a bug. I thought so.
I hope it'll be fixed.

Thank you for the explanation.

Greetings,

Rune S. Johansen

---
Visit The RSJ Website at http://welcome.to/rsj
for 3D images including still lives, dragons,
mathematical shapes, and more. Stereograms,
tutorials, The POV Desktop Theme, all the jokes
"you know you have been raytracing too long when",
miscellaneous other things, and a lot of fun!


Post a reply to this message

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