104 comments

[ 2.6 ms ] story [ 171 ms ] thread
I made this demo using http://www.pixijs.com/

Something I'm really happy with is the psuedo-3d effect on the cat using a displacement map.

I took the cat sprite (http://dn.ht/picklecat/mesmercat.png) and made a "depth map" (http://dn.ht/picklecat/mesmercatdisplacement.jpg) where white is closest and black is furthest. This information is used to determine how far to move the underlying pixels. It's enough to give a subtle illusion of depth.

How did you create the depth map?
He did it in Illustrator. I find his work fascinating.
Would love to hear more about how you generated the depth map - that's super cool.
I'm glad you asked! :)

I created it in Adobe Illustrator using a gradient mesh: http://i.imgur.com/kuuFVO2.png

Illustrator's gradient mesh tool lets you create a grid of points where you can choose a colour for each point. I overlayed the grid onto the sprite and estimated the distance at each point.

That's a really clever solution!
Is that something one can do with Inkscape as well ?
You mean each point?That's really tough work.
He didn't have to color in every single pixel. The gradient mesh lets you create a loose grid of Bezier curves, with a color set at each intersection; Illustrator will interpolate between them.
I was wondering how you did that, actually - well done!
Yeah I came here to ask how you did the faux-3d cat. It's very subtle, but effective as hell. I thought you were using some kind of fancy parallax shader, but I can see how a displacement map can approximate the same thing. Awesome!
I'd like to congratulate you for the fact that this has higher production values than the majority of WebGL applications out there.
> I'd like to congratulate you for the fact that this has higher production values than the majority of WebGL applications out there.

1. Doesn't crash video card driver. 2. Doesn't crash browser. 3. Doesn't show empty tab. 4. Doesn't cause 100% CPU usage. 5. Doesn't hang browser forever.

I am on mobile with a 3 year old iphone 5.

Works.

Well, I know what I'm doing for the rest of the day.

(if it wasn't obvious, playing around with pixijs!)

I'll spend my day looking at pickles, thank you very much.
Great work, silly but ingenious. For some reason I find the "depth map" creepy to look at on its own.
It looks like a ghost, or a 'soul'--that which brings life to an object. :)
really great. Please write blog about this
+1 for Pixi.js. Pixi.js is awesome.
Love it. Made me laugh.
It's not pointless. Demos like these help others discover libraries and frameworks. I did not know of pixiejs and it's something I need for work. Having the cat and pickles render in my cheap android device was proof enough to try it out. Thanks for posting!
oh wow you weren't kidding
Lazerhawk and tripping cat - perfect.
That cat is definitely on something
Uncaught Error: This browser does not support webGL. Try using the canvas renderer :( :( :( :( :(
Ah bummer, WebGL is pretty widely supported but still not quite 100% -- http://caniuse.com/#feat=webgl
I thought PixiJS was supposed to fall back to canvas if WebGL isn't enabled?
It does if you specify the `autoDetectRenderer`, rather than `WebGLRenderer` or `CanvasRenderer`.
Yep, pixijs can fall back to a canvas renderer. I have a feeling it would be too slow unless I disabled all the effects.
Is it just me, or is the HTML file incomplete? I didn't see anything, so I looked at the source and there's no canvas tag and the file abruptly ends after the GA script tag: https://web.archive.org/web/20151130010039/http://i.imgur.co...
Browsers will parse all kinds of edge cases. What browser are you using?

Renders fine in Chrome 46 on OSX 10.10

What's the music from? Cool site.
OP, you should make a silly site where people can combine faces (with depth map) and a floating object. Let the internet hordes run with it from there.
users should be able to paint a depth map
I did not know my weekend hadn't completed until I saw this.
@dhotson - please be sure to auction this site for art basel :)
Scrubbing my eyes with my toothbrush ... please don't down vote me ... the sting from close-up is painful enough.
My 11 year old likes it, so I think you have succeeded in creating the next meme :-)
(comment deleted)
I just spent somewhere around five-ten minutes staring at this.

I may have to rethink my life.

My 1 year old daughter loves it. I think you have a meme!
That's an interesting way to get background music. Wastes bandwidth on the video though. <iframe src="https://www.youtube.com/embed/UsMewmMTA_c?autoplay=1"></ifra...
But lets you sidestep all of the hosting costs and probably the majority of copyright issues.
Not really, a youtube video with a static image is VERY close to an MP3's size.
I'm seeing 3.9 MB for audio and 7.8 MB for the video.
I wasn't sure HN was gonna deliver this year. But, now I know to continue reading for another year.