Posts RSS Comments RSS Del.icio.us Digg Technorati Blinklist Furl reddit 65 Posts and Comments till now
This wordpress theme is downloaded from wordpress themes website.

Archive for April, 2016 (2016/04)

Editing Meshes

Overview
Before importing my models into UE4, I did some edits mostly with MeshLab and Maya.  I also played with other 3d modeling programs such as meshmixer, 3d builder, netfabb, blender, and 3ds max.

I started with 62 STL files from 3d scans, and I don’t want model editing to become too heavy of a focus on this project.  So I followed the 80-20 rule (aim for 20% effort to get 80% results).  With a little effort, I can at least make these models much better than my original placeholder art (box + photo texture), plus I can get some more experience working with 3d models.

MeshLab Edits
The scans had way too many polygons, so I used MeshLab to reduce polygon count from ~1-2 million to 15k.  MeshLab has a *.mlk XML format for scripting that seemed promising to automate (Filters > Remeshing etc > Quadratic Edge Collapse Detection > faces 1500).  But when I tried it with meshlabserver.exe (MeshLab_64bit v1.3.4BETA (May 28 2014)), it didn’t work.  So I ended up writing an AutoHotKey script to run my *.mlk file from the GUI for each of the 62 STL files.

In MeshLab, it was also easy to do some other manual per-model edits – delete junk triangles (artifacts from scanning), use Remeshing > Close Holes, and export as OBJ.  Export as OBJ created a file that imported cleanly into Maya (and other software).
image

Maya
Mesh > Cleanup.  To selectively reduce polygons for the flat bottom of the hero/monster figures, I did – select the part you want to reduce, then Mesh > Reduce.  The grid view made it easy to select just the base platform.  To rotate: ctrl+shift+A selects all, then E puts you in rotate mode, or W puts you in translate mode, or ctrl+A for Attribute Editor > *:Mesh tab > rotate or translate.  Modify > center pivot.

I tried out other various Maya tools such as Modify > Align Tool, Mesh > Fill Hole.  I quickly found that with 62 files, I could eat a lot of time editing each file in Maya, so I made sure to balance (getting better results and learning Maya) with (a bias towards getting it done faster).

To delete selected vertices, “Delete” is not enough – you have to do “Ctrl+Delete” or Edit Mesh > Delete Edge/Vertex.

I imported OBJ and exported to OBJ when I wanted to continue editing the file in other software (eg MeshLab).  When exporting OBJ, I did not export Materials.  For use with UE4, I exported to FBX since that’s UE4’s standard.  I used the following FBX export options – Include Smoothing Groups, Smooth Mesh, Selection Sets.  Axis Conversion Up Axis Y.  FBX File Format Binary, FBX 2014/2015.

image image image image image

netfabb Basic, and Maya vertex normal edits
One specific issue I ran into was deleting artifacts from scanning on one of the orc’s swords.  I deleted junk triangles in MeshLab but I had trouble filling the left-over hole – neither (MeshLab > Close Holes) nor (Maya > Fill Hole) seemed to work.  However, netfabb Basic had automatic repairing that fixed it.  The triangles it generated had flipped normals, but I fixed this via MeshLab > Filters > Normals > Invert Faces Orientation, and via Maya > Mesh Display > Reverse, Vertex Normal Edit Tool, Set Normal Angle.

image image

Gargoyle
Unlike the other hero/monster figures (miniatures), the gargoyle is composed of three pieces – the body, the wings, and the head.  Rather than scan this as one piece, I scanned this as three separate pieces then merged them in Maya.  The 90 degree angle orthographic views (Side, Front, Top) were very useful for lining up the wings correctly.

All of the objects were small for the EinScan-S, but the gargoyle head was even smaller.  The EinScan-S scanning software failed to auto-merge my gargoyle head scans, so I took separate turn table scan and merged them in Maya.

image image image image image

Unreal Editor
For the hero/monster figures, I used simple solid color materials that I created in the Unreal Editor designed to look like plastic.  I worked on the hero/monster figures first.  A texture isn’t necessary because each model is a single color.

image image

Process for Quick Edits
After a little experimenting, my process got more streamlined.  MeshLab reduce polygons, delete artifacts, fill holes, export as OBJ.  Maya import OBJ, reposition model, cleanup, reduce base, export as OBJ and as FBX.  UE4 import, add material, test.  The FBX files were small enough that I included them in Perforce.

Heroes/Monsters now, Furniture later
Editing the furniture will be a bit more involved.  For the furniture, I only scanned the plastic parts (not the cardboard), so I’ll need to create simple geometry for the cardboard pieces and add a texture to it based on 2d scans of the cardboard pieces.  The long-run is TBD – I might even redo all of this starting from more detailed scans (LMI HDI 109?) and/or I might find an artist to focus on the model edits.

