godot: Vulkan: Using a lot of different materials spams error message

Godot version

v4.0.alpha.mono.custom_build [a647fb3e6]

System information

manjaro KDE

Issue description

I’m testing the game a lot, this needs to constantly and frequently open and close the game, but suddenly the engine freezes with the following message:

ERROR: Condition "!material" is true.                                                                       ✔ 
   at: material_update_dependency (servers/rendering/renderer_rd/renderer_storage_rd.cpp:462)
ERROR: Condition "!material" is true. Returning: true
   at: material_casts_shadows (servers/rendering/renderer_rd/renderer_storage_rd.cpp:437)
ERROR: Condition "!material" is true. Returning: false
   at: material_is_animated (servers/rendering/renderer_rd/renderer_storage_rd.cpp:424)
ERROR: Condition "!material" is true.
   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/renderer_storage_rd.cpp:450)

Steps to reproduce

New way:

  • Close the engine by clicking on [X]

Old way: No Idea how to reproduce, but since its related to materials, I’m using particles, so maybe a possibility could be:

  • Use a lot of materials
  • Close/Open the game a lot of times fast

Minimal reproduction project

N/a

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (12 by maintainers)

Most upvoted comments

get the same error messages in 4.0rc2

I’m seeing the same errors in beta3 when I queue_free() a Node with a surface material override. Unsetting the material right before queue_free(), like @zurrealStudios suggested, makes the error disappear.

Notes (may not be relevant):

  • The culprit material is a StandardMaterial3D
  • The culprit material has resource_local_to_scene = true
  • The culprit material has a next_pass.

I get the material error too in 35596e6b745483e503535617f77fd4fcf8b051b2

servers\rendering\renderer_rd\storage_rd\material_storage.cpp:2633 - Condition "!material" is true.

It is easy to reproduce by adding a MeshInstance3D to the scene, add a new material override, and close the scene.

It’s not really freezing for me, but when there are lots of materials it can take a very long time to endure the spamming. In my case it completely overwhelms VSCode when debugging (thousands of log entries, which is above console capacity), which prevents me from seeing any other errors that could have happened before the spam.

I’m getting a bunch of these errors every time I call queue_free() (deferred or not) on characters in my game: image I’m using 4.0-stable.

PS: Doing what @Lippanon suggested, and moving the materials from surfate_material_override to material_override, solves the issue.

Still present in v4.0.beta.custom_build [2ec0da1a7]: image I see these errors when changing scenes or, as mentioned, freeing nodes with active surface_material_override. A workaround, when applicable, is to use ‘material_override’ of GeometryInstance3D instead.

FWIW, I’m hitting this using voxel_tools. I only have 1 material, and it doesn’t freeze the engine, but I get about 4000 of these errors each time I regenerate the terrain.