Copy link to clipboard
Copied
When I assign materials in Substance Painter and import an object, all materials are listed separately, and I can bake them individually. However, when I tried to do this using sbsbaker through the command line, it didn’t work the same way.
The best solution I found was to create a separate JSON file for each mesh part using a Python script and then modify the --input-selection parameter to select each mesh part individually for baking. However, since it reloads the mesh every time, this greatly extends the bake time. Is there a way to solve this issue and speed up the process?
Hello,
It is possible to list the same baker multiple times in a JSON file, each with a different 'input-selection' parameter value.
In a JSON file, any parameter written out of a baker group is global and applies to all bakers listed. A parameter in a baker group is specific to that baker.
Considering this, here is an example:
{
"MeetMat Arms - Position": {
"baker": "position-from-mesh",
"parameters": {
"input-selection": "arms_msh",
"output-nam
...
Copy link to clipboard
Copied
Hello,
It is possible to list the same baker multiple times in a JSON file, each with a different 'input-selection' parameter value.
In a JSON file, any parameter written out of a baker group is global and applies to all bakers listed. A parameter in a baker group is specific to that baker.
Considering this, here is an example:
{
"MeetMat Arms - Position": {
"baker": "position-from-mesh",
"parameters": {
"input-selection": "arms_msh",
"output-name": "{inputName}_{bakerName}_arms",
},
},
"MeetMat Arms - Head": {
"baker": "position-from-mesh",
"parameters": {
"input-selection": "head_msh",
"output-name": "{inputName}_{bakerName}_head",
},
},
"apply-diffusion": false,
"average-normals": true,
"cage-mesh": "",
"dilation-width": 4,
"ignore-backface": false,
"inputs": "#####/3d_scenes/fbx/meet_mat_2019.fbx",
"match": 0,
"max-frontal": 0.1,
"max-rear": 0.05,
"output-format": "png",
"output-path": "#####/bakers_multi_material",
"output-size": {
"height": 9,
"width": 10
},
"relative-to-bbox": true,
"skew-correction": false,
"skew-map": "",
"use-lowdef-as-highdef": true,
"uv-set": 0
}
To go further, you can dynamically build JSON files or SBSBaker commands by parsing mesh information, using SBSBaker's 'info' command.
Here is an example, and its output: (Some paths were replaced with '#####' for privacy)
$ ./sbsbaker info --inputs #####/3d_scenes/fbx/meet_mat_2019.fbx
[WARNING][SceneGraph/Options]Not tangent space generator found.
File "#####/3d_scenes/fbx/meet_mat_2019.fbx":
Entity "arms_msh":
Label: arms_msh
Enabled: 1
Bounding box:
Minimal point: (-4.078,3.356,-0.8994)
Maximal point: (4.078,7.27,0.8746)
Center: (0,5.313,-0.01237)
Size: (8.156,3.913,1.774)
Location:
Local transformation: [1, 0, 0, 0; 0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1]
Global transformation: [1, 0, 0, 0; 0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1]
Mesh:
Name: arms_msh
Number of vertices: 25152
UV 0:
Contained within unit square: 1
Number of points: 25152
UV tiles : 0x0
Udim tiles : 1001
Submesh "arms_shd"
Label arms_shd
Color: ColorRGBA(0.5,0.5,0.5,1)
Number of triangles: 8384
Entity "head_msh":
Label: head_msh
Enabled: 1
Bounding box:
Minimal point: (-3.771,6.917,-3.211)
Maximal point: (3.771,14.46,3.425)
Center: (3.576e-07,10.69,0.1068)
Size: (7.542,7.542,6.636)
Location:
Local transformation: [1, 0, 0, 0; 0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1]
Global transformation: [1, 0, 0, 0; 0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1]
Mesh:
Name: head_msh
Number of vertices: 65280
UV 0:
Contained within unit square: 1
Number of points: 65280
UV tiles : 0x0
Udim tiles : 1001
Submesh "head_shd"
Label head_shd
Color: ColorRGBA(0.5,0.5,0.5,1)
Number of triangles: 21760
Entity "base_msh":
Label: base_msh
Enabled: 1
Bounding box:
Minimal point: (-4.126,-7.451e-08,-4.762)
Maximal point: (4.126,1.034,4.762)
Center: (0,0.517,-1.478e-05)
Size: (8.252,1.034,9.523)
Location:
Local transformation: [1, 0, 0, 0; 0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1]
Global transformation: [1, 0, 0, 0; 0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1]
Mesh:
Name: base_msh
Number of vertices: 39384
UV 0:
Contained within unit square: 1
Number of points: 39384
UV tiles : 0x0
Udim tiles : 1001
Submesh "base_shd"
Label base_shd
Color: ColorRGBA(0.5,0.5,0.5,1)
Number of triangles: 13128
Entity "body_msh":
Label: body_msh
Enabled: 1
Bounding box:
Minimal point: (-3.015,1.029,-1.624)
Maximal point: (3.012,7.568,1.622)
Center: (-0.001507,4.299,-0.0005714)
Size: (6.027,6.539,3.246)
Location:
Local transformation: [1, 0, 0, 0; 0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1]
Global transformation: [1, 0, 0, 0; 0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1]
Mesh:
Name: body_msh
Number of vertices: 26736
UV 0:
Contained within unit square: 1
Number of points: 26736
UV tiles : 0x0
Udim tiles : 1001
Submesh "body_shd"
Label body_shd
Color: ColorRGBA(0.5,0.5,0.5,1)
Number of triangles: 8912
I hope this is helpful!
Best regards.
Copy link to clipboard
Copied
Thank you for your reply i try this and work perfectly thank you