So for now I’m just doing the hero/monster figures, and I’ll save the furniture for later.  Focusing on just the hero/monster scans for now means I’m starting from 23 STL files rather than 62.

Results and Next Steps
I was excited to see the hero/monster models in-game.  You don’t have to zoom in too close to see that the scans are lacking in fine detail.  The skeleton model was made by someone else using a NextEngine scanner, and it’s noticeably more detailed.  It feels incomplete with the furniture still using the box-with-texture placeholder art.

But overall the results are awesome – and I am motivated to continue working on this.  My day job has to take priority, but so far in 2016 I’ve consistently found time to work on this, and I’m planning to continue for at least the full year of 2016.  For the next steps, I’m planning to get back to other aspects besides scanning and model editing – eg writing code for game logic and user interface interactions.

I’ll close with screen shots and a video – quest 1, a “family portrait”, a room full of orcs, and a room full of goblins.  Goblins and orcs are unique in that they have multiple unique models (4 orcs, 3 goblins).

image image image image image image image image image

Scanning 3D Models

Background

In my Prior Work and References post, I mentioned that I found a lot of pre-existing art assets related to HeroQuest – including quest maps, great 2d scans, and photos of the 3d figures.  However, I found almost no HeroQuest 3d models.  So the figures and furniture in my game screen shots and videos thus far use place-holder art – each place-holder art is a box with a 3d figure photo.  The skeleton monster is an exception.

