POV-Ray : Newsgroups : povray.advanced-users : Grid Interpolation? Server Time
28 Jul 2024 18:19:47 EDT (-0400)
  Grid Interpolation? (Message 10 to 19 of 19)  
<<< Previous 9 Messages Goto Initial 10 Messages
From: andrel
Subject: Re: Grid Interpolation?
Date: 17 Apr 2005 13:49:14
Message: <4262A110.5090308@hotmail.com>
Tim Nikias wrote:
>>Will you be starting from a square grid and start subdividing or will
>>you start from a hexagonal grid?
> 
> 
> Square-Grid. The triangulation uses the nearest-neighbour approach to decide
> how the quad is split into triangles. Why?
> 
Because it might be more realistic if you do all the computations in
a triangular grid to begin with. Otherwise you have artifacts that
come from the square grid _and_ from the triangulation afterwards.
That all depends also of course on the algorithm used.

Hmm, did I say hexagonal grid? I meant of course a triangular grid with
equilateral triangles or equivalently a regular one with six neighbours
each.


Post a reply to this message

From: David Wallace
Subject: Re: Grid Interpolation?
Date: 17 Apr 2005 22:11:15
Message: <42631743$1@news.povray.org>
Tim Nikias wrote:
> Hey, thanks for the link! Not only is the subdivision stuff interesting, but
> the other stuff as well! :-)
> 

My parametric surface generator uses uv-interpolated points.  Basically I 
interpolate the parameters and calculate the function at that point:

p(i,j) p(i+1,j)
  i(i+.5,j+.5)
p(i,j+1) p(i+1,j+1)

Now my "quads" are split into 4 triangles each, at the cost of (at most) 
doubling the number of points.  I think the effect is called face-centered square.

Mind you I now have to keep track of whether the u and/or v loops are closed or 
not.  A far edge of the interpolated grid goes away if its associated loop is open.

--------------
David Wallace
TenArbor Consulting
"Just In Time Cash"
www.tenarbor.com
1-866-572-CASH


Post a reply to this message

From: Tim Nikias
Subject: Re: Grid Interpolation?
Date: 18 Apr 2005 08:46:09
Message: <4263ac11@news.povray.org>
> Because it might be more realistic if you do all the computations in
> a triangular grid to begin with. Otherwise you have artifacts that
> come from the square grid _and_ from the triangulation afterwards.
> That all depends also of course on the algorithm used.

That's the trouble my latest attempts have run into. I always get artifacts
somewhere. It might work for a single subdivision step, but once I use it
twice or thrice, I get rectangular patterns. Sigh.

> Hmm, did I say hexagonal grid? I meant of course a triangular grid with
> equilateral triangles or equivalently a regular one with six neighbours
> each.

The source I start with is a 2d-grid of points, like the corners on a
checker field. Useful for various simulations, but, as I've found now, quite
difficult to handle for subdivision.

With the last few hours of failed attempts I've decided to let this idea
rest for a while, until I've got more time and patience (and concentration)
at hand. Due to university courses I've got so much other stuff to take care
of and think about, that I can't really focus on this.

Thanks for all the comments anyway, they'll be useful when I get back to
this macro. :-)

Regards,
Tim

-- 
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>


Post a reply to this message

From: Tim Nikias
Subject: Re: Grid Interpolation?
Date: 18 Apr 2005 08:49:26
Message: <4263acd6@news.povray.org>
> My parametric surface generator uses uv-interpolated points.  Basically I
> interpolate the parameters and calculate the function at that point:
>
> p(i,j) p(i+1,j)
>   i(i+.5,j+.5)
> p(i,j+1) p(i+1,j+1)
>
> Now my "quads" are split into 4 triangles each, at the cost of (at most)
> doubling the number of points.  I think the effect is called face-centered
square.

I've googled for this, but didn't find any site or pdf explaining this. Have
you got something on this topic which you could share with me? Additionally,
where can I find this surface generator of yours, is it a POV-Ray Macro, or
some external app?

Note though (also stated in a post to Andrel) that I'll leave the plans for
this subdivision macro of mine rest for a while, as I've got too much other
stuff to do and think about that I don't really have the time, patience and
concentration to script a proper subdivision macro. Still, anything I can
find and archive about this will sure come in handy when I get back to it.

Regards,
Tim
-- 
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>


Post a reply to this message

From: andrel
Subject: Re: Grid Interpolation?
Date: 18 Apr 2005 14:49:36
Message: <426400B6.3060606@hotmail.com>
Tim Nikias wrote:
>>Because it might be more realistic if you do all the computations in
>>a triangular grid to begin with. Otherwise you have artifacts that
>>come from the square grid _and_ from the triangulation afterwards.
>>That all depends also of course on the algorithm used.
> 
> 
> That's the trouble my latest attempts have run into. I always get artifacts
> somewhere. It might work for a single subdivision step, but once I use it
> twice or thrice, I get rectangular patterns. Sigh.

That was why I suggested triangiular grids. They have the additional
property that circular ripples are more close to hexagons (that you can
make with triangles (finally got the hexagons in in the right context
;) ).
> 
>>Hmm, did I say hexagonal grid? I meant of course a triangular grid with
>>equilateral triangles or equivalently a regular one with six neighbours
>>each.
> 
> 
> The source I start with is a 2d-grid of points, like the corners on a
> checker field. Useful for various simulations, but, as I've found now, quite
> difficult to handle for subdivision.
> 
> With the last few hours of failed attempts I've decided to let this idea
> rest for a while, until I've got more time and patience (and concentration)
> at hand. Due to university courses I've got so much other stuff to take care
> of and think about, that I can't really focus on this.
> 
> Thanks for all the comments anyway, they'll be useful when I get back to
> this macro. :-)

