CodingI made somefink!

 

Press Ctrl+Enter to quickly submit your post
Quick Reply  
 
 
  
 From:  Mikee  
 To:  ALL
40063.1 
I'm not too sure why I made this, but I did.


It takes any 3d model (well, in obj format), voxelizes it, and turns it into minecraft blocks (attempts to colour match).

Looks a bit odd, but I'll make it so I can define which blocks to use. I'm thinking about also making a quick 'painter' for it, so you can very quickly airbrush colours in.

Here's a "live" example ("live", because it takes about a minute to actually process. looks broken..!)

http://www.mikeefranklin.co.uk/3d/gob.html


I'm sure there's probably tools out there that already do it - binvox kinda does, but not very well. I'll probably look to converting it to a minecraft friendly format next.

Attachments:

0/0
 Reply   Quote More 

 From:  JonCooper  
 To:  Mikee     
40063.2 In reply to 40063.1 
looks quite cool, after I understood it was upside down and I could move it about
I'd like a little pane that shows what blocks are on each level, so I had a map to build from

Jon
0/0
 Reply   Quote More 

 From:  Mikee  
 To:  JonCooper     
40063.3 In reply to 40063.2 
Yeah that'd be pretty cool - should be easy enough to implement.

Screw building it all manually, though!! You're craaazzy. Get ComputerCraft and program turtles to do it for you! :)
0/0
 Reply   Quote More 

 From:  JonCooper  
 To:  Mikee     
40063.4 In reply to 40063.3 
problem is; we have been finding minecraft a little dull recently, if you know what you're doing it's not hard to go from new virgin world to fully armoured and able to beat everything quite quickly - building strange and wonderful things is about all that's left 

Jon
0/0
 Reply   Quote More 

 From:  Mikee  
 To:  JonCooper     
40063.5 In reply to 40063.4 
tbh I think you're missing out by not installing mods. Some of the new stuff out there is far far better than vanilla minecraft - for example, the new "feed the beast" pack. 
0/0
 Reply   Quote More 

 From:  af (CAER)  
 To:  Mikee     
40063.6 In reply to 40063.1 
IT doesn't ever actually finish doing anything here, even leaving it for a few minutes (MacBookPro, 2.4GHz Core 2 Duo, Chrome... whatever the latest one is)
caerphoto_sig.png
0/0
 Reply   Quote More 

 From:  Lucy (X3N0PH0N)  
 To:  Mikee     
40063.7 In reply to 40063.1 
Similar to Andy, crashed firefox here (or at least ties it up so bad it thinks it's crashed. Wasn't using any CPU though so I don't think it was doing anything...?). Left it for a few minutes but nothing changed.

(FF18)
0/0
 Reply   Quote More 

 From:  Mikee  
 To:  ALL
40063.8 
Ah sorry, I've only ever looked at it in windows chrome (a proper browser).

I can imagine firefox has some pretty big issues with it - it does a LOT of processing, and it's all without any timeout/break in the code.

I'll split it out into timeouts and whatnot eventually to make it smoother ;-)
0/0
 Reply   Quote More 

 From:  JonCooper  
 To:  Mikee     
40063.9 In reply to 40063.5 
we have been trying out some mods, quite liked tekkit, enough to rent a server to run it on, it crashed after about 2 months and the admin peeps said "yes, they do that a lot" :(  ~~  (I do not rent a server there any more)

Jon
0/0
 Reply   Quote More 

 From:  Mikee  
 To:  JonCooper     
40063.10 In reply to 40063.9 
How very odd :)

I'm part of a small, relaxed, whitelisted server which is currently running tekkit, although we'll be moving to "ftb" in the next couple of months. You're welcome to join there!
0/0
 Reply   Quote More 

 From:  Mikee  
 To:  ALL
40063.11 
http://www.mikeefranklin.co.uk/3d/bishop.html

Maybe that'll work slightly better for people - although this one takes FOREVER to load, although I added a counter so you can see how long..

I guess it's time to optimize it all ;-)
0/0
 Reply   Quote More 

 From:  af (CAER)  
 To:  Mikee     
40063.12 In reply to 40063.11 
Yeah it could probably do with some optimisation - even in Chrome on my Windows PC (which is quite a bit faster than my Mac) it still gets the CPU fan going and slows the entire browser down while it loads (which takes ages).

(and then once it's actually loaded it runs perfectly smooth at 60fps)
caerphoto_sig.png
0/0
 Reply   Quote More 

 From:  Mikee  
 To:  af (CAER)     
40063.13 In reply to 40063.12 
Refresh now and it should be very quick in comparison.

This is a slightly dumber version, though. For each face in the mesh it's just picking the center pixel and matching the colour of that against minecraft textures. Not ideal, but much faster. Probably good enough  for what I need.

Next I think I should make a painting tool for it, but make it so you can very very quickly just brush over big sections to change their texture, instead of having to slowly click individual blocks.
0/0
 Reply   Quote More 

 From:  Lucy (X3N0PH0N)  
 To:  ALL
40063.14 
(just testing)
0/0
 Reply   Quote More 

 From:  Mikee  
 To:  Lucy (X3N0PH0N)     
40063.15 In reply to 40063.14 
Colours are pretty poop..

I need to find a better way to do this.

Currently:

For every cube:

1) Get the face it represents from the original model

2) get the middle pixel of that triangle

