Jump to content

Minecraft Level Import in Houdini


WesleyE

Recommended Posts

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.

post-7460-0-09906500-1362610545_thumb.jp post-7460-0-20400300-1362610548_thumb.jp post-7460-0-49909600-1362611509_thumb.jp post-7460-0-35697100-1362612509_thumb.jp

Edited by WesleyE
  • Like 1
Link to comment
Share on other sites

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

  • Like 1
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 by WesleyE
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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!

post-7460-0-57696700-1363480719_thumb.pn post-7460-0-54554900-1363480722_thumb.pn

Edited by WesleyE
Link to comment
Share on other sites

  • 1 year later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...