Paper Modeller 05 with progress and big screenshots

Published August 12, 2011
Advertisement
I made the mistake, that I didn't make the intent of the application clear in this journal, I just linked my old one.

Thanks Zarfius for the comments that made me reply and write down the "goals", now I can just copy it here.

[size="3"]The goals of the application

Due to my relatively poor English, I can't really use the term "goal". In my previous entry, I was talking about my "goals", in this paragraph, I'll write about the application's "goals" (what it does).

The program is for aiding paper modelling, which has nothing to do with computer games. So the main feature is precise unfolding polygon meshes (so it's not the same as UVW unwrapping). I know there are many programs and plug-ins for that, but all the programs I found during a small research was either not "to my liking" or was "expensive". Some of them have manual unfolding (polygon-by-polygon, which is very tedious), some of them are only suitable for low or very-low poly models, some of them produces crappy unfolded geometry or are tedious to work with. And as far as I saw, none of them take the thickness of the paper into account (which is 0.5 mm for the cardboard I worked with for example).

A main goal is to make an algorithm that produces the best output with the least input even with high-poly meshes. Easily and intuitively modifying the unfolded geometry is a must too. And of course printing/plotting the result with different line types and textures. Later I'll add more features, like modifying surfaces of the original 3D mesh to be unfoldable (it's hard to explain what I mean by that); making slices of the mesh for layered paper structures; automatic/manual adding of "flaps" to the edges to be glued together, maybe basic documentation tools like guidelines, arrows, numbers, comments, assembly drawings, etc.

More explanations in my old blog, I don't want to rewrite/copy the whole thing here.

[size="3"]The Progress

Unfolding


