News for hackers. Stuff that matters.
Re:Show HN: Primitive for macOS by fogleman on Tuesday November 15, 2016 @09:54AM (#12958451)
About two months ago I shared my "primitive" project and it was well received: https://news.ycombinator.com/item?id=12539109

As a result, I decided to follow through and make more of it. So today I am announcing Primitive for macOS, now available on the Mac App Store.

The core is still implemented in Go. The GUI is written in Objective-C (haven't bothered to learn Swift yet!) and communicates with the Go process over stdin/stdout via NSTask and NSPipe. The rendering is done on the front-end; the backend just sends shape coordinates and such.

I spent a lot of time fleshing out the GUI layout to make it as simple yet powerful as possible. I hope you find it to be intuitive and I hope that you are pleased with the resulting images. I look forward to seeing what people do with the app. :)

Let me know if you have any questions!

Re:Show HN: Primitive for macOS by azinman2 on Tuesday November 15, 2016 @01:36PM (#12960834)
Very cool! Really beautiful output.

Curious why you're using pipes to communicate when you can use CGO to make the go stuff it's own static C library and communicate bidirectionally that way? Granted it's a bit more complex than that sounds (I've did this to bring v.io to iOS), but I'd figure that'd still be easier than the alternative?

Re:Show HN: Primitive for macOS by fogleman on Tuesday November 15, 2016 @01:37PM (#12960855)
Honestly didn't even think of that. Might have to look into it.
Re:Show HN: Primitive for macOS by AsyncAwait on Tuesday November 15, 2016 @02:44PM (#12961483)
Aren't you limited then to C datatypes?
Re:Show HN: Primitive for macOS by icebraining on Tuesday November 15, 2016 @03:44PM (#12962037)
A pipe transmits bytes. You can transmit bytes in C datatypes, hence they're equivalent. Whatever serialization is used right now can be reused.
Re:Show HN: Primitive for macOS by azinman2 on Wednesday November 16, 2016 @01:01AM (#12964868)
Or even better, actual bools and strings like a real API.

I don't know what the Go library looks like in terms of an API, but the pipes are already requiring serialization. This at least makes that hookup slightly easier, although CGO bridge has some overhead to it, so it wouldn't completely surprise me if a FIFO unix buffer was in fact faster especially if there's serialization in both situations.

Re:Show HN: Primitive for macOS by SuperPaintMan on Tuesday November 15, 2016 @07:13PM (#12963537)
I made some videos using primitive + ffmpeg a few months ago, glad to see it's still being developed!

https://theblackbox.ca/blog/primitive-triangles/

Awesome, I see you've added new features too. There goes my evening. A suggestion for video, allow loading the shape data for the previous frame and use that as a starting point. Could bring you closer to real time processing :)

Re:Show HN: Primitive for macOS by rapind on Tuesday November 15, 2016 @09:53PM (#12964169)
Love the use of the old Netscape animated logo.
Re:Show HN: Primitive for macOS by SuperPaintMan on Tuesday November 15, 2016 @10:19PM (#12964304)
Thanks, used it a few other times. Checkout https://theblackbox.ca/blog/vector-video/ .

Need to use it in some paintings though

Re:Show HN: Primitive for macOS by ckluis on Tuesday November 15, 2016 @01:52PM (#12961006)
I just put a complex image with shadows/light sources and it did an amazing job. It was fun to watch and eventually stop. It was even cooler to open in sketch and see all the shapes and the way the image was formed. A++
Re:Show HN: Primitive for macOS by fogleman on Tuesday November 15, 2016 @02:03PM (#12961112)
This makes me happy. :)
Re:Show HN: Primitive for macOS by chamakits on Tuesday November 15, 2016 @11:41PM (#12964585)
I missed the original post on the primitive core, cause I hadn't seen this.

Just tried it out, and it is probably the coolest 'Show HN' I've ever seen. Spent the last 2 hours playing around with some pictures and different configs, and I absolutely love what this is doing.

Also, really appreciate that you provided a value add to the product sold, without compromising the open source core. Thank you for that.

Anyways, good job, and good luck. Hope this sells tons, cause it truly is amazing.

Re:Show HN: Primitive for macOS by buckhx on Tuesday November 15, 2016 @12:33PM (#12960166)
I remember seeing the lib a few months ago and thought it was neat. I even went to find the repo and call shenanigans on this post before I looked at the comments. Really cool to see you following up with it.
Re:Show HN: Primitive for macOS by qubex on Tuesday November 15, 2016 @01:12PM (#12960551)
I downloaded your app from the MAS and find it beautiful.

I have previously implemented a "compressed sensing" image system in Processing, this produces very similar results.

I was wondering whether you will be adding support for exporting animations, both of the image being built up and (as you mention) of many images matching criteria formed from different seeds.

Re:Show HN: Primitive for macOS by supernintendo on Tuesday November 15, 2016 @03:10PM (#12961714)
Looks great! Do you have any plans to port this to other OS'? Would love something like this on GNU/Linux.
Re:Show HN: Primitive for macOS by deepflame on Tuesday November 15, 2016 @03:13PM (#12961742)
Seems the core is OS on Github. So you can use it on the command line or write a GUI for it yourself: https://github.com/fogleman/primitive
Re:Show HN: Primitive for macOS by dvcrn on Wednesday November 16, 2016 @06:45AM (#12966174)
Interesting insights! I would love to hear more in how you exactly you bridged ObjC <-> Go.

Do you mean you just ship a compiled Go binary as part of your app and interact with that? If yes, did apple not say anything about it during review?

I saw that you can call Go in mobile apps [0]. I'm wondering if that's also applicable for desktop apps

[0]: https://github.com/golang/go/wiki/Mobile

Re:Show HN: Primitive for macOS by hobarrera on Tuesday November 15, 2016 @03:06PM (#12961680)
Any chance that we can get the core for other OSs? Sounds like it's where all the magic happens and others could quickly work on UIs for it on other platforms.
Re:Show HN: Primitive for macOS by fogleman on Tuesday November 15, 2016 @03:15PM (#12961766)
Re:Show HN: Primitive for macOS by hftf on Tuesday November 15, 2016 @01:25PM (#12960721)
I wonder if it’s possible to turn this into a video filter.
Re:Show HN: Primitive for macOS by spython on Wednesday November 16, 2016 @01:38AM (#12964992)
Last time primitive was posted I wrote some bash scripts to make it work on video using ffmpeg - https://rybakov.com/blog/primitive/
Re:Show HN: Primitive for macOS by cproctor on Wednesday November 16, 2016 @01:33AM (#12964978)
I bet it would look really cool to have 3D primitives that can be oriented with respect to the time dimension. So for example, a spherical primitive would be a circle that grows and shrinks as frames progress.
Re:Show HN: Primitive for macOS by ultrafez on Tuesday November 15, 2016 @02:02PM (#12961104)
I don't see why that wouldn't be possible, it likely wouldn't run in realtime though.
Re:Show HN: Primitive for macOS by amelius on Tuesday November 15, 2016 @05:23PM (#12962883)
Well, a problem could be that you get a lot of noise if all the frames are rendered independently.

You need a constraint that guarantees for example that without any changes in the video, you won't see any changing primitives.

Re:Show HN: Primitive for macOS by JoshTriplett on Tuesday November 15, 2016 @11:46PM (#12964596)
> Well, a problem could be that you get a lot of noise if all the frames are rendered independently.

The site shows an example of what a still image looks like if rendered with the same parameters several times; it provides an interesting animated effect. I think that might produce an interesting animation style.

But for a more consistent style between frames, it'd help to have a way to seed the RNG consistently.

Re:Show HN: Primitive for macOS by amelius on Wednesday November 16, 2016 @05:02AM (#12965743)
I think there is more to it than just seeding the RNG consistently.

For example: what if you have a minor change in the area of the screen that got the first primitive (and hence used the first few RNG numbers)? Then all the remaining primitives will use different RNG numbers.

I think the problem becomes more difficult: you want to find the primitives that result in the minimal change wrt the previous frame.

Re:Show HN: Primitive for macOS by i336_ on Wednesday November 16, 2016 @08:19AM (#12966596)
Oh, awesome! The actual renderer is open source (aka free) and I don't have to put it on the "one day when macOS" pile. Thanks. :)

(I will note that the website horizontally scrolls at 1024x768. A lot of sites do, though.)

Re:Show HN: Primitive for macOS by Eduard on Wednesday November 16, 2016 @04:19PM (#12971638)
I'm surprised I couldn't find any SVG versions of sample images, as (I assume) for many interested parties, the vector format output is the unique selling proposition for a, well, vector-based application.
Re:Show HN: Primitive for macOS by andrewfromx on Tuesday November 15, 2016 @11:04PM (#12964452)
rather than swift to replace obj-c you could use https://github.com/dontpanic92/wxGo/ and make it 100% Go.

https://github.com/dontpanic92/wxGo/issues/8 needs work though fyi