Jump to content

[1.16][Not Solved] need help with OBJ models


kiou.23

Recommended Posts

I've got an obj model rendering on an item, however I'm facing three issues:

1- the model doesn't render correctly in the player inventory

2- the model has a face that is missing (the model looks fine in the 3d editor)

3- the model pivot point is weirdly placed when it is rotating on the ground

4- the texture doesn't load and the model just renders all black

here's a repo for the mod: https://github.com/jvcmarcenes/dicehoard

and here are some images of the problem:

2021-03-24_14_51_27.png.9d53275969f2d122c0ca0f765a7e62a9.png2021-03-24_14_51_26.png.4164b8e77ede936f6d936c5c030fdb0b.png

 

 

 

 

 

 

 

 

Edited by kiou.23
Link to comment
Share on other sites

36 minutes ago, vemerion said:

I have never used an obj model before, but my guess is that you can still use the 'display' field in the item json model file to change the rotation/translation/scale of the item. Take a look at the Minecraft wiki article about it. That would solve issue 1 and 3 I think.

okay, seems like that should solve some of the problems (although the trial and errors to get the numbers right is going to be a headache...)

thanks!

Link to comment
Share on other sites

  • kiou.23 changed the title to [1.16][Not Solved] need help with OBJ models

I haven't messed with OBJ models either but..don't you need to specify the texture path in the form modid:item/texture_name here: https://github.com/jvcmarcenes/dicehoard/blob/4e02044bec2bedceebf402ba875ecb9d73593da4/src/main/resources/assets/dicehoard/models/dice/d_six.mtl#L4? After relocating your texture file of course

  • Thanks 1

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

Link to comment
Share on other sites

24 minutes ago, Beethoven92 said:

I haven't messed with OBJ models either but..don't you need to specify the texture path in the form modid:item/texture_name here: https://github.com/jvcmarcenes/dicehoard/blob/4e02044bec2bedceebf402ba875ecb9d73593da4/src/main/resources/assets/dicehoard/models/dice/d_six.mtl#L4? After relocating your texture file of course

I'll try that

I didn't think I'd need to since the .mtl and the texture are in the same folder

EDIT: did not solve it

Edited by kiou.23
Link to comment
Share on other sites

Beethoven92 is correct, you need to change map_Kd line to (map_Kd dicehoard:item/white). I put your files is a test project and the texture loads. (Note: I used your png file and not the jpg in model folder)

Edited by lupicus
Link to comment
Share on other sites

1 hour ago, lupicus said:

Beethoven92 is correct, you need to change map_Kd line to (map_Kd dicehoard:item/white). I put your files is a test project and the texture loads. (Note: I used your png file and not the jpg in model folder)

still won't work for me

I updated the repo with the suggestion, can you confirm that what I tried is the same as what worked for you?


EDIT: nervermind, it works, I'm dumb

the reason why I thought it wasn't working was due to ItemColors returning pure black

Edited by kiou.23
Link to comment
Share on other sites

I should've mentioned that I only took assets and no code, sorry about that.

For #2, you have 2 texture U coordinates above 1.0 (the last 2 defined in OBJ file). Changing them to 1.0 makes it look correct.

Edited by lupicus
  • Thanks 1
Link to comment
Share on other sites

47 minutes ago, lupicus said:

I should've mentioned that I only took assets and no code, sorry about that.

For #2, you have 2 texture U coordinates above 1.0 (the last 2 defined in OBJ file). Changing them to 1.0 makes it look correct.

Thank you!

the uv thing is odd, I got the files exported from vectary and it rendered fine in the viewer.

Link to comment
Share on other sites

For #1 and #3 you can adjust position in json file (this looks about right):

{
  "loader": "forge:obj",
  "model" : "dicehoard:models/dice/d_six.obj",
  "display": {
    "gui": {
      "translation": [ 10, 3, 5 ]
    },
    "ground": {
      "translation": [ 9.6, 5, 8 ]
    }
  }
}

 

Link to comment
Share on other sites

20 minutes ago, lupicus said:

For #1 and #3 you can adjust position in json file (this looks about right):


{
  "loader": "forge:obj",
  "model" : "dicehoard:models/dice/d_six.obj",
  "display": {
    "gui": {
      "translation": [ 10, 3, 5 ]
    },
    "ground": {
      "translation": [ 9.6, 5, 8 ]
    }
  }
}

 

yeah, I was just tinkering with the numbers

I'm still gonna need to fine tune the translation for some other dispalys, but this already helps!

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • my arrow wont move at all it would stay mid air and show no collision   my Entity class: package net.jeezedboi.epicraft.entity.custom; import net.jeezedboi.epicraft.init.ModItems; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.projectile.AbstractArrowEntity; import net.minecraft.item.ItemStack; import net.minecraft.network.IPacket; import net.minecraft.util.math.EntityRayTraceResult; import net.minecraft.world.Explosion; import net.minecraft.world.World; import net.minecraftforge.fml.network.NetworkHooks; public class ExplosiveArrowEntity extends AbstractArrowEntity { // default constructor, required to register the entity public ExplosiveArrowEntity(EntityType<ExplosiveArrowEntity> entityType, World world) { super(entityType, world); } public ExplosiveArrowEntity(EntityType<ExplosiveArrowEntity> entityType, double x, double y, double z, World world) { super(entityType, x, y, z, world); } // the constructor used by the ArrowItem public ExplosiveArrowEntity(EntityType<ExplosiveArrowEntity> entityType, LivingEntity shooter, World world) { super(entityType, shooter, world); } // the item stack to give the player when they walk over your arrow stuck in the ground @Override protected ItemStack getArrowStack() { return new ItemStack(ModItems.EXPLOSIVE_ARROW.get()); } @Override protected void onEntityHit(EntityRayTraceResult result) { super.onEntityHit(result); // this, x, y, z, explosionStrength, setsFires, breakMode (NONE, BREAK, DESTROY) this.world.createExplosion(this, this.getPosX(), this.getPosY(), this.getPosZ(), 4.0f, true, Explosion.Mode.BREAK); } // called each tick while in the ground @Override public void tick() { if (this.timeInGround > 60){ this.world.createExplosion(this, this.getPosX(), this.getPosY(), this.getPosZ(), 4.0f, true, Explosion.Mode.BREAK); this.remove(); } } // syncs to the client @Override public IPacket<?> createSpawnPacket() { return NetworkHooks.getEntitySpawningPacket(this); } } my item class :   package net.jeezedboi.epicraft.item.custom; import net.jeezedboi.epicraft.entity.custom.ExplosiveArrowEntity; import net.jeezedboi.epicraft.init.ModEntityTypes; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.projectile.AbstractArrowEntity; import net.minecraft.item.ArrowItem; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class ExplosiveArrowItem extends ArrowItem { public ExplosiveArrowItem(Properties props) { super(props); } @Override public AbstractArrowEntity createArrow(World world, ItemStack ammoStack, LivingEntity shooter) { ExplosiveArrowEntity explosiveArrowEntity = new ExplosiveArrowEntity(ModEntityTypes.EXPLOSIVE_ARROW.get(), shooter, world); return explosiveArrowEntity; } } other stuffs: public static final RegistryObject<Item> EXPLOSIVE_ARROW = ITEMS.register("explosive_arrow", () -> new ExplosiveArrowItem(new Item.Properties().group(ModItemGroup.Epic_Items))); public static final RegistryObject<EntityType<ExplosiveArrowEntity>> EXPLOSIVE_ARROW = ENTITY_TYPES.register("explosive_arrow", () -> EntityType.Builder.create((EntityType.IFactory<ExplosiveArrowEntity>) ExplosiveArrowEntity::new, EntityClassification.MISC) .size(0.5F, 0.5F).build("explosive_arrow")); mappings channel: 'snapshot', version: '20210309-1.16.5'
    • may i ask what it was that fixed it, I'm having the same problem and its frustrating because I'm making an origin.
    • I need to accesses byPath field of net.minecraft.client.renderer.texture.TextureManager. As I found out I need to use accesstransformer.cfg file and make the field public via it. In this file field names look like f_<numbers>. And I was unable to figure out, how to get those. It seems like it is connected to something called mappings (thing left after Minecraft decompile process). How can I get such a name for a class field?
    • The game crashed whilst rendering overlay Error: java.lang.OutOfMemoryError: Java heap space Exit Code: -1   Crash Report:                                              Log: https://pastebin.com/9NMLr5bD       https://pastebin.com/av6Q2jCf Password: gpTq3Gvkc5                     qdF0BeJGYN   Any suggestions what should i do here?
  • Topics

×
×
  • Create New...

Important Information

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