POV-Ray : Newsgroups : povray.general : Mesh polygon reduction? Server Time
7 Aug 2024 15:18:47 EDT (-0400)
  Mesh polygon reduction? (Message 1 to 9 of 9)  
From: jarbee
Subject: Mesh polygon reduction?
Date: 25 Sep 2001 21:12:29
Message: <3bb12b7d@news.povray.org>
Has anyone thought or heard of using a self-organizing map algorithm to
reduce the number of polygons in a mesh?
Although it may not give results as good as other algorithms, I'm thinking
some interesting effects, could be accomplished, like combining >1 meshes,
using "control points" to influence shape, and creating
draped-cloth-over-object type effects.
Meshes could also be interpolated from point density data using (almost) the
same algorithm.

Any thoughts?

Dave.


Post a reply to this message

From: Jérôme Grimbert
Subject: Re: Mesh polygon reduction?
Date: 26 Sep 2001 03:44:19
Message: <3BB18755.31FE7049@atosorigin.com>
jarbee wrote:
> 
> Has anyone thought or heard of using a self-organizing map algorithm to
> reduce the number of polygons in a mesh?

Yes. :-)







If you have true polygon (and not only triangle like in pov), an obvious
reduction is to merge polygons which share a common border AND whose normal
at each of the border's vertex are identical in both polygons.
(Beware of polygons which share more than two vertex.)

If you only have triangles, you can try to remove vertex whose normals in all
contributed triangle is always the same and identical to the computed normal
of the triangles. 

Please notice that the use of UV mapping is a dangerous issue when performing
these operations.


> Although it may not give results as good as other algorithms, I'm thinking
> some interesting effects, could be accomplished, like combining >1 meshes,
> using "control points" to influence shape, and creating
> draped-cloth-over-object type effects.

I do not understand how you do that from the reduction of polygons in a mesh.
Moreover, we already have something called clothray...

> Meshes could also be interpolated from point density data using (almost) the
> same algorithm.

Please explain, I really have no clue what you are writing about.


Post a reply to this message

From: jarbee
Subject: Re: Mesh polygon reduction?
Date: 1 Oct 2001 23:14:25
Message: <3bb93111@news.povray.org>

news:3BB18755.31FE7049@atosorigin.com...
> jarbee wrote:
> >
>
>
> > Although it may not give results as good as other algorithms, I'm
thinking
> > some interesting effects, could be accomplished, like combining >1
meshes,
> > using "control points" to influence shape, and creating
> > draped-cloth-over-object type effects.
>
> I do not understand how you do that from the reduction of polygons in a
mesh.
> Moreover, we already have something called clothray...
>
> > Meshes could also be interpolated from point density data using (almost)
the
> > same algorithm.
>
> Please explain, I really have no clue what you are writing about.

Well, OK - I'm writing about doing a hundred things with th one program. Say
you had a 3d mesh made of 1000 polygons. Couldn't you use either the vertex
points, or the point at the centre of each polygon as input to a SOM,
'mapping' each polygon to, say, all triangles of a certain size and, say,
500 polygons? Obviously the result would be an estimate of the original
mesh, rather than a reduction as you outlined.


Post a reply to this message

From: Jérôme Grimbert
Subject: Re: Mesh polygon reduction?
Date: 2 Oct 2001 03:51:29
Message: <3BB97204.8225FB8F@atosorigin.com>
jarbee wrote:
> 

> news:3BB18755.31FE7049@atosorigin.com...
> > jarbee wrote:
> > >
> > > Meshes could also be interpolated from point density data using (almost)
> the
> > > same algorithm.
> >
> > Please explain, I really have no clue what you are writing about.
> 
> Well, OK - I'm writing about doing a hundred things with th one program. Say
> you had a 3d mesh made of 1000 polygons. 

That's not a lot (1000)...

> Couldn't you use either the vertex
> points, or the point at the centre of each polygon as input to a SOM,

Please avoid using abbreviation when explaining things to poor brain like
mine. I do not know what SOM is. Surface Of M... ???

> 'mapping' each polygon to, say, all triangles of a certain size and, say,
> 500 polygons? Obviously the result would be an estimate of the original
> mesh, rather than a reduction as you outlined.

I do not understand what you want : Reducing the number of polygon ? 
First keep in mind that Pov does not support mesh of polygons (Yet ???).
Next, a convex polygon can always be replaced by a set of triangles, 
BUT if uv-mapping was used, the texture will get bogus.

Why reducing the number of polygons/triangles ?
Mesh are generally generated from an abstract object, so I believe
it would be far easier to raise the size of the triangle/polygon when
generating the mesh than at a later stage.

Let's me do a parallel with Music/Sound.

