Skip to content

glTF scene export crashes for a null normal texture #56379

Closed
@RedMser

Description

@RedMser

Godot version

Fresh builds of 3.x (commit 7fcfde9) AND 4.0 (commit 91b97da)

System information

Windows 10

Issue description

glTF scene exporter does some normal map conversion code which does not do is_valid checks. To find it, ctrl+F in gltf_document.cpp for // Code for uncompressing RG normal maps

This means glTF-exporting a scene that has a material with an empty normal map texture causes a crash.


Btw, material->get_texture is called twice for the normal texture (right below the code that crashes). Can't the second call be removed? The variable isn't used...

Steps to reproduce

  • Open mesh.tscn (alternatively: create a scene with a cube meshinstance, add spatialmaterial and enable normal map without providing a texture)
  • Project -> Tools -> Export GLTF
  • Crash

Minimal reproduction project

gltf_export_normalcrash.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions