godotengine / godotengine/godot

mipmap are not applied at runtime load glb file

Open
#100,481 2 comments 0 reactions 0 assignees View on GitHub
bug topic:3d topic:import
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

4.3 stable

### System information

Windows 11 - Godot 4.3 Stable

### Issue description

1. editor imported *.glb model - mipmap ok
2. separate model (*.gltf+*.bin+*.png) - mipmap ok
3. embed texture model (*.glb) - mipmap not ok

When loading a glTF file with embedded textures at runtime, mipmaps are not applied. I tried using the `GLTFState.get_images()` function to retrieve the images, calling the `generate_mipmap` function on them, and then resetting them with `GLTFState.set_images`, but it still doesn't work.

Looking through past issues, it seems that mipmaps are not applied to glTF files with embedded textures. Is there any plan to support mipmap generation for *.glb files with embedded textures when loaded at runtime?

I couldn’t find anything related in the milestones.

best regards.

### Steps to reproduce

```gdscript
extends Node3D

var loaded_model

func _ready() -> void:
var gltf_document = GLTFDocument.new()
var gltf_state = GLTFState.new()

var error = gltf_document.append_from_file("res://Model/TestModel.glb", gltf_state)
if error == OK:
# generate mipmap
var images = gltf_state.get_images()
var new_images_array = []
for img in images:
var src_img = img.get_image()
src_img.generate_mipmaps()
new_images_array.append(ImageTexture.create_from_image(src_img))
print("src_img.get_size() -> ", src_img.get_size())
print("src_img.get_mipmap_count() -> ", src_img.get_mipmap_count())
gltf_state.set_images(new_images_array)

loaded_model = gltf_document.generate_scene(gltf_state)
add_child(loaded_model)
```

### Minimal reproduction project (MRP)

[mipmaptest.zip](https://github.com/user-attachments/files/18154749/mipmaptest.zip)

Contributor guide

Open the contributing guide

Research direction

Run the linked mipmaptest.zip reproduction and trace the shown GLTFDocument.append_from_file, GLTFState.get_images/set_images, and generate_scene calls. Compare runtime loading of embedded-texture GLB files with separate glTF assets, then verify that generated scenes retain mipmaps for embedded textures.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.