experimental - Polygon Reduction.js

experimental - Polygon Reduction.js

Hello,

this is experimental and tooooooo slooow, just sample for script from c++ code. :)

( Progressive Mesh type Polygon Reduction Algorithm by Stan Melax http://www.melax.com/polychop/ ).

updated:20070306 please check it.
updated:20081014 fix: uv code error?.
updated:20090309 fix: error when some points share same positions.
updated:20100321 fix: bug for 5.2+.

for Cheetah3D 5.1- http://www.tres-graficos.jp/blog/files/article.php?id=24
for Cheetah3D 5.2+ http://www.tres-graficos.jp/blog/files/article.php?id=56


regards.

tg_jp, Hiroto.
 
Last edited:
Hi Hiroto,
that is an excellent idea. I'm sure many game developers are interested in such a feature.
But I think there is a bug in your script. Applying your script (50%) to the box below didn't generate what I expected.

Bye,
Martin
 

Attachments

  • Cheetah3DSchnappschuss001.jpg
    Cheetah3DSchnappschuss001.jpg
    13.8 KB · Views: 1,905
  • Cheetah3DSchnappschuss002.jpg
    Cheetah3DSchnappschuss002.jpg
    13.8 KB · Views: 1,915
Hi,

thanks for comments. I fixed that bugs. still slow and not optimized, not well tested anyway.:(

> hi Francois

thanks for info. after checking those source files of that link, I will try to optimize this script. thanks.

regards.

tg_jp, Hiroto.
 

Attachments

  • Cheetah3DScreenSnapz001.jpg
    Cheetah3DScreenSnapz001.jpg
    78.6 KB · Views: 2,113
Last edited:
Hi,
yes it is working now. Great job. :icon_thumbup:

Now you just have to optimize it a little bit.:wink:

I only had a very short look into the source code. But i think one of the main performance problems might by caused by the Array class. For example for removing an Object from the array the hole array has to be searched through. In such cases it is always better to work with indexes.

Bye,
Martin
 
This seems to work well (if somewhat slow), except that I have a model that's around 100k polys, and I quickly get an "out of memory" error from javascript when I try to use this on that mesh.
 
can anyone tell me how to actually use this script? I've tried grouping it and applying it every which way. It just makes a polygonscript-reduc object.. it I can't get it to do the reduction on my target object.
 
hi

please check the folder you did install it. you have to place it into Tool folder of ~/Application Support/Cheetah3D/scripts.

After invoking Polygon Reduction.js from Tool->Script->Tool Script of menu bar. Select a target polygon object at object browser, then, click 'apply' button to make new polygon object with reducted polygon count. ( slow :p )

as other post, million poly count costs a lot, and script error occur.

regards.

tg_jp, Hiroto
 
This is working great:icon_thumbup::icon_thumbup:

Thanks
AC
 

Attachments

  • Picture 21.png
    Picture 21.png
    150.3 KB · Views: 633
  • Picture 20.png
    Picture 20.png
    167.8 KB · Views: 643
Error in line 279

The script keeps throwing an error on line 279 for one particular model.

"rv has no properties"

The line is:

"rv.heapspot = -1"

If I comment out the line, I get some hit-or-miss results. And some extremely ugly looking results, too.
 
hi

thank you for repoting. I couldn't reproduce it. so, could you post the model that cause a problem?

regards.

tg_jp, Hiroto.
 
hi,

thank you for quick reply and the file. I could reproduce it. :( I think you made that with 'Boolean Creator', that makes some complex polygons, I am guessing some polygons are too complex to reorganize with this script.

so to avoid that error, please try 'optimize' the model before executing 'polygon reduction.js'. it's work with that model.

regards.

tg_jp, Hiroto.
 

Attachments

  • Cheetah3D_sz_001.jpg
    Cheetah3D_sz_001.jpg
    25.9 KB · Views: 614
hi,

thank you for quick reply and the file. I could reproduce it. :( I think you made that with 'Boolean Creator', that makes some complex polygons, I am guessing some polygons are too complex to reorganize with this script.

so to avoid that error, please try 'optimize' the model before executing 'polygon reduction.js'. it's work with that model.

Thanks, I'll give that a try. But I'm also wondering why the script would give that error. Why would rv have no properties? Is there an error in the HeapPop() function? Or is it caused by a low-memory condition?
 
Hi
Just a side note.
Seems your model came from a CAD-app.
Shouldn´t be too hard to achieve this in Cheetah3d.;-)

Cheers
Frank
 

Attachments

  • Helmet.jpg
    Helmet.jpg
    47.3 KB · Views: 574
  • Head4U.jas.zip
    32.7 KB · Views: 471
Last edited:
I edited line 278 of the script:

Code:
    var rv = heap[0];

I added "var" because rv wasn't previously declared as a variable, but that makes no difference with this error.

Hi
Seems your model came from a CAD-app.
Shouldn´t be too hard to achieve this in Cheetah3d.;)

Thanks, Frank! Yes, my artist is deeply attached to Strata 3D. Apparently he's been modeling in Strata and copying and pasting objects into Cheetah. I've tried begging and bribing him to stop using Strata, but it's no use. Would you mind attaching your version of the model, so I can show it to him?
 
Last edited:
Back
Top