POV-Ray : Newsgroups : povray.general : normals and textures using texture_map Server Time
1 Aug 2024 18:21:43 EDT (-0400)
  normals and textures using texture_map (Message 1 to 6 of 6)  
From: Ross
Subject: normals and textures using texture_map
Date: 1 Jul 2005 17:54:37
Message: <42c5bb9d@news.povray.org>
I have a normal "myNormal", created from a pigment function "fnPig" that I
want to apply to a texture "t3", but i want to apply the normal after I'm
done doing the warp & scale loop. "t3" is a texture created with a
"texture_map" of two textures "t1" and "t2".

Is it possible to apply a normal on "t3" (see comment in "t3") without
specifying a normal on "t1" and "t2"? If so, how?

thanks,
ross

// Begin Pov SDL

#declare t1 = texture {pigment {rgb 1} finish { specular 1 roughness 0.003
diffuse 0.3 reflection {0.2, 0.4 fresnel on} } }
#declare t2 = texture {pigment {rgb 0.2} finish { specular 0.6 roughness
0.03 diffuse 0.3 } }

#declare nPig =
pigment {
 leopard scale 0.15
 color_map {
  [0.0 rgb 1]
  [1.0 rgb 0]
 }
 #declare step = 8;
 #declare turb = <0.34, 0.3, 0.7>;
 #while (step > 0)
  warp {repeat x flip y}
  warp {turbulence turb }
  scale 1.2
  #declare step = step - 1;
 #end
}

#declare fnPig = function {pigment {nPig}}
#declare myNormal = normal {function {fnPig(x, y, z).gray}}

#declare t3 =
 texture {
  leopard scale 0.15
  texture_map {
   [0.0 t1]
   [1.0 t2]
  }
  #declare w1 = 8;
  #declare t1 = <0.34, 0.3, 0.7>;
  #while (w1 > 0)
   warp {repeat x flip y}
   warp {turbulence t1 }
   scale 1.2
   #declare w1 = w1 - 1;
  #end
  // want to apply normal here, but it doesn't work
 }

/**** test scene ****/
camera {
  right x*image_width/image_height
  location  <0, 6, -10>
  look_at   <0,5,0>
}
sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}
light_source {
  <200,400,-350>
  color rgb 1
}
sphere {
 <0, 2, 2>, 2
 texture {t3}
 interior {
   ior 1.455
 }
}
plane {
  y, 0
  texture { pigment {rgb <0.65, 1, 0.36>} }
}


Post a reply to this message

From: PM 2Ring
Subject: Re: normals and textures using texture_map
Date: 2 Jul 2005 10:45:01
Message: <web.42c6a70ef229687477de37d40@news.povray.org>
"Ross" <rli### [at] everestkcnet> wrote:
> I have a normal "myNormal", created from a pigment function "fnPig" that I
> want to apply to a texture "t3", but i want to apply the normal after I'm
> done doing the warp & scale loop. "t3" is a texture created with a
> "texture_map" of two textures "t1" and "t2".
>
> Is it possible to apply a normal on "t3" (see comment in "t3") without
> specifying a normal on "t1" and "t2"? If so, how?

No, but I think the following does what you want.

// Persistence of Vision Ray Tracer Scene Description File
//  From: Ross
//  Subject: normals and textures using texture_map
//  Date: 1 Jul 2005 21:54:37
//  Message: <42c5bb9d@news.povray.org>
//  Modified by PM 2Ring
//
//  -D +A0.1 +AM2 +R3
//  -F -A0.5 +AM2 +R1
//

global_settings { assumed_gamma 1.0 }

#declare Step = 8;
#declare Turb = <0.34, 0.3, 0.7>;

#declare Pig =
pigment {
 leopard scale 0.15
 //color_map {[0.0 rgb 1][1.0 rgb 0]} //Redundant: this is the default
 #declare I = Step;
 #while (I > 0)
  warp {repeat x flip y}
  warp {turbulence Turb}
  scale 1.2
  #declare I = I - 1;
 #end
}

