Posted August 28, 20187 yr Hey, I'm trying to add my own complex models to the game, but I'm not sure how to use the Tessellator, are there any good tutorials/guides/books available for me to read up on? Thanks Edited August 29, 20187 yr by GooberGunter
August 31, 20187 yr On 8/29/2018 at 2:47 AM, GooberGunter said: Hey, I'm trying to add my own complex models to the game, but I'm not sure how to use the Tessellator, are there any good tutorials/guides/books available for me to read up on? Thanks Directly interacting with the tesselator & buferbuilder is probably not what you want to do unless your already pretty experienced in OpenGL and advanced 3D rendering. What are you trying to achieve exactly? What do you mean by complex models and why & where & when will they be used? About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
August 31, 20187 yr Author Specifically, I wanna use Wavefront .obj models for custom mobs. My goal is to get familiar with 3D rendering. All I really need to know is how 3D rendering is done. From what I’ve seen it looks like the tessellator just needs the vertices of the model for correct positioning and then the normals of the faces to render the shape of the model. I’m not sure if that’s how it works, but I haven’t checked out too much code yet. Is this right?
August 31, 20187 yr 35 minutes ago, GooberGunter said: Specifically, I wanna use Wavefront .obj models for custom mobs. My goal is to get familiar with 3D rendering. All I really need to know is how 3D rendering is done. From what I’ve seen it looks like the tessellator just needs the vertices of the model for correct positioning and then the normals of the faces to render the shape of the model. I’m not sure if that’s how it works, but I haven’t checked out too much code yet. Is this right? You definitely don't need to deal with the tesselator & bufferbuilder for this, look at the Forge Animation API, or you could just inject the models you need into the model registry & render them normally with an entity renderer. Example of injecting models https://github.com/Cadiboo/WIPTechAlpha/blob/fbf25447cd02b3dc4fe4fece749c3558f9342f3f/src/main/java/cadiboo/wiptech/EventSubscriber.java#L464-L509 (Right below that code is a good example of why not to use the tesselator) Example of rendering an entity with the injected models https://github.com/Cadiboo/WIPTechAlpha/blob/master/src/main/java/cadiboo/wiptech/client/render/entity/EntityPortableGeneratorRenderer.java Edited August 31, 20187 yr by Cadiboo About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
August 31, 20187 yr 46 minutes ago, Cadiboo said: Forge Animation API This doesnt support OBJ models. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
September 1, 20187 yr Author All im really looking for is a guide to how the buffer builder works. I’ve been looking at some sample code from other mods as well as checking some LWJGL tutorials, but I’m still unsure on how to use it.
September 2, 20187 yr BufferBuilder is just a way to specify a vertex collection for OpenGL to render. A vertex is ultimately just a collection of data OpenGL uses to draw things. At the very minimum it needs the position in world-space to render anything at all. You start by specifying a format and a draw mode. The draw mode specifies what the vertices mean(ex. 4 means a quad with GL_QUADS) and the format specifies the way the data is aligned in each vertex(ex. POSITION_TEXTURE_COLOR means that each vertex contains 3 floats that specify position, followed by 2 floats that specify the uvs for the texture followed by 4 floats that specify the color). The only thing that might confuse you are BLOCK(3 position, 4 color, 2 texture, 2 lightmap) and ITEM(3 position, 4 color, 2 texture, 3 normal, 1 padding) formats. Then you specify the vertices based on the format you've selected. You do that by calling the respective methods. For example to specify the position you would call BufferBuilder#pos. Keep in mind that the order must be the same as the order defined by the format(ex. if the format is POSITION_TEXTURE_COLOR the vertex definition would be pos(...).tex(...).color(...)). Then you end the definition of each vertex with BufferBuilder#endVertex similar to how you end sentences with a dot. These methods can conviniently be chained to compact the code. So you can do bufferbuilder.pos(...).tex(...).color(...).normal(....).endVertex(); Once you've specified all the vertices needed for your drawing you finally call Tessellator#draw. Knowing that you can easily adapt the BufferBuilder to render a wavefront object. Parse your object in a way that gives you a collection of vertices each containing the data you need(position, uvs, normals) and then simply iterate over the collection adding each vertex to the buffer. As an example here is the way I parse the wavefront into a collection of vertices and upload those vertices to the buffer. As a bonus here is the way I use a FastTESR to render the parsed wavefront into the buffer provided by the FastTESR(with matrix transformations). I hope my explanation and the examples provided help you.
September 2, 20187 yr 23 minutes ago, GooberGunter said: All im really looking for is a guide to how the buffer builder works. I’ve been looking at some sample code from other mods as well as checking some LWJGL tutorials, but I’m still unsure on how to use it. You put vertexes into it and that creates a face, which is assigned a texture via the points you specify as floats as a 0-1 scale by the bound texture. Which is bound from Minecraft.getMinecraft().getRenderManager().renderEngine.bindTexture(resource); Or an instance of RenderManager/TextureManager that you are provided. You call BufferBuilder.begin(VertextFormat) then bufferbuilder.pos().tex().normal().endVertex() for all of the vertexes you need. Then finally call tesselator.draw. If you need an instance of these, use Tesselator.getInstance() and then to get the BufferBuilder instance use Tesselator#getBuffer(). VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
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.