• Godot Help3D
  • Texture material on mesh renders as magenta in Android, but fine on PC?

Hi, I'm working on a pet project to learn about working with objects in 3D, and I uploaded an early WIP on gotm.io to see how it looks.

The objects render correctly when I open the browser game from my laptop..
but it shows up entirely as magenta when I open the page on my Android phone.

I was wondering how I should debug such an issue? I'm currently still using Godot 3.4.2.

The texture is added on the mesh's material_override by code.

Something like this

On the script for each planet I have in my game:

func _ready():
	var material = SpatialMaterial.new()
	randomize()
	var rndno = randi() % Globals.p_material_list.size()
	material = Globals.p_material_list[rndno]
	$Sphere.material_override = material

and in another autoloaded script (Globals.gd)

var p_material_string = ["res://Assets/987_103_planet.png", 
					"res://Assets/987_144_planet.png", 
					"res://Assets/987_158_planet.png",
					"res://Assets/987_175_planet.png", 
					"res://Assets/987_203_planet.png"]
func _ready():
	for string in p_material_string:
		var material = SpatialMaterial.new()
		var texture = load(string)
		material.albedo_texture = texture
		p_material_list.append(material)

Here's a link to my WIP prototype in case it helps.

Gotm

Many thanks in advance !

  • Likely texures fail to load due to the chosen texture compression setting. Probably a safe bet.

Likely texures fail to load due to the chosen texture compression setting. Probably a safe bet.

    Megalomaniak

    Oh thank you. I tried to recreate the PNG files. And it seems to work on my phone now.

    ChatGPT says it could be due to some transparent pixels on my PNG file causing issues. So I just saved it again by copying to mspaint and saving it from there. I probably also resolved any texture compression issues created when the PNGs were first created.

    Thanks!

      tingling

      Well maybe I spoke slightly too soon.

      Saving it on mspaint resolves the issue on my android device. But when I try it on an iOS mobile device, I get all black spheres. Even for another sphere mesh that only has a color material and no texture.

      Let me see what else I could be missing.

      tingling ChatGPT says it could be due to some transparent pixels on my PNG file causing issues.

      I'd be careful not to take anything ChatGPT says as any sort of gospel. But worth exploring I suppose.

      tingling I probably also resolved any texture compression issues created when the PNGs were first created.

      The texture/memory compression is an import setting within the godot editor. Look at the import tab in editor after selecting/highlighting a texture in the in-editor file browser.