#declare fnPig = function {pigment {Pig}}
#declare myNormal = normal {function {fnPig(x, y, z).x}}

#declare Dull =  finish { specular 1 roughness 0.003 diffuse 0.3 reflection
{0.2, 0.4 fresnel on} }
#declare Shiny = finish { specular 0.6 roughness 0.03 diffuse 0.3 }

#declare t1 = texture {pigment {rgb 1} finish { Dull } normal {myNormal} }
#declare t2 = texture {pigment {rgb 0.2} finish { Shiny } normal {myNormal}
}

#declare t3 =
 texture {
  function {fnPig(x, y, z).x}
  texture_map {
   [0.0 t1]
   [1.0 t2]
  }
}

/**** test scene ****/
camera {
  right x*image_width/image_height

  //location  <0, 6, -10>
  //look_at   <0,5,0>

  location  <0, 3, -12>
  look_at   <0,2,0>
  angle 30
}

light_source {
  <200,400,-350>
  rgb 1
}

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}

plane {
  y, 0
  texture { pigment {rgb <0.65, 1, 0.36>} }
}

//The ball
sphere {
 <0, 2, 2>, 2
 texture {t3}
 interior { ior 1.455 }   //So Fresnel works
}

//Some objects to reflect in the ball
#macro Post(A,C) cylinder{A, A+4*y, 0.5 pigment{C}
  finish{specular .5 roughness 0.03}}
#end

Post(-2.4*x, red 1)
Post(2.4*x, blue 1)

//------------------------------------------------------------

I hope this helps.


Post a reply to this message

From: Ross
Subject: Re: normals and textures using texture_map
Date: 3 Jul 2005 01:49:56
Message: <pan.2005.07.03.05.49.55.750463@speakeasy.net>
On Sat, 02 Jul 2005 10:40:04 -0400, PM 2Ring wrote:

> "Ross" <rli### [at] everestkcnet> wrote:
>> I have a normal "myNormal", created from a pigment function "fnPig" that I
>> want to apply to a texture "t3", but i want to apply the normal after I'm
>> done doing the warp & scale loop. "t3" is a texture created with a
>> "texture_map" of two textures "t1" and "t2".
>>
>> Is it possible to apply a normal on "t3" (see comment in "t3") without
>> specifying a normal on "t1" and "t2"? If so, how?
> 
> No, but I think the following does what you want.
> 

:snip:

> I hope this helps.

Yes, that looks good I think. Thanks for the technique. Looks really goopy
and bumpy :) 

Thanks,
ross


Post a reply to this message

From: PM 2Ring
Subject: Re: normals and textures using texture_map
Date: 3 Jul 2005 20:10:01
Message: <web.42c87d7ef2296874ad93754b0@news.povray.org>
Ross <rli### [at] speakeasynet> wrote:

> >> Is it possible to apply a normal on "t3" (see comment in "t3") without
> >> specifying a normal on "t1" and "t2"? If so, how?
> >
> > No, but I think the following does what you want.
> >
>
> :snip:
>
> > I hope this helps.
>
> Yes, that looks good I think. Thanks for the technique. Looks really goopy
> and bumpy :)
>
> Thanks,
> ross

My pleasure! Yes, it does look good. I'm going to try an isosurface version.

Thanks for showing me that trick of multiple repeat warps, I'll have to
investigate this further.

Here's my first scene using repeat & black hole warps. You may need to
adjust the gamma; I messed up the conversion from .png to .jpg.

<web.42bd012124f9fc099b7567e60@news.povray.org>


Post a reply to this message

From: PM 2Ring
Subject: Re: normals and textures using texture_map
Date: 6 Jul 2005 07:45:00
Message: <web.42cbc31df229687430757dd90@news.povray.org>
Here's the isosurface version. As expected, it renders much slower than the
normals version. If you make the accuracy much smaller than 0.0075, you
will have to push the max_gradient right up and render speeds become
glacial, especially with high AA settings.

