Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to render mobs. #12

Open
mikuhl-dev opened this issue Dec 2, 2016 · 13 comments
Open

Ability to render mobs. #12

mikuhl-dev opened this issue Dec 2, 2016 · 13 comments

Comments

@mikuhl-dev
Copy link

mikuhl-dev commented Dec 2, 2016

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.

@xbony2
Copy link
Contributor

xbony2 commented Dec 11, 2016

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

@mikuhl-dev
Copy link
Author

Would like an update on this!

@unascribed
Copy link
Owner

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

@mikuhl-dev
Copy link
Author

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
Copy link
Author

mikuhl-dev commented Aug 10, 2018

@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
Copy link
Author

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

@mikuhl-dev
Copy link
Author

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

@unascribed
Copy link
Owner

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

@mikuhl-dev
Copy link
Author

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.

@unascribed
Copy link
Owner

unascribed commented Jul 18, 2019 via email

@mikuhl-dev
Copy link
Author

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.

@unascribed
Copy link
Owner

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.

@tomodachi94
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants