I made somefink!

From: Lucy (X3N0PH0N)15 Nov 2012 21:56
To: ALL14 of 48
(just testing)
From: Mikee15 Nov 2012 22:05
To: Lucy (X3N0PH0N) 15 of 48
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
 
From: Mikee15 Nov 2012 22:07
To: Mikee 16 of 48
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
From: koswix15 Nov 2012 22:08
To: Mikee 17 of 48

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

From: af (CAER)15 Nov 2012 22:20
To: Mikee 18 of 48
Have you timed which parts are especially slow?

(and do you know about console.time() and console.timeEnd() for sub-millisecond timing accuracy?)
From: Mikee15 Nov 2012 22:48
To: af (CAER) 19 of 48
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
From: af (CAER)15 Nov 2012 22:49
To: Mikee 20 of 48
You might be able to judge colour matching better if you toned that background down a bit. To medium grey, for instance.
From: Mikee15 Nov 2012 22:52
To: Mikee 21 of 48
Hmm - 45 seconds to make that, on my laptop.

This model is 180 blocks high, though, which is far bigger than you'd normally build in minecraft.

15 seconds to produce this:

voxel3.jpg
From: Mikee15 Nov 2012 22:53
To: af (CAER) 22 of 48
Good point! :)
From: Mikee15 Nov 2012 22:57
To: ALL23 of 48
Awesome!! This came out much better than I was expecting...


voxel4.jpg
From: af (CAER)15 Nov 2012 22:58
To: Mikee 24 of 48
Something like that would be absolutely gigantic in Minecraft :S
From: Mikee15 Nov 2012 22:59
To: af (CAER) 25 of 48
Haha yeah :)

You could set up a base inside it!

http://www.mikeefranklin.co.uk/3d/harpoon.html
From: Mikee15 Nov 2012 23:01
To: Mikee 26 of 48
Mind you - with the half-blocks you can get in tekkit/red power, you could have it at the same quality but far smaller
From: Mikee16 Nov 2012 11:07
To: ALL27 of 48
Made some pretty huge changes to the way it works..


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

It should now be REALLY fast in comparison - about 10 seconds

Edit: It seems to depend on how much memory you have available. On lower specs it seems to stop at ~80% and start crawling. If you have enough memory it does it all verrry fast.
EDITED: 16 Nov 2012 11:26 by MIKEE
From: Mikee16 Nov 2012 12:14
To: Mikee 28 of 48
http://www.mikeefranklin.co.uk/3d/goblin.html

:D


Gotta find some new models now..

I realised that my thing only works with a single texture at the moment, too. I need to change it to support multiple textures.. :)
From: Mikee16 Nov 2012 16:54
To: ALL29 of 48
Now improved so it still works if you have multiple textures on a model...

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

(the Dungeon Defenders ancient dragon has a texture on his head and a texture on his body)
From: Lucy (X3N0PH0N)16 Nov 2012 17:00
To: Mikee 30 of 48
Works like a charm here now.
From: Mikee16 Nov 2012 20:01
To: ALL31 of 48
I've made a new technique..

Once the texture is loaded in, I run blurring on it before doing anything else.

The result is far far superior..

The only issue left to deal with is that at higher resolutions chrome runs out of memory and the whole thing slows down considerably. I don't think there's any real fix to this - v8 engine has a memory limit built in.

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

(may pause loading half way through on lower spec machines)
EDITED: 16 Nov 2012 20:02 by MIKEE
From: Lucy (X3N0PH0N)16 Nov 2012 20:02
To: Mikee 32 of 48
Get a proper browser ;)
From: Mikee16 Nov 2012 20:03
To: Lucy (X3N0PH0N) 33 of 48
Pftcha!