kiou.23 Posted March 24, 2021 Posted March 24, 2021 (edited) 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: Edited March 24, 2021 by kiou.23 Quote
vemerion Posted March 24, 2021 Posted March 24, 2021 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. 1 Quote
kiou.23 Posted March 24, 2021 Author Posted March 24, 2021 On 3/24/2021 at 6:38 PM, 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. Expand 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! Quote
kiou.23 Posted March 26, 2021 Author Posted March 26, 2021 still unsolved, I've looked at the code for hours and I have absolutelly no clue what I could do. I'd appreciate some help Quote
Beethoven92 Posted March 26, 2021 Posted March 26, 2021 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 1 Quote Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port
kiou.23 Posted March 26, 2021 Author Posted March 26, 2021 (edited) On 3/26/2021 at 1:18 AM, 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 Expand 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 March 26, 2021 by kiou.23 Quote
lupicus Posted March 26, 2021 Posted March 26, 2021 (edited) 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 March 26, 2021 by lupicus Quote
kiou.23 Posted March 26, 2021 Author Posted March 26, 2021 (edited) On 3/26/2021 at 6:07 PM, 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) Expand 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 March 26, 2021 by kiou.23 Quote
lupicus Posted March 26, 2021 Posted March 26, 2021 (edited) 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 March 26, 2021 by lupicus 1 Quote
kiou.23 Posted March 26, 2021 Author Posted March 26, 2021 On 3/26/2021 at 10:44 PM, 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. Expand Thank you! the uv thing is odd, I got the files exported from vectary and it rendered fine in the viewer. Quote
lupicus Posted March 27, 2021 Posted March 27, 2021 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 ] } } } Quote
kiou.23 Posted March 27, 2021 Author Posted March 27, 2021 On 3/27/2021 at 12:15 AM, 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 ] } } } Expand 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! Quote
Recommended Posts
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.