Jump to content

[1.10.2] What are IBakedModels?


Jimmeh

Recommended Posts

Hey there,

 

So I'm trying to understand what IBakedModels are and why/where they should be used. I've searched these forums for threads relating to this, and the best explanation I can find so far of what they are, are that they replaced ISmartItemModel/ISmartBlockModel, but I don't even know what those are either. haha.

 

Let's say I have a CustomBlock, that extends Block. Would an IBakedModel replace CustomBlock, or would it replace the TileEntity custom class I would make to give to CustomBlock? Or perhaps it replaces the TESR that I would create for those?

 

I looked through the Forge Github docs and there was nothing there, and I've asked Google a bit and can't find too much there either. Can anyone offer a detailed explanation of what these really are and in what cases/why you would use these? What do they do? I've heard that it can replace TESR's if I'm needing something as simple as that "display"/"render" needing to only be rendered on block changes rather than every frame/tick. But I don't understand how to take that concept and run with it.

 

Any guidance would be greatly appreciated! :D

Link to comment
Share on other sites

IBakedModel

is a (usually) compact representation for a model that can then be uploaded to the GPU. It is basically the parsed and optimized form of a model, which was originally specified in for example a JSON file or an OBJ.

In practice a baked model contains a List of

BakedQuad

s, which contain the raw vertex data for all quads in the model. When coming from older Minecraft versions (≤ 1.7.10) they replace

ISimpleBlockRenderingHandler

.

 

The key difference between

IBakedModel

and "a TESR" (which can basically be anything) is that for rendering the world Minecraft combines all the baked models for a 16x16x16 chunk into one and uploads them as a whole to the GPU. Then when it wants to render that part, it does not have to re-upload the data every frame. A TESR on the other hand is just called to "do something" every single frame, which is usually some inefficient model rendering, but which is needed if you want actual moving parts in your model.

 

Thank you very much. That's the first really in-depth explanation I've seen.

 

Here's why I ask. I'm using a TESR to do this: https://gyazo.com/35419d1418cb792f1e48bf69810cabe4

I've been told that this can be done more efficiently with an IBakedModel, but that's all I knew. I wasn't sure if the block would be an IBM, or the staff that's set "into" it. I couldn't find any tutorials on how to actually implement it correctly, etc. Would you happen to know of any resources that would offer a good explanation further into this, or perhaps would be willing to walk me through it or give me a general direction?

Link to comment
Share on other sites

Use a modeling software such as Blender to create your model and export it in a supported format (currently OBJ, B3D and Mojang's JSON). You can then load your model like you do any other block model (look at vanilla for examples).

 

Hmmm, alright. I'll go look through vanilla to see if I can figure this out. I'll more than likely end up back on this thread, but we'll see how it goes xD

Link to comment
Share on other sites

You may have to combine models as well, which is doable,

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I already explained to Draco how to do this here: http://www.minecraftforge.net/forum/index.php?topic=42539.msg226463#msg226463.

And won't rewrite all explanations here, but if you have any questions, please post them here and not there.

Link to comment
Share on other sites

I already explained to Draco how to do this here: http://www.minecraftforge.net/forum/index.php?topic=42539.msg226463#msg226463.

And won't rewrite all explanations here, but if you have any questions, please post them here and not there.

 

Okay, I skimmed through that and it seemed like it might help with this. I'll give this a shot by tomorrow afternoon (currently 4 a.m. .-.). Thank you!

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.



×
×
  • Create New...

Important Information

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