Zerene --> Blender --> Sketchfab: essentials for newbies

A forum to ask questions, post setups, and generally discuss anything having to do with photomacrography and photomicroscopy.

Moderators: rjlittlefield, ChrisR, Chris S., Pau

rjlittlefield
Site Admin
Posts: 23608
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Zerene --> Blender --> Sketchfab: essentials for newbies

Post by rjlittlefield »

This post is to provide a recipe for using Zerene Stacker and Blender to construct 3D models that can be uploaded and displayed at Sketchfab.

An example of the result can be seen at https://sketchfab.com/3d-models/microst ... b2e68507a9 , "Microstructure of a fractured MLCC die".

I make no claim that this is the best method, but I can confidently claim "for newbies" because I am one of those, and this is the stuff I had to learn to be successful.

I hope that other people who are more familiar with Blender will let me know of improvements.

First, install and familiarize yourself with Blender:
  1. Download from https://www.blender.org/download/ and install as directed.
  2. On the Quick Setup screen, leave "Select with Left" even if you're using a left-handed mouse. Windows will make the swap as usual, but changing the setting inside Blender will introduce confusion with tutorials.
  3. Spend an hour with Blender 4.1 Beginner Tutorial - Part 1 (New). This will familiarize you with the selection and navigation controls, which are not easily learned by experimentation.
  4. If you want to get Blender back to "factory release" condition, then on Windows you can remove the folder %APPDATA%\"Blender Foundation"\Blender . Simply uninstalling and reinstalling will not do this job.
In Zerene Stacker:
  1. Go to Options > Preferences > DMap Settings, scroll down, and put a check mark on "Save depth maps in folder". Leave the folder path set at its default, "{project}/DepthMaps".
  2. Load your source files.
  3. Stack > Align & Stack All (DMap).
  4. Adjust the contrast selection threshold to a level that avoids artifacts in areas of the subject that have no high contrast details. You can expect that some iteration between Zerene Stacker and Blender will be required to get this right.
  5. File > Save Project to any convenient folder.
  6. File > Save Output Image to write the DMap output image to a JPEG file. I recommend to name this something simple, like "DMapImage.jpg". Sketchfab can get confused if the name contains special characters like the timestamps that Zerene Stacker provides by default.
In Blender (version 4.1):
  1. Launch Blender and hit Escape to dismiss the splash screen, leaving the default scene that contains just a cube.
  2. Right-click and delete the cube.
  3. In Object Mode, Add > Mesh > Plane
  4. In the Transform panel on right side of screen, adjust Scale X and Scale Y to match the aspect ratio of your images from Zerene Stacker. For the example linked above, I had cropped images to be 962 by 1585 pixels, so I scaled the plane to be Scale X = 0.962 and Scale Y = 1.585 (pixel counts divided by 1000). The orange rectangle will change shape to match.
  5. Switch to Edit Mode.
  6. Edge > Subdivide, then open the Subdivide panel at lower left of screen, set the number of cuts to 10, and hit the Enter key. This subdivision will be easily visible in the plane.
  7. Again, do Edge > Subdivide, and set the number of cuts to 50. The plane is now subdivided to 500x500 and will appear solid orange when selected.
  8. In the right-hand menu icons select the wrench icon (tooltip Modifiers).
  9. Click on Add Modifier > Deform > Displace.
  10. Click the little button to the right of "Displace", whose tooltip says "Edit Mode // Display modifier in Edit mode." A solid gray plane will appear, floating over the orange selected mesh.
  11. Set Midlevel = 0.0 (instead of 0.5). The gray plane will move up.
  12. At bottom of tools menu, click the red checkboard with tooltip Texture.
  13. Click the New button (next to the checkerboard under Displace), then under Image > Settings, click Open.
  14. Navigate to the project folder saved from Zerene Stacker, then down to DepthMaps. (On first visit, click on Add Bookmark to provide a fast way to get back to that folder. For sure you'll be wanting to do this a bunch.)
  15. Select the appropriate depth map *.tif file, and click Open Image. After a short delay, the flat gray plane will repaint to show vertical texture corresponding to the depth map. (If the plane fails to update, perhaps you forgot to select "Display modifier in Edit mode" when creating the modifier.)
  16. Zoom in the view, so that you can see more detail.
  17. At this point, your plane will probably be bounded by vertical walls on two or more edges. To get rid of those, go to Image > Settings, scroll down to Mapping, open that, and set Extension to be "Extend" rather than the default "Repeat".
  18. While in Image Settings, change the color space to "Linear Rec.2020".
  19. In the menu of tool icons, click the red circle with tooltip "Material // Material Properties", then New to add a new material.
  20. At "Base Color", click the little yellow circle, then in the popup menu select Image Texture.
  21. Click the Open button to open a file navigator panel, navigate to the folder where you saved Zerene Stacker's DMap output image, select that file, and click Open Image. The surface will remain gray at this moment.
  22. In the upper right corner of the main panel, select the option with tooltip "Viewport Shading". This will cause the surface to show colors from the DMap image.
  23. Look around by changing the view. If the vertical scale looks wrong, then click the wrench icon (tooltip Modifiers) and type in a different value for Strength. Or, if you know the physical dimensions, then set the transform Strength = 2, and set the object's physical dimensions and stack depth as the object's Scale X, Y, and Z. (These are accessed via the tools icon labeled "Object", the orange square icon.)
  24. File > Save As, and put the .blend file in any convenient place.
  25. Do a File > Export > Wavefront (.obj), be sure there are checkmarks on Object > Apply Modifiers and Materials > Export, type in a name for your .obj file and click Export Wavefront OBJ. This will create two new files, with extensions .mtl and .obj .
At Sketchfab, using your browser:
  1. Visit https://sketchfab.com and login.
  2. Click on Upload.
  3. Into the upload panel, drag three files: the DMap image generated by Zerene Stacker, the .obj file created by Blender (which contains the geometry), and the .mtl file created by Blender (which links by name against the DMap image).
  4. Click on Upload Files.
  5. Wait for upload and processing to complete (maybe 1 minute for processing)
  6. Edit 3D settings, find a good starting view, Save View, Exit, fill in Title, Description, Categories, and Tags, and Publish.
It took me several days to get comfortable with this process. I hope this brief description helps out somebody else, but if nothing else it will prevent me from forgetting critical steps when I do it again.

Corrections and improvements welcomed!

--Rik

Smokedaddy
Posts: 1966
Joined: Sat Oct 07, 2006 10:16 am
Location: Bigfork, Montana
Contact:

Re: Zerene --> Blender --> Sketchfab: essentials for newbies

Post by Smokedaddy »

That should be very helpful for those wanting to give this a shot. If using Blender to do this, I think diving into Blender's Sculpt mode drastically improves most extrusions. Zbrush, a stand-alone program, is more complicated but has more features. I found this Youtube video very helpful.

https://www.youtube.com/watch?v=f25h308PVlg

-JW:

Post Reply Previous topicNext topic