// Persistence of Vision Ray Tracer Scene Description File
//
//  From: Ross
//  Subject: normals and textures using texture_map
//  Date: 1 Jul 2005 21:54:37
//  Message: <42c5bb9d@news.povray.org>
//
//    I have a normal "myNormal", created from a pigment function "fnPig"
that I
//  want to apply to a texture "t3", but i want to apply the normal after
I'm
//  done doing the warp & scale loop. "t3" is a texture created with a
//  "texture_map" of two textures "t1" and "t2".
//
//  Is it possible to apply a normal on "t3" (see comment in "t3") without
//  specifying a normal on "t1" and "t2"? If so, how?
//
//  thanks,
//  ross
//
//  Modified by PM 2Ring
//  Isosurface version 2005.07.04
//
//  -D +A0.1 +AM2 +R2
//  -F -A0.5 +AM2 +R1
//

#include "functions.inc"

global_settings {
  assumed_gamma 1.0
  max_trace_level 7
}

#declare Step = 8;
#declare Turb = <0.34, 0.3, 0.7>;

#declare Pig =
pigment {
  leopard scale 0.15
  #declare I = Step;
  #while (I > 0)
    warp {repeat x flip y}
    warp {turbulence Turb}
    scale 1.2
    #declare I = I - 1;
  #end
}

#declare fnPig = function {pigment {Pig}}

#declare Dull =  finish { specular 1 roughness 0.003 diffuse 0.3 reflection
{0.2, 0.4 fresnel on} }
#declare Shiny = finish { specular 0.6 roughness 0.03 diffuse 0.3 }

#declare t1 = texture {pigment {rgb 1} finish { Dull } }
#declare t2 = texture {pigment {rgb 0.2} finish { Shiny } }

#declare t3 =
 texture {
  function {fnPig(x, y, z).x}
  texture_map {
   [0.0 t1]
   [1.0 t2]
  }
}

/**** test scene ****/
camera {
  right x*image_width/image_height

  //location  <0, 6, -10>
  //look_at   <0,5,0>

  location  <0, 3, -12>
  look_at   <0,2,0>
  angle 30
}

light_source {
  <200,400,-350>
  rgb 1
}

sky_sphere {
  pigment {
    gradient y  scale .7
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}

plane {
  y, 0
  texture { pigment {rgb <0.65, 1, 0.36>} }
}

#declare IsoDepth = 0.035;
isosurface{
  function {f_sphere(x,y-2,z-2, 2 + IsoDepth*(fnPig(x,y,z).x-1))}
  contained_by{sphere {<0, 2, 2>, 2}}
  accuracy 0.0075
  max_gradient 9.9

  texture {t3}
  interior { ior 1.455 }   //So Fresnel works
}

//Some objects to reflect in the ball
#macro Post(A,C)cylinder{A, A+4*y, 0.5 pigment{C}finish{specular .75
roughness 0.01}} #end

Post(-2.4*x, red 1)
Post(2.4*x, blue 1)

//------------------------------------------------------------

See "Isosurface from Warped Pigment" in p.b.i for a 1024x768 .jpg


Post a reply to this message

From: Ross
Subject: Re: normals and textures using texture_map
Date: 7 Jul 2005 11:13:16
Message: <42cd468c$1@news.povray.org>
"PM 2Ring" <nomail@nomail> wrote in message
news:web.42cbc31df229687430757dd90@news.povray.org...
> Here's the isosurface version. As expected, it renders much slower than
the
> normals version. If you make the accuracy much smaller than 0.0075, you
> will have to push the max_gradient right up and render speeds become
> glacial, especially with high AA settings.

> #declare IsoDepth = 0.035;
> isosurface{
>   function {f_sphere(x,y-2,z-2, 2 + IsoDepth*(fnPig(x,y,z).x-1))}
>   contained_by{sphere {<0, 2, 2>, 2}}
>   accuracy 0.0075
>   max_gradient 9.9
>
>   texture {t3}
>   interior { ior 1.455 }   //So Fresnel works
> }
>

thanks, I'll play with it some. there are some small differences between
what I had tried and what you have posted. i need to figure out why they are
important. (my tries had me cranking max_gradient up to > 50)

-r


Post a reply to this message

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