The abstract object is the sound you can hear, fully analogic,
full of details.
The representation with a mesh of triangles/polygons is a 
digitalisation of that sound, at a given frequency. (CD quality, 44.1 kHz,
stereo).
Reducing the number of triangles/polygons is either 
 - asking for a lower frequency of sampling, which is really easy
   to perform if you have the analog record, but which required very
   complex maths to do it CORRECTLY directly from the digital data.
   (at least in the generic case when the new frequency is not a 
    multiple/divider of the old frequency).

 - asking for an MP3 compression (with some loose). Alas, MP3 takes
   a lot of studies and commitees before publication. May be someone
   as already publish things like that on the web, I do not know of any.

Moreover, this parallel is not exact, because sound can be considered
as 1D, and the mesh is 3D, which only add to the math complexity and
may provide you with unresolvable trouble.

(For instance, when moving randomly in 1D, the probability to get back
around the original point at some time is 1, whereas in 3D it is 0,
So adding dimensions to a problem may change the tools you could have used).


Post a reply to this message

From: jarbee
Subject: Re: Mesh polygon reduction?
Date: 2 Oct 2001 17:59:53
Message: <3bba38d9@news.povray.org>

news:3BB97204.8225FB8F@atosorigin.com...
> jarbee wrote:
> >

> > news:3BB18755.31FE7049@atosorigin.com...
> > > jarbee wrote:
> > > >
> > > > Meshes could also be interpolated from point density data using
(almost)
> > the
> > > > same algorithm.
> > >
> > > Please explain, I really have no clue what you are writing about.
> >
> > Well, OK - I'm writing about doing a hundred things with th one program.
Say
> > you had a 3d mesh made of 1000 polygons.
>
> That's not a lot (1000)...
>
> > Couldn't you use either the vertex
> > points, or the point at the centre of each polygon as input to a SOM,
>
> Please avoid using abbreviation when explaining things to poor brain like
> mine. I do not know what SOM is. Surface Of M... ???

SOM - Self Organising Map. Works by mapping n-dimensional input vectors to
an arbitary m-dimensional feature set.
Lets say I had a set of 3d points in space as the input vectors. Lets say I
had a 2-dimensional array of 3d vectors. Choose on input vector, find the
closest match to it in the array (in terms of euclidian distance). Move the
'winner' a bit towards the input vectors value, and move all vectors in the
neighborhood of the winner a bit closer too. Then pick another input vector,
and repeat the above steps. After a couple of thousand iterations, the
values in the 2-d array will now be a 'best fit' solution of the input
vectors. If you watch during the mapping process, it's like a flat sheet of
paper being slowly pulled up and around the 3d input points.

My idea isn't to create a professional quality polygon reduction technique,
or anything of the sort. The above algorithm is fairly simple to program. I
was basically looking for an easy way to reduce the number of triangles in a
mesh, with an expected loss of quality, so I could make paper models of some
of my simple meshes.

But the more I thought about this, the more I realised other things could be
done with it. Like anchoring certain points so they can't move. You could
add points to the input set, which aren't in the mesh, but act as 'control'
points by modifying the end result. You could wrap a sheet around 2 or more
mesh models thus creating a 'union' between them. Choose whether to map the
vertex points, or the centre points of the triangles. Map triangles to
n-sided polygons. Reduce/increase polygon count. Add randomness. Restrict
the minimum or maximum size of each triangle used.

There are algorithms specifically designed to do the above things. However,
I don't understand them all too well yet. But a Kohonen network is very easy
for me to program, and I like the thought of probability playing a role
:-)

The analogy I was thinking of is that of color quantization - which I have
used Kohonen networks for. It gives a smooth blended palette of colors which
works quite well. Quantizing a 24 bit image to 256 colors works very good,
but I'm also getting good results mapping to 16 or so colors. There is stuff
on the net about this but I can't remember the link. I was actually using
mine to map image colors to wool colors, to create cross-stitch patterns of
photos.

This is just an idea at the moment. Am I being too ambitious, or
thoughtless? Is there an obvious, easier way to accomplish this?

Dave.


Post a reply to this message

From: Jérôme Grimbert
Subject: Re: Mesh polygon reduction?
Date: 3 Oct 2001 05:02:27
Message: <3BBAD42B.BB69449A@atosorigin.com>
Thanks for the clarification.

jarbee wrote:
> 
> After a couple of thousand iterations, the

If so, I suggest you avoid pov-script and rather do that in C as a patch.
Otherwise, speed won't be there...

> values in the 2-d array will now be a 'best fit' solution of the input
> vectors.

Keeping playing with triangles, I can now see how you could simplify a mesh:
Using the vertex, you have to move them to the optimal places. Then you get
some degenerated triangles because two vertices are now identicals.
(Optimimaly, the three vertices are identicals; otherwise, you would need a fine
link between the two extremity to keep connectivity).
And the remaining triangles have been enlarged, so all is well.