Here is a photo of the basic game system contents ( http://bit.ly/1OVMhEE ).  The basic game contents contains 18 unique miniatures (figures) ( http://bit.ly/1KjDGq7 ) and 14 unique furniture pieces ( http://bit.ly/1P6CMEA ).  That’s 32 unique pieces for the basic game system (there’s additional pieces for the expansions).  The expansions contain an additional 21 unique miniatures plus 4 unique furniture pieces for a total of 25 unique pieces in the game system expansions.  In summary, that’s 32 basic pieces + 25 expansion pieces = 57 total.  It’s actually a little more because some pieces are composed of multiple sub-pieces (eg gargoyle, bookshelf).

Each furniture piece is composed of a plastic piece made out of a single color plastic and a piece of printed cardboard that you attach to the plastic piece (the cardboard piece must be folded, except the doors).  Some furniture pieces contain two plastic pieces (table, throne) and some contain tiny add-on plastic pieces (bookcase rat and skull, alchemist bench bottles).  The hero/monster figures are all one piece (except the gargoyle and some of the expansion figures).

3d Scanning Overview

I’m going for an authentic look (based on the source material), so 3d scans seemed like an efficient alternative to making the models by hand.  I want to focus most of my effort writing code for a UE4 based game rather than creating 3d models, so with 57+ pieces of detailed geometry, using a 3d scanner saves a lot of effort.  Even mediocre unmodified 3d scans would be miles ahead of the photo-on-a-box placeholder art.  If needed, I could still start modify them later – eg to fix errors, add detail, reduce poly count, and/or optimize (eg for a lot of surface detail we could use bump mapping instead of geometry).

As of early 2016, 3d scanners are expensive.  The only thing I really need to scan is the geometry for the single color plastic pieces.  For the folded cardboard pieces, I can use detailed 2d scans as a texture for simple geometry that I create in a 3d modeling program (such as Blender).  The EinScan-S is a low-mid end desktop 3d scanner around $1000-$1200.  After reading some reviews, it sounded like a top choice for around $1000 or less, so I decided to give it a try.

EinScan-S Setup and Testing

It took some time to setup, but overall it was easy and I got cool 3d scans without much effort.  However, the scans did not pickup tiny details.  For example, the chaos warrior has tiny details on its chainmail mesh pants and a skull face on a circle on the front of the plate mail below his right shoulder.

 setup2 setup3 IMG_20160323_232423 IMG_20160323_232451 3dscan3 3dscan4

I tried some things to optimize the scans.  I put the scanner in a dark closet.  I taped polarized filters (Hoya CIR-PL) onto the camera sensors.  I tried different settings (the dark setting seemed to work best even with the bright white powder spray).  I tried the free scan mode (which was a lot slower than turn table mode).  I sprayed Helling white powder on the models (3dscanspray.com).

I ended up using the spray because it seemed to help.  To be honest, I didn’t test that very thoroughly, and the spray is really designed for objects with mirror reflections, transparency, or more pronounced shiny specular reflections – while the objects I scanned are only sort of shiny.  The spray also left tiny powder pieces on the model, though EinScan-S didn’t seem to detect enough tiny details for these to interfere.  For what it’s worth, my non-scientific impression was that the spray seemed to reduce errors like the top of the chaos warrior’s helmet being missed, but it did not increase detail for scans using the EinScan-S.

Some of the things I did might’ve helped a little, but at the end of the day the EinScan-S isn’t designed to pickup the tiny details on these ~1.5 inch tall HeroQuest game pieces.  Maybe one of the following would do better – the $3000 NextEngine, $4000 David SLS-3, $4000 EinScan-Pro, $20,000 Artec Eva, or AutoScan-DS300 dental scanner (price unknown).  Or maybe some form of photogrammetry.

The chaos warrior scan isn’t perfect.  But it is instantly recognizable – especially when zoomed out.  So it’s good for now, and I’ll still have the option (at a later time) to try a better scanner or to use the EinScan-S models as a starting point (and then edit them eg Blender, MeshLab).

3d Scanning the Game Pieces

Despite the imperfections, I was excited to scan these plastic models and integrate them into UE4 (and then eventually get back to working on the actual game programming stuff using my improved static mesh assets!).  Scanning is fairly streamlined with EinScan-S, but even in turn table mode, even after I was already setup and done experimenting – it took quite a few hours to scan 35+ objects.

For each object I did a full turntable scan from at least two (often three to five) angles.  It was not uncommon that I had to redo a scan or recalibrate or delete some geometry (noise) in MeshLab.  One time the turn table got sort of jammed causing the scans to take much longer until I unjammed it.  Letting the EinScan-S software try to merge two full turn table scans of a tiny object made the software crash.

Here’s an example of spraying then scanning one of the orc figures:

IMG_20160402_183351 IMG_20160402_184838 IMG_20160402_184941 image image image

In some cases, the EinScan-S software did not properly merge the results of two full turn table scans.  A quirk of the EinScan-S software is that it lets you pick control points to merge free scan mode scans, but you can’t do this with turn table mode scans.

Here’s an example of the EinScan-S software 1.7.3.0 incorrectly merging two full turn table scans of the alchemist bench.  Unfortunately, when the software messes up in this way, it doesn’t have an option to manually align the scans or to dump them two separate STL files.  In my experience, the software consistently made this mistake for the same object.

image

My work-around was to save multiple full turn table scans and merge them in MeshLab (or MeshMixer).  If I were to do it all over, I might export the raw point cloud data for each scan.  This would give more control in creating meshes from point cloud data (eg in MeshLab) rather than letting the EinScan-S software generate STL (or OBJ) meshes automatically.

How long did it take?  Theoretically it might be 3-10 minutes per object.  But with multiple full turn table scan angles, going and back-and-forth into my closet, and troubleshooting I’d say it was closer to 30 minutes per object.  So one estimate is 30 minutes per object * 35 objects = 17.5 hours.  I scanned the plastic pieces from the basic game in a single weekend, and it basically ate up the entire weekend (Saturday + Sunday).

3d Models – More Work To Do

After scanning, I have 66 STL files – many are scans of the same object from different angles.  Some scans need to be merged into one.  Some scans need to be edited to remove artifacts and fix errors.  All scans have too many triangles and lack detail; much of the surface detail should probably be done with bump mapping or parallax mapping.

For each model, I will need to import it into UE4 as a static mesh and add a material.  For the furniture, I will need to create simple geometry for the cardboard pieces, apply the 2d scans as a texture, and then combine the cardboard sub-piece models with the plastic sub-piece models.

So there’s more work in terms of editing models and integrating models into the game.  Beyond that, a lot of work could be done to improve the models – add detail and optimize for performance.  Or I could even try re-doing the 3d scans with a higher end 3d scanner to see if it picks up more detail.

I only did scans for the 32 basic game pieces.  The expansions have an additional 25 game pieces.

The Scans

But overall, the 3d scans are awesome.  As described in my Prior Work and References post, there’s a significant HeroQuest community including lots of hobby projects, yet no one has created (or scanned) 3d models or used 3d models of HeroQuest game pieces in a video game version of HeroQuest (hobby or commercial) – until now :-).

I’ll close with screen shots of the scans as STL files viewed in MeshLab.  4 heroes + 3 monsters alive (brown) + 3 monsters undead (white) + 3 monsters magic (gray) + 2 goblin variations + 3 orc variations = 18 hero/monster miniatures.  11 unique furniture pieces (2 doors share a plastic piece, one cupboard + two bookcases share a plastic piece).

image image image image image image image image image image image image image image image image image image image image image image image image image image image image image