Posted November 21, 201212 yr Hey guys. Anyone knows a good and/or easy way to get a render of a block to use as illustration(in my case, for my Wiki)? I'd like to have an image of each of my mod's blocks seen from a corner(you know, when the block turns into a hexagon), and only it, with a transparent background. Basically, this: Is there some sort of app that does that?
December 7, 201212 yr This is how you do it, btw, the image will be upside down, but that's easy to fix in any image viewing software. Oh, and do this after the world is loaded with the sun up for the best lighting. When I did this, I bound it to a key, the screen will flash. You will probably have to adjust the rotation, this one is most probably wrong, this was off the top of my head glPushAttrib(GL_ALL_ATTRIB_BITS); glPushMatrix(); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); IntBuffer glFrameBuffer = BufferUtils.createByteBuffer(Minecraft.getMinecraft().displayWidth * Minecraft.getMinecraft().displayHeight * 4).asIntBuffer(); BufferedImage bufferedImage = new BufferedImage(Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight, BufferedImage.TYPE_INT_ARGB); glEnable(GL_LIGHTING); glTranslatef(220f, 150f, 0f); glScalef(100f, 100f, 100f); glRotatef(90, 0.0F, 1.0F, -1.0F); ForgeHooksClient.bindTexture(Block.stone.getTextureFile(), 0); Minecraft.getMinecraft().renderGlobal.globalRenderBlocks.useInventoryTint = true; Minecraft.getMinecraft().renderGlobal.globalRenderBlocks.renderBlockAsItem(Block.stone, Color.WHITE.getRGB(), 1.5F); glPixelStorei(GL_PACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glReadPixels(0, 0, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, glFrameBuffer); int array[] = new int[Minecraft.getMinecraft().displayWidth * Minecraft.getMinecraft().displayHeight]; glFrameBuffer.get(array); bufferedImage.setRGB(0, 0, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight, array, 0, Minecraft.getMinecraft().displayWidth); File file = new File("C:/BlockPics"); file.mkdirs(); file = new File("C:/BlockPics/" + Block.stone.getBlockName() + ".png"); try { file.createNewFile(); ImageIO.write(bufferedImage, "png", file); } catch (IOException ex) { FMLLog.getLogger().log(Level.SEVERE, "Error Saving File!", ex); } glPopMatrix(); glPopAttrib();
January 21, 201312 yr Author Well, took me long enough to actually try this and... 2013-01-21 21:05:02 [iNFO] [sTDERR] java.lang.NullPointerException 2013-01-21 21:05:02 [iNFO] [sTDERR] at org.lwjgl.opengl.GL11.glPushAttrib(GL11.java:2587) 2013-01-21 21:05:02 [iNFO] [sTDERR] at Mole.common.world.MolecraftWorldGenerator.renderBlockForWiki(MolecraftWorldGenerator.java:191) 2013-01-21 21:05:02 [iNFO] [sTDERR] at Mole.common.world.MolecraftWorldGenerator.generate(MolecraftWorldGenerator.java:41) 2013-01-21 21:05:02 [iNFO] [sTDERR] at cpw.mods.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:90) 2013-01-21 21:05:02 [iNFO] [sTDERR] at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:259) 2013-01-21 21:05:02 [iNFO] [sTDERR] at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1258) 2013-01-21 21:05:02 [iNFO] [sTDERR] at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:153) 2013-01-21 21:05:02 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:310) 2013-01-21 21:05:02 [iNFO] [sTDERR] at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:84) 2013-01-21 21:05:02 [iNFO] [sTDERR] at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:100) 2013-01-21 21:05:02 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:458) 2013-01-21 21:05:02 [iNFO] [sTDERR] at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16) ...yea. This didn't really work. =/ Welp, guess I can start learning some Blender. Won't do any bad, I suppose.
January 22, 201312 yr Author In case anyone's wondering, here's the result with Blender: https://raw.github.com/pro-mole/molecraft/master/resources/wiki/block_dirtstone.png[/img] Yes, it's basically dirt-colored stone. But there we go. I'm thinking of making a tutorial for this, just gotta reorganize the steps I took from 3 different tutorials. Also, work on that other tutorial I was planning to write about extracting items with modded tools. Anyhow, thanks a bunch, y'all.
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.