Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

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


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 post
Share on other sites

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.

  • Thanks 1
Link to post
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 post
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 post
Share on other sites
Posted (edited)
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 post
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 post
Share on other sites
Posted (edited)
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 post
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 post
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 post
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 post
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 post
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.

Guest
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.



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • I'm currently trying to make a new cauldron-type block, and I'm having difficulty implementing blockstates. Here's the relevant part of the alchemical cauldron's code:   public class AlchemicalCauldronBlock extends Block { public static final IntegerProperty LEVEL = IntegerProperty.create("level", 1, 3); private static final VoxelShape INSIDE = box(2.0D, 4.0D, 2.0D, 14.0D, 16.0D, 14.0D); protected static final VoxelShape SHAPE = VoxelShapes.join(VoxelShapes.block(), VoxelShapes.or(box(0.0D, 0.0D, 4.0D, 16.0D, 3.0D, 12.0D), box(4.0D, 0.0D, 0.0D, 12.0D, 3.0D, 16.0D), box(2.0D, 0.0D, 2.0D, 14.0D, 3.0D, 14.0D), INSIDE), IBooleanFunction.ONLY_FIRST); public AlchemicalCauldronBlock() { super(Properties.of(Material.METAL).sound(SoundType.METAL).harvestLevel(3).strength(2F,2F)); // this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, 0)); // this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, Integer.valueOf(0))); } ... When I try to run this with either of the two attempts at registerDefaultState uncommented, I get this error: https://pastebin.com/vPf3UryC. For convenience, I believe this part is most relevant: How can I avoid this? My registry classes look like this, if it helps: public class registry { public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, AlchemyPlus.MODID); public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, AlchemyPlus.MODID); public static void register() { IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); BLOCKS.register(modEventBus); ITEMS.register(modEventBus); registerItems.register(); registerBlocks.register(); } } public class registerBlocks { public static final RegistryObject<Block> ALCHEMICAL_CAULDRON = register("alchemical_cauldron", AlchemicalCauldronBlock::new); static void register() {} private static <T extends Block> RegistryObject<T> registerNoItem(String name, Supplier<T> block) { return registry.BLOCKS.register(name, block); } private static <T extends Block> RegistryObject<T> register(String name, Supplier<T> block) { RegistryObject<T> ret = registerNoItem(name, block); registry.ITEMS.register(name, () -> new BlockItem(ret.get(), new Item.Properties().tab(ItemGroup.TAB_BREWING))); return ret; } } Full GitHub repository available here.   (Other minor problem(?):  I copied the methods getShape and getInteractionShape from net.minecraft.block.CauldronBlock and I'm getting these weird warnings. What's up with that? Do I need to worry about it?)  
    • Personally I use IForgeRegistryEntry#getRegistryName and then ResourceLocation#getNameSpace to get the id of the object.
    • you can get a block form a ResourceLocation, take a look at NBTUtil#readBlockState, do somthing like that
    • I am running forge version 1.16.5 36.1.31 on a server with a lot of mods and when a player refreshes the server list, it sends a long error in the server console. Additionally, the server list displays "Can't connect to server", despite refreshing and actually being able to connect to the server. here's the links to the logs: https://gist.github.com/WaffleTraits/83885b1539d5711fabff73a91924e665 https://gist.github.com/WaffleTraits/5ae78e6eaa330422bbc9f7226faf60ce Here's what's displayed in console when a player refreshes server listing: https://hastebin.com/ativexeyoy.properties server is running on ubuntu 20.04 and is using java 8 for this forge instance.
    • I kept getting this error whenever I tried joining my modded server I want to find a solution to this I checked every mod and it all matched Client : https://mclo.gs/Q39SSu5 server : https://mclo.gs/UO2kbDz
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.