BlockRenderer icon indicating copy to clipboard operation
BlockRenderer copied to clipboard

Ability to render mobs.

Open mikuhl-dev opened this issue 8 years ago • 13 comments

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.

mikuhl-dev avatar Dec 02 '16 05:12 mikuhl-dev

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

xbony2 avatar Dec 11 '16 16:12 xbony2

Would like an update on this!

mikuhl-dev avatar Jul 25 '18 02:07 mikuhl-dev

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

unascribed avatar Jul 25 '18 02:07 unascribed

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.

mikuhl-dev avatar Jul 30 '18 19:07 mikuhl-dev

@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

mikuhl-dev avatar Aug 10 '18 17:08 mikuhl-dev

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

mikuhl-dev avatar Aug 11 '18 03:08 mikuhl-dev

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

mikuhl-dev avatar Jul 16 '19 04:07 mikuhl-dev

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

unascribed avatar Jul 17 '19 17:07 unascribed

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.

mikuhl-dev avatar Jul 18 '19 13:07 mikuhl-dev

readPixels is an extremely slow operation and this would make bulk renders unacceptably slow.

-------- Original Message -------- On Jul 18, 2019, 06:32, Michael wrote:

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.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

unascribed avatar Jul 18 '19 14:07 unascribed

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.

mikuhl-dev avatar Jul 18 '19 14:07 mikuhl-dev

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.

unascribed avatar Jul 18 '19 16:07 unascribed

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

tomodachi94 avatar Sep 17 '23 04:09 tomodachi94