Jump to content

[1.12.2] Rendering an Entity with an OBJModel


Recommended Posts

Hi everyone,

I've been porting a mod from 1.7.10 which had no problem rendering entities with models imported from .obj files; it just called renderAll() and that was that.

I didn't find something similar in 1.12.2 so have naively written my own renderer, which looks like this (renderWithNormal function): https://github.com/fredtargaryen/ExRollerCoaster/blob/1.12.2/src/main/java/erc/renderer/ModelRenderer.java

Here's the result: https://imgur.com/a/EJbBQ31

So it looks like if it's going to render a face, it won't render any faces that share an edge with that face... the problem is probably deeper than just that though.

Things I've considered so far:

  • Invalid .obj file: the .obj worked with 1.7.10, and importing it in Blender shows all the triangles.
  • Bad renderer: I have copied the rendering code from decompiled Forge 1.7.10, and as far as I can see the model was the same. Personally I can't see why my naive renderer wouldn't work.
  • Model importing wrong: the OBJModel object has the same number of faces as the .obj file has. There might be some kind of check the importing code does which changes point coordinates; I haven't checked whether all the values are the same yet because that could be a long, tedious process.

So my guess is there's some quirk with how 1.12.2 does graphics, that may have led to that renderAll system being removed? Though of course I am open to the suggestion that my renderer's bad.

Anyone know what's going on here?

Thanks for reading.

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.