Jump to content

[1.12] Render 3D model onto screen


Spaceboy Ross

Recommended Posts

Depends on how you got it to load.

If it is a block/item model then you can use RenderItem#renderItemAndEffectIntoGUI.

If it is a custom model with a custom loader it is up to you to upload each and every vertex to the BufferBuilder.

It also depends on where you want to do that from. If it is your own GUI then there are no problems. However if you just want it rendered somewhere on the screen at all time you will need to use an event. RenderGameOverlayEvent will do fine.

Link to comment
Share on other sites

As far as I know OBJLoader is a custom model loader provided by forge designed to create block/item models from a wavefront file. If you are using OBJLoader then you must render your thing as an item. You could in theory bake the IModel you get from the loader yourself and later render it similar to how RenerItem#renderItemModelIntoGUI does it. That would be your example. But you would need to use ModelBakeEvent to bake your model first. And then you would need to fully mimic the code of RenerItem#renderItemModelIntoGUI(which expects an ItemStack btw so you would need to fix that too). It might be easier to use either a custom dummy item(don't show it in the creative menu and it will be completely hidden in the game) or a custom model loader, wavefront isn't too complicated - for example here is mine simple .obj loader and vertex uploader.

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.

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

Announcements



×
×
  • Create New...

Important Information

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