3) change it like this:

3.1) convert to hsv
3.2) color.v += 2;
3.3) color.v = (color.v - 50) * 1.1 + 50; // make the light colours lighter, the dark colours darker
3.4) color.v = Math.max(0, Math.min(color.v, 100)); // make sure we're still in range
3.5) color.s = Math.sin(1-(Math.abs(color.s-50)/50)) * 120; // increase the saturation of colours that are 'average saturation'
3.6) color.s = Math.min(100, color.s); // put saturation back in range

4) Match the new colour against a colour from a minecraft block

5) Map the new texture onto the cube
 
0/0
 Reply   Quote More 

 From:  Mikee  
 To:  Mikee     
40063.16 In reply to 40063.15 
I guess I need to write some kind of algorithm to 'expand' colours.

For example:

For any block, if there's no block around it with the same material being used, change the texture to the most common material of each of its neighbours.

I need to make sure I can smooth them out using tricks like that
0/0
 Reply   Quote More 

 From:  koswix  
 To:  Mikee     
40063.17 In reply to 40063.15 

Doesn't work. How dare you not support my 7 year old laptop? :C

 

 

 

                                                
                                                
                                                
                           ▪                    
             ┌────┐    ┌────┐                      
          │    │    │    │ ▪                    
          │    └────┘    │                      
          │   ──┐  ┌──   │ ▪                    
   ┌──────┤    ▪    ▪    │                      
  ┌┘      │              │ ▪                    
┌─┤       └──┐  │  │  ┌──┘                      
│ │          │ ││  ││ │   ┌─┐                   
│ │          └─┼┤  └┴─┴───┘ │                   
│ │           ─┘│           │                   
│ │   ┌──────┐  └┬──────────┘                   
  │   │      │   │                              
  │   │      │   │                              
  └───┘      └───┘                              
If Feds call you and say something bad on me, it may prove what I said are truth, they are afraid of it.

 

 

 

0/0
 Reply   Quote More 

 From:  af (CAER)  
 To:  Mikee     
40063.18 In reply to 40063.15 
Have you timed which parts are especially slow?

(and do you know about console.time() and console.timeEnd() for sub-millisecond timing accuracy?)
caerphoto_sig.png
0/0
 Reply   Quote More 

 From:  Mikee  
 To:  af (CAER)     
40063.19 In reply to 40063.18 
Yeah I've used it a bit - I'll do some proper profiling soon.

I've made a few tweaks to the colour matching. The results are far better, but I've had to sacrifice a little bit of speed.

It's certainly looking better. I could still do with a bit more smoothing on the colours, but far better than it was before...

voxel2.jpg
0/0
 Reply   Quote More 

 From:  af (CAER)  
 To:  Mikee     
40063.20 In reply to 40063.19 
You might be able to judge colour matching better if you toned that background down a bit. To medium grey, for instance.
caerphoto_sig.png
0/0
 Reply   Quote More 

Reply to All  
 

1–20  21–40  41–48

Rate my interest:

Adjust text size : Smaller 10 Larger

Beehive Forum 1.5.2 |  FAQ |  Docs |  Support |  Donate! ©2002 - 2024 Project Beehive Forum

Forum Stats