diff --git a/content/blog/2022-01-19-monocular-blender.md b/content/blog/2022-01-19-monocular-blender.md index 4a81da5..a828de0 100644 --- a/content/blog/2022-01-19-monocular-blender.md +++ b/content/blog/2022-01-19-monocular-blender.md @@ -71,5 +71,53 @@ An example of an output from MiDaS is shown below. I have boosted the exposure a ### The Blender plugin +I have a personal project called [*Evan's DCC Scripts*](https://github.com/Ewpratten/dcc_scripts) where I keep personal plugins for 3D software. + +I decided to piggy-back off the pipeline infrastructure I have already set up there for this project. Thus, bringing my MiDaS tool into blender was as simple as creating a new QT GUI, and hooking it up to a custom operator. + +*For anyone curious, my Blender plugins use QT for maximum interoperability with the rest of my toolset.* + +
+ +

Plugin Dialog: Import Monocular Image

+
+ ### Actually creating textured 3D meshes +The process for converting a depth map and texture to a 3D object is quite simple: + +1) Create a plane (this can be done through [*Images As Planes*](https://docs.blender.org/manual/en/latest/addons/import_export/images_as_planes.html)) +2) Subdivide the plane (I have been using 128 subdivisions, and it seems to work well) +3) Apply a [*Displace Modifier*](https://docs.blender.org/manual/en/latest/modeling/modifiers/deform/displace.html) to the plane, using the depth map as the source texture, and configuring the modifier to work with UV coordinates + +The first time I tried this, I encountered a slight issue with depth mapping: + +
+ +

A failed attempt

+
+ +But then, I quickly figured out how to set up the displacement modifier, and got my expected result: + + + + + + +
+
+ +

Displaced, untextured

+
+
+
+ +

Textured, viewed from the original camera position

+
+
+ +## Conclusion + +This whole project was a fun experiment with some tools that are designed for very different applications. I plan to continue refining the quality of the outputs of my plugin. I'll likely look in to reducing un-needed subdivisions using [OpenSubdiv](https://graphics.pixar.com/opensubdiv) in the near future. + +If you are interested in experimenting with my depth mapping plugin yourself, feel free to send me [an email](mailto:mail@va3zza.com) and I'll help you set it up. Currently, my tools are Linux-exclusive. diff --git a/static/images/posts/monocular-blender/ayo_bro.png b/static/images/posts/monocular-blender/ayo_bro.png new file mode 100644 index 0000000..d6cfa4b Binary files /dev/null and b/static/images/posts/monocular-blender/ayo_bro.png differ diff --git a/static/images/posts/monocular-blender/ayo_displaced.png b/static/images/posts/monocular-blender/ayo_displaced.png new file mode 100644 index 0000000..bd56b8d Binary files /dev/null and b/static/images/posts/monocular-blender/ayo_displaced.png differ diff --git a/static/images/posts/monocular-blender/ayo_textured.png b/static/images/posts/monocular-blender/ayo_textured.png new file mode 100644 index 0000000..7d91a53 Binary files /dev/null and b/static/images/posts/monocular-blender/ayo_textured.png differ diff --git a/static/images/posts/monocular-blender/blender-importer-window.png b/static/images/posts/monocular-blender/blender-importer-window.png new file mode 100644 index 0000000..1869a7a Binary files /dev/null and b/static/images/posts/monocular-blender/blender-importer-window.png differ