Asset workflow best practice?

Hey there,

i’m pretty new to instaMAT, so this is a somewhat noobie question: I want to export my assets from Blender, unwrap and texture them in instaMAT and bring them into Godot. But I can’t figure out the best way.

My current workflow idea so far:

  1. Model in Blender
  2. Export as obj into instaMAT
  3. Unwrap in element graph
  4. Create material in layering mode
  5. Setup outputs in element graph (textures and mesh)
  6. Export mesh (gltf) and textures via “Images Data Output” dialog into Godot project folder (see screenshot)

So far steps 1-4 are working fine. My problem is the export to Godot:
In Godot the mesh has a “default” material assigned, which is transparent and has an alpha of 0, hence my model is invisible.

As a workaround, I could create a new material in Godot, assign the exported textures. But those are extra steps, which I’d like to avoid.

Did I set up my element graph correctly? Is there currently a way to export meshes with an assigned material from instaMAT?

Help is much appreciated because except for this problem, I’ve had a very good experience with instaMAT so far.

Cheers
Patrick

1 Like

Hello @floetenmaul,

Thank you for the detailed post! I’m so glad to hear that you’ve had a good experience with InstaMAT.

You can export meshes with assigned materials using Scene nodes in the Element Graph. You can use the Scene Material Set node to assign material information to a material section/slot. With regards to alpha/opacity, you might also need to use the Scene Material Set Parameter node with the Type set to Opacity with a value of 1.

Here’s an article from our documentation on Scene nodes:

Based on your graph, it looks like the Mesh Assign Material node could be adding an additional material section to the input geometry so that the resulting mesh could have two or more depending on if there were more than one on the original input mesh.

In addition there are a few useful nodes I’d like to mention:

  • The Mesh Get Material Name node is useful to determine if there are any material sections/slots assigned to a mesh and you can easily get their name if needed.
  • The Mesh Clear Materials node removes all material sections from the mesh and assigns a new one to all polygons.

You could use the Mesh Clear Materials node to clear all material sections from any input geometry, then assign a default one with a custom name, then use scene nodes to set any needed material information such as the opacity. Be sure to create a scene graph output (dark green color pin) instead of a mesh graph output (brown color pin).

You can then use the Image and Data Output Export panel you mentioned earlier to export the scene.

Hope this helps and if you have any questions, please feel free to ask! :smiling_face:

Thanks!

Hey @Pixby , thanks for the quick and extensive reply. I wasn’t aware of scenes.

I followed the documentation and set up my graph like this (had to insert a “mesh set material name” node to assign my material, though). The “Scene Render” does display the expected result.

Now I’ve got 3 problems / questions:

  1. The exported mesh (gltf) seems to be invalid (either Blender nor Godot are able to read it)
  2. The exporter writes these textures to disk:
    gas_canister_gas_canister_material_ORM.jpg
    gas_canister_material_BaseColor.PNG
    gas_canister_material_Metalness.PNG
    gas_canister_material_NormalMapTangentSpace.PNG
    gas_canister_material_Roughness.PNG
    Can I somehow adjust, what files are written out, or is this a fixed preset in the scene output?
  3. If i change back to my layering material, it’s still using the base mesh (with the old uv data). Is there a way to use the data generated in the element graph directly or do i have to export an intermediate/temporary mesh like i did before for that?

I still have to learn a ton about instaMAT so sorry for my novice questions…

Cheers
Patrick

PS.: I also attached my package…maybe this could be helpful understanding my problems
gas_canister.IMP (496.3 KB)

Hello @floetenmaul,

No worries about questions! We’re happy to assist!

Thanks for the screenshot and the IMP file! Those really help to quickly identify any issues.

#1 Invalid GLTF File

I think this might have to do with how the scene is set up. I wrote this answer after writing a few things below under the “Adjustments to Graph” section. I was able to reproduce Blender not being able to open the GLTF file from your graph, but after supplying a Path in the Scene Mesh Set node and enabling Create Node, the exported GLTF file opens in Blender. Though, I did need to remove a Mix Vertex Color node in Blender’s shader graph to see the Base Color. That might be Blender specific.

I posted a screenshot of this workflow below.

2. Exported Texture Files Written to Disk with Scene Output

After checking internally, InstaMAT creates these texture files so that it can properly bundle them with formats that support texture embedding such as FBX and USD. Currently, there isn’t a way to adjust this. However, you could create your own export templates to pack and configure output texture files. You could create specific graph outputs, then take advantage of the export template system. You can also create your own conversion nodes that can be utilized by the export system as well. Here are a few links if you’re interested.

#3 Referencing Mesh Data from an Element Graph in the Layering Project UI

Currently, in the Layering project UI, it is not possible to use data from an Element Graph to provide the “working mesh” for the project.

In this case, you can do as you mentioned and export the UV unwrapped version of the mesh by clicking the output pin of the Mesh UV Unwrap node to view it in the viewport, then click the Export Viewport Scene (floppy disk icon) button in the viewport toolbar to export it out, then in the Package Management panel, right-click the mesh and reimport it with the contextual menu. The layering project should update to show the new mesh, but new mesh maps will need to be baked.

I noticed that you’re using a Mesh Edge Ware Mask in your layering project. This mask uses the mesh’s baked curvature and tangent space normal maps. To get more accurate results when bringing layering projects into an Element Graph, I’d recommend using the Mesh Bake node to provide the project with all of the necessary baked mesh maps.

That way, if you change the input mesh, InstaMAT will automatically re-bake new mesh maps, and the layering project is able to procedurally adapt to the incoming geometry and texture it.

Adjustments to Graph

Nice use of graph inputs to ensure materials are named and referenced correctly! If you’d like to set and reference these variables privately, you could create/demote them to Local Variables so that they can only be accessed within this graph.

In this case, the Scene Material Create node is not necessary because you already have a material slot on the mesh, and you’re setting the name with the Mesh Set Material Name node for the first material index.

What you can do instead is use the Scene Mesh Set node, supply the Path for the mesh in the scene, then enable Create Node and Create Materials so that the material slot is taken from the mesh and automatically created for the scene.

Here is an updated IMP file if you’d like to take a look.
gas_canister_updated.IMP (498.3 KB)

As always, if you have any questions, please feel free to ask!

Thanks!

Floetenmaul, I use blender, InstaMAT and Godot, BUT I also use MaterialMaker (built on Godot) for checking material workflow and debugging shader/materials etc. In blender you have the addon QuickBake 1.1 so that is something to also consider.

I have pushed most of my texture workflow that I were doing in other apps now into InstaMAT to automate workflow process & consistency with custom export templates and InstaMAT’s painting workspace workflows. However, on the odd occasion I have to step out I still use MaterialMakers templates to streamline or debug for Godot, and quickbake 1.1 inside blender for some model bakes.

Hey there, thanks for your help. Also this new video did clear things up for me

The problem with the vertex color does also occur in Godot (because “use VC as albedo” is turned on in the material).
screenshot_00001963

My workaround for now, is to set the VC to white in instaMAT.

Cheers
Patrick

1 Like

You’re welcome! :smiling_face: Glad to hear the video was helpful as well.