> If you watch during the mapping process, it's like a flat sheet of
> paper being slowly pulled up and around the 3d input points.
> 
> My idea isn't to create a professional quality polygon reduction technique,
> or anything of the sort. The above algorithm is fairly simple to program. I
> was basically looking for an easy way to reduce the number of triangles in a
> mesh, with an expected loss of quality, so I could make paper models of some
> of my simple meshes.


Beware, you are thinking of a 3D to 2D mapping. 
Not all surfaces can support that.

IMO, the mapping for simplifying the mesh should be from 3D to 3D.
It could start as the set of vertices of a cubic cristal, into which you
push the initial mesh, fusionning the small triangles and moving the new
vertices along an attraction function (gravity-like, maybe limited scope). 
Then sampling the mesh-vertices along the new vertices set, 
and removing degenerates triangles.

> increase polygon count. 

That's one is easy: in every triangle, lies more triangles.
It can already be done with Warp's patch, as a simple script.
(Choose how you split a triangle: 3 or 4 triangles, recursion is an option).

> Add randomness. 

That's one too: move each vertex according to a 3D-noise pattern.
It can already be done with Warp's patch, as a simple script.

> Restrict
> the minimum or maximum size of each triangle used.

The maximum size restriction is easy, just adding an #if to the increase
of triangles. (But you will like to define the 'size' first, because the
definition might vary).

The minimum is the problem of reducing the number of triangles anyway.

> a Kohonen network



> 
> The analogy I was thinking of is that of color quantization 

Ok, thanks for the analogy, it give some light here!

> 
> This is just an idea at the moment. Am I being too ambitious, or
> thoughtless? Is there an obvious, easier way to accomplish this?

Excepted for the reduction, all the others are easy to do, and can
be done within a pov-scene. (even if parse speed could be increased 
by adding another patch).

The reduction is probably possible, but it will definitely require speed.

IMHO, you are getting addicted to mesh. :-)
You may want to look at some other people pages.
I would recommend: 
  http://www.geocities.com/ccolefax/index.html
  http://www.flash.net/~drsledge/manual/manual.htm


Post a reply to this message

From:
Subject: Image/photo to cross-stich pattern
Date: 4 Oct 2001 16:45:08
Message: <3bbcc92c.166298612@news.povray.org>
On Wed, 3 Oct 2001 07:53:46 +1000, "jarbee" <d_j### [at] yahoocom>
wrote:
>The analogy I was thinking of is that of color quantization - which I have
>used Kohonen networks for. It gives a smooth blended palette of colors which
>works quite well. Quantizing a 24 bit image to 256 colors works very good,
>but I'm also getting good results mapping to 16 or so colors. There is stuff
>on the net about this but I can't remember the link. I was actually using
>mine to map image colors to wool colors, to create cross-stitch patterns of
>photos.

Is your software available anywhere ?? I know someone who's quite fond
of cross-stitching and paint-by-numbers who's actually asked me if it
was possible to convert an image (photo or computer art-work) to a
pattern for this. 

/Erkki


Post a reply to this message

From: Ken
Subject: Re: Image/photo to cross-stich pattern
Date: 4 Oct 2001 19:14:53
Message: <3BBCEEBE.6CFE4152@pacbell.net>


> Is your software available anywhere ?? I know someone who's quite fond
> of cross-stitching and paint-by-numbers who's actually asked me if it
> was possible to convert an image (photo or computer art-work) to a
> pattern for this.

I bought my wife Easy Cross a couple of years ago and she was very
happy with it - http://www.easycross.ndirect.co.uk/

-- 
Ken Tyler


Post a reply to this message

From: jarbee
Subject: Re: Image/photo to cross-stich pattern
Date: 4 Oct 2001 20:06:34
Message: <3bbcf98a@news.povray.org>

news:3bbcc92c.166298612@news.povray.org...
> On Wed, 3 Oct 2001 07:53:46 +1000, "jarbee" <d_j### [at] yahoocom>
> wrote:
>
> Is your software available anywhere ?? I know someone who's quite fond
> of cross-stitching and paint-by-numbers who's actually asked me if it
> was possible to convert an image (photo or computer art-work) to a
> pattern for this.
>
> /Erkki

Actually, I wrote the program as a sort of one-off, to create a large
cross-stitch of our dog who passed away :-(
If enough people are interested, though, I will find the source and slap
something a little more user-friendly together.

BTW, I realise now that I should've posted to the programming group. Sorry
to all... but with the lack of replies, obviously my mesh idea is too dumb
or too similar to others anyway.


Post a reply to this message

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