Loop normals: first step needs testing!

Hi guys,

I (hopefully) mostly finished first step in loop normals work. Now, all objects have the option to enable loop normals (with an optional angle threshold above which edges are always sharp). Once enabled, final derived meshes (structs representing objects to draw or render) gets a normal CD layer for their loops (and a tessellated version for its tfaces as well). Those loop normals allow to represent flat faces and sharp edges. As a temp UI, I added loop normals and angle options in the “Item” panel, “Properties” of the 3DView.

Code can be checked out from my svn branch, https://svn.blender.org/svnroot/bf-blender/branches/vgroup_modifiers

EDIT We are now using GIT and Phabricator, so this work is now hosted in a Differential revision instead of a branch: http://developer.blender.org/D11…

These data are used in OpenGL preview (only when “VBO” option is enabled, for now, I prefer to modify viewport code as few as possible currently!), and for tangent space compute as well (note that for this one, I assumed it is only used over final dm, this may not be always true, have to check this yet). These are also the same as exported in OBJ and FBX.

Only remaining TODO for this first step is to export TSpace in FBX (btw, if someone could provide me one or two simple ASCII FBX files with TSpace data, would be nice 😉 ) – and of course, to test!

I hope the core algo to compute loop (split) normals is now OK (I fixed two bugs here recently :/ ), but esp. tspace/loopnormals combinations are to be checked carefully (baking)…

EDIT CoDEmanX just uploaded a Windows build of the WIP branch: http://www.graphicall.org/925 Many thanks to him! 😀

About Export Split Normals Status

Well, I guess I kinda forgot to announce this here… :/

So, 2.69 will have split normals export for both FBX and OBJ formats. I just fixed a (stupid, as always) bug in core code last week, think everything works OK now. You can still test latest Blender builds, obviously! 🙂

Also, as I’m now hired for six months on mid-time base by the Blender Foundation, especially to work over game-dev tools, I have chosen loop normals (i.e. split normals, i.e. normals per vertex per face) as main project, so expect more new features on this topic in upcoming releases. I’ll also try to keep this blog updated about it, this time!

Export split normals in OBJ, work on FBX

Hi,

So today I committed the “split normals” in OBJ exporter, now when you check « Include Normals » you will get split normals.

I also kept working on FBX – one can get nice gain with optimizations here… Right now (only basic vertices, faces [now polygons] and edges export done), with a default cube subdivided nine times (i.e. over 1.5 millions of vertices and faces), here are the stats I get:

With edges:

New code:
New verts: done in 4.237405 secs...
New polys: done in 3.605981 secs...
New edges: done in 3.249940 secs...
export finished in 14.5939 sec.

Old code:
Old verts: done in 5.774732 secs...
Old faces: done in 5.692272 secs...
Old edges: done in 9.272664 secs...
export finished in 28.4587 sec.

Without edges:

New code:
New verts: done in 4.237738 secs...
New polys: done in 3.707349 secs...
New edges: done in 0.000003 secs...
export finished in 11.5021 sec.Old code:
Old verts: done in 5.733048 secs...
Old faces: done in 4.810387 secs...
Old edges: done in 0.000004 secs...
export finished in 16.1231 sec.

Still quite a bunch of work to do here (not to mention binary export 😉 )…

Export Sharp Edges as Vertex Normals – Day 8

Great news ‑ core code and RNA API are in trunk (commits r60005, r60014 and r60015)! Many thanks to Campbell, who helped a lot optimizing and cleaning up the core code, and to Brecht, who reviewed the API code. 😀

Note that for now, there is no preview in 3D View, and no storing of those split normals in .blend file, as this is only temp data currently.

Very soon (probably tomorrow), I will commit the OBJ update. FBX will have to wait a bit more, as it first needs some deeper changes! Anyway, hard work is done, py scripting is easy… 😛

Export Sharp Edges as Vertex Normals – Day 6 & 7

So, ping-pong with Master Yoda, King of Optimization (aka Campbell 😛 ) kept going…

I must say I’m rather amazed and happy with the results! In latest patch, we have another 50% or so gain in performance, and we now only use 8 bytes per edge and 4 bytes per loop!

Btw, found out FBX export currently exports tessellated faces, which is bad and will need to be fixed before adding split normals export to this format. Will try to tackle this in the next days (if optimizations suggestions stop filling up my available time! 😉 ).

Export Sharp Edges as Vertex Normals – Day 5

So, API is validated! However, Campbell gave me some hints to improve core code, which now only uses 24 bytes per edge (plus 4 bytes per loop), and runs twice as fast as previous version. Compared to first patch, current one is about four times faster and eats about three times less memory… that was worth a few more hours of work! 😉

Export Sharp Edges as Vertex Normals – Day 4

Spent a few hours on polishing the core code – removed some unused elements, gaining a few CPU cycles and over all, reducing temp edge data from 80 bytes to 48 bytes per edge (on 64 systems)! Also made some more tests, everything still successful. 🙂

Also reworked the API… Still very basic, but less nasty than first version imho. Now waiting feedback from Cambpell about it (issue here is that we have too much ways to do it, need some advices about the best one!).

Current patches: core and obj exporter.

So I’d say the core goal of the project is now done (remaining bits – FBX export & adding split angle threshold – are trivial). If current API is validated, will try to get that reviewed asap, and then will see about adding 3D View visualization…