BlockRenderer

BlockRenderer

32.3k Downloads

Ability to render mobs.

mikuhl-dev opened this issue · 13 comments

commented

This is the feature that will complete the mod. We have these nice block renders for wikis but mob pages are lacking nice renders. This will even help the vanilla wiki because the new 1.11 mobs are lacking good renders as the people who made the good ones in blender have dropped off the face of the earth.

commented

@herbix's renderTo for Minecraft 1.8 implements this quite nicely.

commented

Just to add on to this, this would be awesome for us at the FTB Gamepedia who don't have time to create advanced renderings :O

commented

Would like an update on this!

commented

I've been busy with work and haven't really had time to work on any of my mods.

commented

Since mobs can come with different NBT and such, I would say pressing the render key while looking at the mob should render that specific one.

commented

@unascribed I figured out how to render entities like this:

            GlStateManager.enableColorMaterial();
            GlStateManager.pushMatrix();
            Float scale = height / (1 + entity.height); // Scale needs to be adjusted to always get a 512 sized image, not sure how to do that.
            GlStateManager.translate(width / 2, height / 2 + entity.height * scale / 2, 50.0F);
            GlStateManager.scale(scale, scale, scale);
            GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); // For some reason mobs are rendered upside down.
            GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F); // Ortho angle on y axis.
            GlStateManager.rotate(30.0F, 1.0F, 0.0F, 1.0F); // Ortho angle on x and z axis.
            entity.setRotationYawHead(0); // Minecraft gives mobs a slightly random head facing. Reset it.
            RenderHelper.enableStandardItemLighting();
            RenderManager rendermanager = mc.getRenderManager();
            rendermanager.setPlayerViewY(180.0F);
            rendermanager.setRenderShadow(false);
            rendermanager.renderEntity(entity, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F, false);
            rendermanager.setRenderShadow(true);
            GlStateManager.popMatrix();
            RenderHelper.disableStandardItemLighting();
            GlStateManager.disableRescaleNormal();
            GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
            GlStateManager.disableTexture2D();
            GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);

Need a whole GUI with options and stuff like to flip axis' because some mobs like Ender Dragon are backwards.

image

commented

It seems that the renders will have to be manually sized, because the bounding boxes are not accurate on lots of mobs.

commented

Cant you just increase the scale by 1 until it exceeds 512 pixels?

commented

You can't just ask the GPU how big something is. That isn't how it works.

commented
commented

Yes the game lags for a second, but usually you want to do renders for mobs on-demand, because there are many variables you might want to render, like dye, armor, etc.

commented

Due to the usage of the DataManager for entities, all permutations of entity properties can be iterated automatically. The game lagging for "a second" is extremely expensive when you start thinking about hundreds or thousands of renders.

If you were to PR this I'd probably merge it, I've stopped caring about Minecraft. Trying to present my concerns and explain why I think this is a bad approach.

commented

I did it myself. I just start from scale 0 and add 1 to the scale until the longest part of the read image reads more than 512 pixels, and then scale it down by one and that is the final image.