Jump to content

(1.12.2)Problems trying to load .obj model with a 256x1 palette image as texture


Recommended Posts

I am having trouble loading a model file exported directly from MagicaVoxel with textures, but the loader complains about the 1x256 texture palette image associated with the .mtl file for having broken aspect ratio.

The stacktrace of the error:


[15:32:24] [main/ERROR]: Unable to parse metadata from minecraft_ml:textures/ml_blockbase.png

java.lang.RuntimeException: broken aspect ratio and not an animation

	at net.minecraft.client.renderer.texture.TextureAtlasSprite.func_188538_a(TextureAtlasSprite.java:380) ~[cdq.class:?]

	at net.minecraft.client.renderer.texture.TextureMap.func_110571_b(TextureMap.java:238) [cdp.class:?]

	at net.minecraft.client.renderer.texture.TextureMap.func_174943_a(TextureMap.java:155) [cdp.class:?]

	at net.minecraftforge.client.model.ModelLoader.func_177570_a(ModelLoader.java:159) [ModelLoader.class:?]

	at net.minecraft.client.renderer.block.model.ModelManager.func_110549_a(ModelManager.java:28) [cgc.class:?]

	at net.minecraft.client.resources.SimpleReloadableResourceManager.func_110542_a(SimpleReloadableResourceManager.java:121) [cev.class:?]

	at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:512) [bib.class:?]

	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:377) [bib.class:?]

	at net.minecraft.client.main.Main.main(SourceFile:123) [Main.class:?]

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_191]

	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_191]

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191]

	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191]

	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]

	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]


My model, blockstate file and the corresponding textures are uploaded in attatchments.The model renders with texture correctly when imported into other model viewers like blender.







My resource dir structure:


Edited by d0048
Link to comment
Share on other sites

Yes, from my experience working with .OBJ models in Forge, the texture has to be a square texture, or rectangular (with a height which is a multiple of the width) with a .png.mcmeta file for animated textures. You also seem to have to flip the texture vertically in the blockstate JSON file using:


"custom": { "flip-v": true }


, which I usually place under the "model": definition. If you don't do this, you may find that your texture is upside-down.


Edit: This is true when exporting a .OBJ file from Blender, I cannot confirm if this is the case when exporting your model from another application.

Edited by DoctorLOGiQ
Added a footnote to be clearer about a statement I made
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.