POV-Ray : Newsgroups : povray.advanced-users : arbitrary remapping Server Time
1 Nov 2024 03:14:40 EDT (-0400)
  arbitrary remapping (Message 1 to 5 of 5)  
From: Anton Sherwood
Subject: arbitrary remapping
Date: 29 Sep 2003 23:14:04
Message: <3f78f4fc@news.povray.org>
I want to remap a texture (say something from stones.inc) so that what 
you see is not a function of <x,y,z> but rather of <f(x,y,z), g(x,y,z), 
h(x,y,z)>, i.e. some substitute for the actual coordinates which is 
still a (nonlinear) function of those coordinates.  How hard is that to do?

If this is unclear, I'll try to rephrase.

(What I have in mind is to illustrate the various point symmetry groups 
with seamless pigments that show the relevant symmetries.)

-- 
Anton Sherwood, http://www.ogre.nu/


Post a reply to this message

From: Mike Williams
Subject: Re: arbitrary remapping
Date: 30 Sep 2003 01:45:47
Message: <cnN7HBAzgRe$EwlL@econym.demon.co.uk>
Wasn't it Anton Sherwood who wrote:
>I want to remap a texture (say something from stones.inc) so that what 
>you see is not a function of <x,y,z> but rather of <f(x,y,z), g(x,y,z), 
>h(x,y,z)>, i.e. some substitute for the actual coordinates which is 
>still a (nonlinear) function of those coordinates.  How hard is that to do?

Here's some code that remaps a single-layer pigment in this way. If you
really want to remap complex stone textures, then you'd have to do the
same to each of the pigment layers.

The basic trick is to make a function from the pigment, and then make a
pigment from that function. When you make a pigment from the function
you can specify an arbitrary remapping.

The sphere on the left has the original stone pigment.

The sphere on the right has the arbitrarily remapped pigment.

The lower sphere has a remapped pigment, using the identity mapping. if
the procedure works correctly, then this should look identical to the
original sphere.

>If this is unclear, I'll try to rephrase.
>
>(What I have in mind is to illustrate the various point symmetry groups 
>with seamless pigments that show the relevant symmetries.)

Now you've lost me.


global_settings {
 assumed_gamma 1.0
}

camera { orthographic location  <0,-0.8,-4> look_at <0, -0.8, 0>}

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

// Declare the original pigment

#declare C =   color_map
    { [0.0, 0.3 color rgb 1 color rgb 0.4]
      [0.3, 0.4 color rgb 0.4 color rgb 0.6]
      [0.4, 0.6 color rgb 0.6 color rgb 0.3]
      [0.6, 1.0 color rgb 0.3 color rgb 0.6]
    }
#declare P = pigment {granite turbulence 0.5 color_map {C}}
#declare Fin = finish {phong 0.5 phong_size 6}

// Make a pigment function from its structure (but skip the colour map)
                    
#declare PF=function{pigment{granite turbulence 0.5}}

// Three non-linear functions

#declare f = function{x*x + y}
#declare g = function{sin(3*y)}
#declare h = function{z*3 + cos(x)}

// A sphere with the original pigment

sphere {<-1,0,0> 1 pigment {P} finish{Fin}}

// A sphere with the transformed pigment (put the colour map back in)
                    
sphere {<1,0,0>,1
  pigment { function { PF(f(x,y,z),g(x,y,z),h(x,y,z)).grey }
    color_map {C}
  }
  finish{Fin}
}

// a sphere using the same technique, but with the identity
transformation
// to check that this procedure really does 

sphere {<-1,0,0>,1
  pigment { function { PF(x,y,z).grey }
    color_map {C}
  }
  finish{Fin}
  translate <1,-1.7,0>
}


Post a reply to this message

From: Anton Sherwood
Subject: Re: arbitrary remapping
Date: 1 Oct 2003 03:37:09
Message: <3f7a8425@news.povray.org>
> Wasn't it Anton Sherwood who wrote:
 >> (What I have in mind is to illustrate the various point symmetry
 >> groups with seamless pigments that show the relevant symmetries.)

Mike Williams wrote:
 > Now you've lost me.

May I always be so fortunate, that the most obscure parts of my writing 
are in the footnotes.  ;)

Consider the Mercator projection: the surface of a sphere is mapped to 
that of an endless cylinder.  I've heard that someone once made a globe 
on which the reverse Mercator projection was applied twice, i.e. two 
copies of a six-inch cylinder (say) were used to form a twelve-inch 
cylinder, and the projection applied in reverse to a globe, with the 
result that an orthographic eye in the plane of the equator would see a 
map of the entire world.  The oddity was said to be hard to spot - 
partly because the mapping is conformal (shapes are locally preserved) 
and partly because the doubling is seamless (except for a singularity at 
the poles).

Well, given a `globe' pigment, this multiplication effect is 
accomplished with the following functions (if my algebra is good):

	Xnew = Re[(x+i*y)^n] / ((1+z)^n + (1-z)^n)
	Ynew = Im[(x+i*y)^n] / ((1+z)^n + (1-z)^n)
	Znew = ((1+z)^n - (1-z)^n) / ((1+z)^n + (1-z)^n)

(n=2 for the above example.)  The pigment of the resulting globe has the 
symmetry group C[n].  Other symmetry groups can arise from other sorts 
of functions.  Simple examples, not conformal:

	Xnew = Re[(x+i*y)^n]
	Ynew = Im[(x+i*y)^n]
	Znew = z^2

This gives C[n]h, i.e. the same nfold symmetry as above plus a 
reflection plane perpendicular to the axis.

	Xnew = Re[(x+i*y)^n]
	Y1  =  Im[(x+i*y)^n]
	Ynew = Y1^2 - z^2
	Znew = z*Y1

This gives D[n], the rotation group of an n-gonal prism.

...Thanks for the code!  I'll play with it when I'm more awake.

-- 
Anton Sherwood, http://www.ogre.nu/


Post a reply to this message

From: Anton Sherwood
Subject: Re: arbitrary remapping
Date: 3 Oct 2003 16:13:11
Message: <3f7dd857@news.povray.org>
Mike Williams wrote:
 > . . . . If you really want to remap complex stone textures,
 > then you'd have to do the same to each of the pigment layers.

I might instead redesign them as texture-maps.  ?

-- 
Anton Sherwood, http://www.ogre.nu/


Post a reply to this message

From: Mike Williams
Subject: Re: arbitrary remapping
Date: 4 Oct 2003 01:05:34
Message: <eimr2HAYjkf$Ewcc@econym.demon.co.uk>
Wasn't it Anton Sherwood who wrote:
>Mike Williams wrote:
> > . . . . If you really want to remap complex stone textures,
> > then you'd have to do the same to each of the pigment layers.
>
>I might instead redesign them as texture-maps.  ?

If you only remapped the texture-map then the overall shape of the
texture would move, but wouldn't fine detail from the individual
pigments stay in the same place. I'd guess it would be like moving the
coastlines around on a globe but having the cities (any that were still
above water) remain in the same locations.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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