atteneder / glTFast

Efficient glTF 3D import / export package for Unity
Other
1.21k stars 243 forks source link

glb export in editor mode missing textures for custom shadergraph #453

Open tommynanny opened 1 year ago

tommynanny commented 1 year ago

Describe the bug I tried to export glb file from both the context menu and from the code in editor mode, but it seems some textures are missing which use custom shader graphs. The only texture that is exported correctly is the one that uses "Universal Render Pipeline/Simple Lit", the other textures that use custom Shader Graphs are missing. I was wondering if I missed something.

Files

// CollectingLogger lets you programatically go through
// errors and warnings the export raised
var logger = new CollectingLogger();

// ExportSettings allow you to configure the export
// Check its source for details
var exportSettings = new ExportSettings {
  format = GltfFormat.Binary,
    fileConflictResolution = FileConflictResolution.Overwrite
};

var assetfolder = $ "{GBCityPath.Path(ExportPoint.AssetBundles)}/{CurrentLandSceneName}";
Utilities.PrepareFolder(assetfolder);

var path = $ "{assetfolder}/{fileName}.glb";

// GameObjectExport lets you create glTFs from GameObject hierarchies
var
export = new GameObjectExport(exportSettings, logger: logger);

// Add a scene
export.AddScene(new GameObject[] {
  land.gameObject
}, "My new glTF scene");

// Async glTF export
bool success = await export.SaveToFileAndDispose(path);

if (!success) {
  Debug.LogError("Something went wrong exporting a glTF");
  // Log all exporter messages
  logger.LogAll();
} else {
  Debug.Log($"Export to {path} Successfully");
  DestroyImmediate(land.gameObject);
}

Expected behavior to generate a glb file that has no missing texture

Screenshots image

image

1660888535070

1660888556559

1660888771590

1660888811719

Desktop (please complete the following information):

atteneder commented 1 year ago

Hi @tommynanny,

Thanks for reporting.

Right now, only a limited set of shaders is supported.

glTFast cannot automatically figure out how to map a material's properties to glTF materials. The future plan is to offer a simple way to define the mapping, so that custom shader graphs can be exported as well.

hth