I assume you use a rectangular grid for ease of representation. To my
surprise it is not commonly known (or at least used) that when you
/pretend/ that in every alternating row the gridpoints are shifted one
half that you get conceptually a triangular grid. Gridpoints on every
odd line will be connected to the points to the left on the adhacent
rows and the even to the ones on the right. You can find out what the
real neaghbours are with a simple bit mask. If I make myself clear,
probably not :(


*   *   *   *
   *   *   *   *
*   *   *   *
   *   *   *   *
*   *   *   *

There is a small disadvantage that this grid is a bit anisotropic, so
you may have to account for that in the computation.


Post a reply to this message

From: Tim Nikias
Subject: Re: Grid Interpolation?
Date: 18 Apr 2005 16:19:08
Message: <4264163c@news.povray.org>
> I assume you use a rectangular grid for ease of representation. To my
> surprise it is not commonly known (or at least used) that when you
> /pretend/ that in every alternating row the gridpoints are shifted one
> half that you get conceptually a triangular grid. Gridpoints on every
> odd line will be connected to the points to the left on the adhacent
> rows and the even to the ones on the right. You can find out what the
> real neaghbours are with a simple bit mask. If I make myself clear,
> probably not :(

Oh, I understood fine. That's something to keep in mind in case I write
future macros that might need them. As it is now, my MMM and LSSM work on
the rectangle-grid. I've got no excuse for the MMM aside that it was just
easy to visualize and represent the data in an array, but for the LSSM, the
algorithm is deriven from a technique that normally works on textures and is
pixel-based, hence 2d-grid instead of hexagon.

I've got in mind to script a more versatile set of macros for
vertex/normal/UV generation on arbitrary topology (something close to the
usual mesh2-format, with arrays of vertices, normals and uvs, which are
index with a fourth array to build the actual mesh). But that'll have to
wait till I've got some spare time *and* a use for it. :-)

-- 
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>


Post a reply to this message

From: andrel
Subject: Re: Grid Interpolation?
Date: 18 Apr 2005 18:13:12
Message: <4264306E.7050002@hotmail.com>
Tim Nikias wrote:
>>I assume you use a rectangular grid for ease of representation. To my
>>surprise it is not commonly known (or at least used) that when you
>>/pretend/ that in every alternating row the gridpoints are shifted one
>>half that you get conceptually a triangular grid. Gridpoints on every
>>odd line will be connected to the points to the left on the adhacent
>>rows and the even to the ones on the right. You can find out what the
>>real neaghbours are with a simple bit mask. If I make myself clear,
>>probably not :(
> 
> 
> Oh, I understood fine. That's something to keep in mind in case I write
> future macros that might need them. As it is now, my MMM and LSSM work on
> the rectangle-grid. I've got no excuse for the MMM aside that it was just
> easy to visualize and represent the data in an array, but for the LSSM, the
> algorithm is deriven from a technique that normally works on textures and is
> pixel-based, hence 2d-grid instead of hexagon.
I know you understood it, but let me reiterate that you can even
reinterpret a rectangular grid of pixels as a grid of hexagons.
It is at first sight counterintuitive, but I sometimes use it
for erosions and dilations if I want the operations to be invariant
for foreground/background inversions.


Post a reply to this message

From: Leroy Whetstone
Subject: Re: Grid Interpolation?
Date: 1 Feb 2006 00:48:11
Message: <43E065C4.FA8C0820@joplin.com>
I may have something.
 I use natural_spline to interpolate a height field image of MARS. I wanted to
get a better view close up( like on the surface). It should work with any array
of points as long as the points a line on the grid. It's not a macro yet.
 How it works is:
An array is made so that it can hold all the points and all the interpolated
points in between. The original array of points are place and spread out(only
the heights are placed) to what every degree of division you want.
  A spline for a row is made with the placed points as contol points. Then the
interpolated points are calculated and placed. After all the rows with points in
them are done then all the columns can use the array to fill the
control points for another natural_spline.
 If you need something like this, give me awhile, I'll clean it up for you and
send it to ya.

--
Have Fun!


Post a reply to this message

From: Tim Nikias
Subject: Re: Grid Interpolation?
Date: 1 Feb 2006 03:00:02
Message: <43e06a82$1@news.povray.org>
>  I use natural_spline to interpolate a height field image of MARS. I
wanted to
> get a better view close up( like on the surface). It should work with any
array
> of points as long as the points a line on the grid. It's not a macro yet.

Hm, a natural_spline, you say? I might have a look at that, but after your
description of the process, I don't think you need to clean it up just for
me. I guess I could quickly script the macro myself with that approach, just
have to figure out how natural_splines work, and/or if I might want to use a
different one.

At the moment I'm working on different things and I haven't got much need
for the subdivision of my wave-meshes, still, thanks for the reply
nontheless!

Regards,
Tim

-- 
aka "Tim Nikias v2.0"
Homepage: <http://www.nolights.de>


Post a reply to this message

From: Leroy Whetstone
Subject: Re: Grid Interpolation?
Date: 4 Feb 2006 01:44:05
Message: <43E4675C.A733A676@joplin.com>
I went ahead and dress it up a bit then put it in the binaries_scene_files under
Mars_Mesh. Where it might be some use to you and others .



--
Have Fun!


Post a reply to this message

<<< Previous 9 Messages Goto Initial 10 Messages

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