Today's post comes compliments of industry expert Pieter Schiettecatte from A+I in New York City. Click here to see all this posts on this blog, include the very popular recent post: Tutorial: how to create custom Enscape assets.
Many of you have reached out on how to create custom Enscape
assets with cutout maps. A typical example of this is vegetation: because the
polycount must be kept low, each leaf cannot be modeled in full detail. Instead
the shape of the leaf is approximated with just a few polygons and then extra definition
is added by using a transparent .png image for the leaf’s color texture.
In this tutorial we will use an ivy plant as an example. You
can download the Blender file here.
Ivy model rendered with Blender 2.9 |
Ivy model with wireframe, notice the leaves are only roughly modeled with 6 polygons each |
Step 1) Export the ivy object to gltf+bin+textures
and the white placeholder as an .obj file. For detailed information click here.
Alternatively, download the exports from Blender files here.
Step 2) Create a custom asset using the asset creator
tool and load it into your library. Render the asset in Enscape. Notice that
the transparent edges of the leaves are rendering black.
This is because Enscape assets do not support the
transparency layer of .png files. Instead, we will need to manually add a black
& white cutout map in the .gltf file.
Step 3) make a copy of the .png leaf texture maps and
convert them to a black & white .png. Black for transparent areas, white
for opaque areas. Save the cutout maps in your asset folder
Step 5) First it is necessary to declare that two
additional image maps will be used for this gltf file.
Navigate to the “image” section of the .gltf and add a new
entry for each cutout map (indicated in red). The names are arbitrary but the “uri”
needs to match the filename exactly (including the file extension). Remember
that Enscape assets do not support spaces in texture maps.
Each entry needs to be separated with a comma (indicated in
blue).
The number for the source is referencing an entry in the
image list. The numbering starts at 0, so for the 3rd image in the
image list, the source is 2.
Step 8) Add the Enscape extensions (ENS_material) to the leaf materials. The extension provides for more than a dozen options, but in this case only two are necessary:
- “materialType”: 3, this will trigger Enscape to render the material with the “foliage” shader. Enscape will use some optimizations like a modified shadow calculation, subsurface scattering and no outline generation.
- Masktexture: this is the cutout map, the index refers to the number in the list of the textures (so index 2 is the third entry in the texture list (count starts at 0)
Step 9) Save the .gtlf and launch Enscape. The black edges
should now render transparent. If you had trouble following the steps, you can
download the finished asset here.
For BIM Chapters updates, follow @DanStine_MN on Twitter or connect on LinkedIn
Check out my video-based courses on ArchSmarter.
I also write blog posts for Enscape - a new paradigm in rendering, animation and VR for AEC.