mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
102.5k stars 35.37k forks source link

Loop Subdivision Implementation #4455

Closed zz85 closed 10 years ago

zz85 commented 10 years ago

After Face4s were killed (See #3663), subdivision modifier has always been a known issue in releases and is part of the TODO 's "Replace Catmull-Rom based SubdivisionModifier with a Loop subdivision implementation".

Of course there's no guarantee loop subdivision is going to be a perfect replacement, but its something we should work on. I've given it a shot but didn't have the strength to finish through with the implementation. Will try resuscitating it if I can, meanwhile anyone who wants to give it a shot should do so :)

zz85 commented 10 years ago

@mrdoob should we make the subdivision modifier just work on Geometry2 or finish it with Geometry then port it over?

mrdoob commented 10 years ago

Good question... Maybe Geometry2...?

zz85 commented 10 years ago

Can't sleep due to an overdosed of caffeine after drink some local tea, gonna give this another shot. Using references from http://graphics.stanford.edu/~mdfisher/subdivision.html and http://www.holmes3d.net/graphics/subdivision/ ...

zz85 commented 10 years ago

@mrdoob I'm don't see any examples of Geometry2 with WebGLRenderer at the moment, so I testing this with the old geometry.

Good news: managed to get it working :) (Requires 3 subdivisions for models to look nice though)

2014-02-18_123301

Code on GIST currently: https://gist.github.com/zz85/9064672 not tested with UVs etc and requires cleanup.

Time for some sleep first!

mrdoob commented 10 years ago

Sweet! :D

mrdoob commented 10 years ago

It's also much faster and less code ^^

zz85 commented 10 years ago

Thanks to the tea for keeping me awake that night :)

Would also be interesting to hear results from those running SubdivisionModifier in production... ping @ZanQdo (#3024)

ZanQdo commented 9 years ago

Great news @zz85 I will let my guys know, hopefully try it out and report back!

maximeq commented 4 years ago

Hi,

I experienced issues when trying an import of subdivision surfaces from Blender (or Clara.io) to three.js. Those 2 softwares do not use Loop scheme, even on triangular meshes (first step will split triangles into quads). I'm not 100% sure but I think this is why subdividing in three.js does not give the same surface as subdividing in Blender. Also, splitting quads to triangles impacts the resulting surface, giving even more difference.

We wanted to use subdivision surfaces in my company to reduce the size of the files to load. Would it be possible somehow to resurect the old Catmull Clark subdivision code ? As an option to the subdivider maybe ? I guess I can also just copy-paste it in our code base, but I think it would make sens to stay compatible with existing softwares.