Reused the code from the previous version, and added new features like
  • automatic welding of unfolded vertices/edges
    It's hard to explain why I need this. So see the first three images of an unfolded box. Second: with welding, third: without welding. You can see how the algorithm builds up the unfolded geometry.
  • displaying the split (cut up) edges in the 3D view
    and added an "unfold edges only" edge selection method. Of course, welded edges are not displayed
  • textures
    really just using the same texture coordinates as the original mesh
  • sharp edges are rendered as broken lines
  • triangle identifier numbers on 3D and unfold geometry

    This is just the beginning. I plan to add a lot of other and powerful features to it to generate much nicer geometry that needs fewer further manipulation.
    And of course taking the thickness of the paper into account. That will be a huge pain in the ass. Maybe I should start with a *perfect* shell generation algorithm (offsetting the faces). Well, even 3ds MAX cannot do that....

    You can read more about the algorithm if you like, here.

    GUI


    I played (struggled) with it a lot, programming-wise. With the help of Gamedev of course. Now it has expandable/shrinkable groupboxes, and the whole "Right Panel" is scrollable with left mouse button drag. It still flickers (I didn't dare to use WS_EX_COMPOSITED style for the panel), but (IMHO) feels/looks quite slick. And it will be helpful in the near future, because I still haven't bought a new monitor, and the current has an approx 200x200 pixel dead area at the botton-right corner.

    Of course, it's far from finished/polished, but at least I can forget about it for a while.

    [size="3"]"Concerns"

    Or whatevers... I still have no idea about the mechanics of the editor. Especially the mechanics of unfolding.

    I unfold the geometry, then I edit the unfolded geometry, then I press unfold again, and Bam! all the editing is lost. Or maybe every unfolding should go on a new "Sheet"? (if the user wants of course). After unfolding, the 3D and the unfolded geometry should be totally separately handled? What about other stuff in the future? When I add new meshes, like layered things of the 3D mesh? How about importing new meshes?

    Maybe the user could select which sheet the new unfolding should go, and override the unfolded geometry on that sheet?

    So a lot of brainstorming and design is ahead of me.

    [size="3"]Images
    The first three demonstrates the welding stuff. The box is segmented only for testing this feature.
    The other seven images are about the unfolding of the car model, modified by edge selection. The algorithm splits (cuts) the geometry at selected edges. It took me about ten minutes to make it (excluding 3D modelling). I tried two variations for the roof.
    The last three shows the GUI.

    cube_03.jpg
    cube_01.jpgcube_02.jpg

    unfold_01.jpg
    unfold_02.jpg
    unfold_03.jpg
    unfold_04.jpg
    unfold_05.jpg
    unfold_06.jpg
    unfold_07.jpg

    new_gui_01.jpgnew_gui_02.jpgnew_gui_03.jpg
0 likes 5 comments

Comments

Aardvajk
This is looking great, szecs. Almost makes me want to pick up my 3D modeller project again.

I got a bit obsessive about purging flicker on the GUI for mine. I found WS_EX_COMPOSITED didn't work, can't remember the details, so in the end I went with doing WS_CLIPCHILDREN with everything, and manually InvalidateRect-ing the children of controls recursively. My situation was slightly complicated by having a bitmap background drawn as the background of the main window but it is quite possible to get rid of flicker completely, although largely irrelevant to the functionality of an application.

Have you considered using the default GUI font for your GUI stuff instead of that fixed font? I was reading that DEFAULT_GUI_FONT is frowned upon so used this to create mine:

[source lang="cpp"]
void Application::CreateGuiFont()
{
NONCLIENTMETRICS Nm;
Nm.cbSize=sizeof(NONCLIENTMETRICS);

SystemParametersInfo(SPI_GETNONCLIENTMETRICS,sizeof(NONCLIENTMETRICS),&(Nm),0);

LOGFONT L=Nm.lfMenuFont;

HDC Dc=GetDC(Hw);
strcpy_s(L.lfFaceName,"MS Shell Dlg");
L.lfHeight=-MulDiv(8,GetDeviceCaps(Dc,LOGPIXELSY),72);
ReleaseDC(Hw,Dc);

L.lfQuality=CLEARTYPE_QUALITY;

GuiFont=CreateFontIndirect(&L);
}
[/source]

Then I just send a WM_SETFONT message to all controls. Just a thought, ignore me, don't let anything distract you from the sterling job you are doing on the actual application functionality and rendering, which both look top notch to me.
August 14, 2011 08:25 AM
szecs
Thanks for the suggestions, I'm using the default font for the GUI, I mean I don't do anything to change the font... or do I (I'll look into it tomorrow, maybe I accidentally don't set the font back to default)?
WS_EX_COMPOSITE works for me, but I've read there are several issues about it, for example only working on XP... I've also read that DeferWindows helps a lot. I'm not that obsessive about the flicker, it's just the GUI after all, and dragging it is not really a common thing.
August 14, 2011 11:40 AM
Aardvajk
Sorry, default font is a confusing term. By default, Win32 API uses the font in your screenshots, which is a bit ugly, unsure of the exact name. But there is also a DEFAULT_GUI_FONT that is available from GetStockObject() which is normally MS Shell Dlg I believe and is proportional.

But there are mutterings over MSDN that using DEFAULT_GUI_FONT is not encouraged. My own experiences don't marry up with this as on any machine I have developed on, it produces the same font as my code above as far as I can tell, but professional advice seems to be to grab a font with SystemParametersInfo().

But as I say, all of this is irrelevant. MilkShape3D has a butt-ugly GUI and has sold loads of copies because it fills its niche well and the functionality is superb so listening to me, the guy who never finishes projects, would be silly to say the least. :)
August 14, 2011 06:00 PM
DiegoFloor
I love this idea! This is the first time I hear about paper models, and the software idea is great. It can print the shapes on paper with the bonus of textures!

I have to ask though, have you ever tried to build a paper model using a solution your software made? Care to show something? :)
June 27, 2012 01:44 PM
szecs
Thanks for the comment.
I haven't made a model with the software yet, due to a big issue: my printer is very imprecise.
But I have build other models using pan and paper planning:
[url="http://www.youtube.com/watch?v=dbog5fcPnAE"]http://www.youtube.com/watch?v=dbog5fcPnAE[/url]
July 02, 2012 06:55 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement