WesleyE Posted March 6, 2013 Share Posted March 6, 2013 (edited) A few days back I stumbled on a Minecraft renderer that took a long time to calculate, but could generate some nice pictures from Minecraft maps. I thought that I could cut down the rendertimes by importing them into Houdini and could also work on my Python skills in Houdini at the same time. There are some realy nice projects out there that could use a better render engine than provided in-game, or the slow one I found. I've got the basics working, Houdini can now import the chunks, create the geometry and texture the blocks. The chunks are quite big (16x16x256 blocks) so I've build in some options to skip some chunks. The main problem that I'm facing right now is speed. The pieces in the pictures below are already 3.3 milion poly's, so I need to find a way to cleverly cull the poly's you won't ever see. If you guys have some tips on this, please share them Another problem is the texture filtering, is there an option to just keep the harsh edges in the textures that are in the game (Instead of filtering/blurring them). Next up is entity support, and different geometry types that one can find in the game. Let me know what you guys think. Edited March 7, 2013 by WesleyE 1 Quote Link to comment Share on other sites More sharing options...
edward Posted March 7, 2013 Share Posted March 7, 2013 Sounds like a fun project! Some rambling thoughts: If your blocks are opaque, backface culling is the way to go. Compute for each face of every block: dot(vector from the face center to your camera position, face normal). Only generate the faces that have a negative dot product. But really, you should just use point instancing. ie. create a point at the centre of each block and then delay load your blocks at render time. Your block geometry should consist of two SOPs: Box, followed by a Vertex (with cusp normal added) I've attached a simple example on these last two points. simplePtInstancing.hip 1 Quote Link to comment Share on other sites More sharing options...
sam.h Posted March 7, 2013 Share Posted March 7, 2013 One way to cut down on the amount of geo would be check the neighbors for each cell, if none of the neighbors are empty then it won't be visible to camera. Also I think you can set the filtering on the texture node in your shader to 'point' and that will retain the blocky textures Quote Link to comment Share on other sites More sharing options...
LEO-oo- Posted March 7, 2013 Share Posted March 7, 2013 Cool - like it! Quote Link to comment Share on other sites More sharing options...
WesleyE Posted March 7, 2013 Author Share Posted March 7, 2013 (edited) I manually create my own cubes with the Python functions (Manually creating vertexes, indices and faces) and submit them to the SOP a few blocks at the time, processing and rendering is quite quick. I figure that if I set instancing to full it would still need to 'build' the whole world at render time to allow for reflections and such? I'm now building an function to check for neighbouring blocks and to not draw faces when there is an opaque block next to it. Would save a lot of poly's when I only generate the 'hull'. I haven't found the point filtering mode, but it might not be available on an mantra surface shader. I'll take a look at the materials later and maybe create something myself. Edited March 8, 2013 by WesleyE Quote Link to comment Share on other sites More sharing options...
edward Posted March 8, 2013 Share Posted March 8, 2013 I figure that if I set instancing to full it would still need to 'build' the whole world at render time to allow for reflections and such? Even if it does, I would imagine it to be more efficient than generating it all in SOPs first and then sending it down to the renderer. I wouldn't rule it out without doing a test first since it's so simple to set up. Quote Link to comment Share on other sites More sharing options...
tjeeds Posted March 8, 2013 Share Posted March 8, 2013 Nice li'l project! Edward's right, using instancing is probably going to be your biggest speed gain here. You just need to have a color on your points and a single box as he described and it'll be a super quick render. Out of curiosity, why build a cube in Python? Quote Link to comment Share on other sites More sharing options...
WesleyE Posted March 8, 2013 Author Share Posted March 8, 2013 (edited) I figured (I'm was a indy game programmer before moving to VFX) that when I could submit the faces in batches, it would be a lot faster than to use a foreach or an copy sop. Edited March 8, 2013 by WesleyE Quote Link to comment Share on other sites More sharing options...
edward Posted March 9, 2013 Share Posted March 9, 2013 Note that Mantra might also multithread the construction. Doing it in Python will slow down right there. Quote Link to comment Share on other sites More sharing options...
Skybar Posted March 10, 2013 Share Posted March 10, 2013 Someone did it the other way around, bringing Houdini stuff into Minecraft: http://www.minecraftforum.net/topic/573759-houdini-to-minecraft/ Quote Link to comment Share on other sites More sharing options...
WesleyE Posted March 17, 2013 Author Share Posted March 17, 2013 (edited) Just had a little time to try the instance option. I fiddled with it and it seems that I would need to give up to much flexibility with the geometry. Instead I've multithreaded the generation of all the boxes to match some of the performance the instance option would gave me. For now, I've made it check the neighbouring pieces to only output the faces that are visible. Also got point filtering to work on the textures, and made it so that it can take the textures from the tiled map by UV instead of having to manually slice the texture map up in pieces. With all the optimalisations, this (16*16*256)*9 block only takes up 39000 points instead of around 2.3 milion. Thanks for all the input so far! Edited March 17, 2013 by WesleyE Quote Link to comment Share on other sites More sharing options...
edward Posted March 17, 2013 Share Posted March 17, 2013 Cool, nice to see your progress! Quote Link to comment Share on other sites More sharing options...
freaq Posted March 20, 2013 Share Posted March 20, 2013 this might help you to get rid of any unnescesary polygons: cull duplicate faces.hip Quote Link to comment Share on other sites More sharing options...
harryjoe Posted February 10, 2015 Share Posted February 10, 2015 (edited) I really appreciate the progress. And eagerly waiting for the outcome soon. Edited March 2, 2015 by harryjoe Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.