Better HN
topnewbestaskshowjobs
Log inSign up

constexpr

853 karma · joined Aug 16, 2011 (15y ago) · 112 submissions

Submissions

comment 10y ago · link · parent

The biggest pain points when using emscripten are debugging, compilation time, and code size. Debugging means poking through what is the JavaScript equivalent of assembly code but without a debugger that understands it (no segfaults on null access, strings are just numbers, etc.). The emscripten toolchain doesn't include an incremental linker yet and compilation time is limited by C++'s dumb compilation model. C++ also generates a lot of code if you use the standard library and templates (this is C++'s fault, not emscripten). In practice, we have an Xcode project hooked up to build the same C++ code and use that as our IDE. That way we can mostly treat emscripten as just a build target. I would only do it if it's worth the tradeoff.

92.

Building a professional design tool on the web using C++ and Emscripten(medium.com ↗)

105 points · by constexpr · 10y ago · 14 comments

comment 10y ago · link · parent

San Francisco; Full Time; Onsite

I'm the cofounder of Figma, a startup in San Francisco building a browser-based collaborative design tool to improve the way designers and engineers work together. We're a small team of 15, and we're looking for talented designers and engineers (front end, backend, full stack, lead devops, mobile, and data science) who are interested in tackling challenges in the creative tools space.

Example challenges: annotation system on top of documents for feedback, 2D boolean operations on paths, speed up zooming in the app using a tile quadtree, UI testing framework that simulates user actions, real-time events and data pushing across the site, zero-downtime deployments, search API for filtering user files.

Our tech stack: C++, Emscripten, Node, CoffeeScript, JavaScript, WebGL, Ruby, Sinatra

If you're interested in learning more about what we're working on or want to meet up to talk about any of my other projects (http://madebyevan.com/), you can email me at wallace@figma.com.

comment 11y ago · link · parent

San Francisco; Full Time; Onsite

I'm the cofounder of Figma, a stealth startup in San Francisco building a browser-based collaborative design tool to improve the way designers and engineers work together. We're a small team of 14, and we're looking for talented designers and engineers (front end, backend, full stack, lead devops, mobile, and data science) who are interested in tackling challenges in the creative tools space.

Example challenges: annotation system on top of documents for feedback, 2D boolean operations on paths, speed up zooming in the app using a tile quadtree, UI testing framework that simulates user actions, real-time events and data pushing across the site, zero-downtime deployments, search API for filtering user files.

Our tech stack: C++, Emscripten, Node, CoffeeScript, JavaScript, WebGL, Ruby, Sinatra

If you're interested in learning more about what we're working on or want to meet up to talk about any of my other projects (http://madebyevan.com/), you can email me at wallace@figma.com.

comment 11y ago · link · parent

The bug has been marked as WontFix by the V8 team: https://code.google.com/p/v8/issues/detail?id=3354. It looks like they are considering fixing it for TurboFan and not for Crankshaft, but I'm not sure what that means. Does that only apply to asm.js code?

comment 11y ago · link · parent

San Francisco; Full Time; Onsite

I'm the cofounder of Figma, a stealth startup in San Francisco building a browser-based collaborative design tool to improve the way designers and engineers work together. We're a small team of 14, and we're looking for talented designers and engineers (front end, backend, full stack, lead devops, lead quality, mobile, and data science) who are interested in tackling challenges in the creative tools space.

Example challenges: annotation system on top of documents for feedback, 2D boolean operations on paths, speed up zooming in the app using a tile quadtree, UI testing framework that simulates user actions, real-time events and data pushing across the site, zero-downtime deployments, search API for filtering user files.

Our tech stack: C++, Emscripten, Node, CoffeeScript, JavaScript, WebGL, Ruby, Sinatra

If you're interested in learning more about what we're working on or want to meet up to talk about any of my other projects (http://madebyevan.com/), you can email me at wallace@figma.com.

comment 11y ago · link · parent

I'm surprised to hear they produce lower quality output at small glyph sizes. Fragment shaders can do multiple texture samples and I've gotten very high quality results. You can even do ClearType-style subpixel rendering with a handful of samples. The case where signed distance fields don't work is for large glyph sizes. They often end up chopping off corners or not having the density to represent thin calligraphic strokes.

comment 11y ago · link · parent

San Francisco; Full Time; Onsite

I'm the cofounder of Figma, a stealth startup in San Francisco building a browser-based collaborative design tool to improve the way designers and engineers work together. We're a small team of 12, and we're looking for talented designers and engineers (front end, backend, full stack, lead devops, lead quality, mobile, and data science) who are interested in tackling challenges in the creative tools space.

Example challenges: annotation system on top of documents for feedback, 2D boolean operations on paths, speed up zooming in the app using a tile quadtree, UI testing framework that simulates user actions, real-time events and data pushing across the site, zero-downtime deployments, search API for filtering user files.

Our tech stack: C++, Emscripten, Node, CoffeeScript, JavaScript, WebGL, Ruby, Sinatra

If you're interested in learning more about what we're working on or want to meet up to talk about any of my other projects (http://madebyevan.com/), you can email me at wallace@figma.com.

comment 11y ago · link · parent

I'm the cofounder of Figma, a stealth startup in San Francisco building a browser-based collaborative design tool to improve the way designers and engineers work together. We're a small team of 12, and we're looking for talented designers and engineers (front end, backend, full stack, lead devops, lead quality, mobile, and data science) who are interested in tackling challenges in the creative tools space.

Example challenges: annotation system on top of documents for feedback, 2D boolean operations on paths, speed up zooming in the app using a tile quadtree, UI testing framework that simulates user actions, real-time events and data pushing across the site, zero-downtime deployments, search API for filtering user files.

Our tech stack: C++, Emscripten, Node, CoffeeScript, JavaScript, WebGL, Ruby, Sinatra

If you're interested in learning more about what we're working on or want to meet up to talk about any of my other projects (http://madebyevan.com/), you can email me at wallace@figma.com.

comment 11y ago · link · parent

What I do for most sites is to enter a one-off random string and forget it immediately. I just leave myself logged in and when I get logged out I just use the email password recovery to set a new random password. Your email password recovery mechanism is already the weakest link.

101.

Swift WTF(swiftwtf.tumblr.com ↗)

79 points · by constexpr · 11y ago · 37 comments

comment 11y ago · link · parent

You bring up the internet archive in your presentation. Have you talked to them? What do they think of IPFS?

comment 11y ago · link · parent

I'm always confused when people ask me this question. All browsers have the ability to view the source code of a web page (View > Developer > View Source in Chrome). The source code is here: http://madebyevan.com/nn-gait/script.js. Is that what you meant?

comment 11y ago · link · parent

This experiment reminds me of one of my recent experiments: http://madebyevan.com/nn-gait/. Mine ends up figuring how to walk relatively quickly. It does have a regular pulse as an input though.

comment 11y ago · link · parent

Nope, it's much simpler than that. It's just a grid of vertical positions and each frame every cell moves toward the average position of the neighbors from the previous frame. See http://freespace.virgin.net/hugo.elias/graphics/x_water.htm for details.

comment 12y ago · link · parent

What's completely broken about it? If you use it the way it was intended to be used, as a cache for apps, then it works perfectly fine in my experience. It behaves like a native app that updates itself in the background (Chrome itself does this, for example). If you try to use it as a HTTP cache then yes, it's completely the wrong tool for the job and you're gonna have a bad time.

comment 12y ago · link · parent

Yes. According to http://clang.llvm.org/docs/AutomaticReferenceCounting.html#s..., ARC assumes that self is valid for the lifetime of the call. This will not be the case if the last reference to the object is changed or cleared during the call, which may result a segfault. The performance loss of retaining and releasing self across all methods was deemed too much compared with the safety gains.

comment 12y ago · link · parent

Author here. I've done much more awesome stuff with WebGL since I made this demo but it's for my startup and is not public yet. We're actually looking for a backend engineer with graphics experience at the moment. Send me an email at evan@figma.com if you're interested.

comment 12y ago · link · parent

Author here. The caustics in this demo are computed entirely on the GPU and are approximated with a mesh. The shader for the caustics needs the ratio of the projected area to the original area for each triangle to compute the brightness. You're right that a vertex shader can't access whole triangles (you usually use a geometry shader for that, which WebGL doesn't have) but you can still get the ratio of the triangle areas in this case by using the screen-space derivative functions dFdx() and dFdy() in the fragment shader. Reflections and refractions can also be done in entirely in the fragment shader for simple scenes like this one with standard raytracing intersection tests.

comment 12y ago · link · parent

Author here. The water effect is a simple 2D heightfield simulation, which is explained pretty well at http://www.matthiasmueller.info/talks/GDC2008.pdf. It essentially just moves each vertex toward the average height of its neighbors, which turns out to propagate waves that look like water ripples.

The caustics are also pretty simple. Basically you take your heightfield mesh that represents the water surface and project each vertex independently along the ray refracted from the light through that vertex (using the vertex normal) and onto the pool floor. So you now have a mesh that is completely on the pool floor and contains lots of tiny triangles. To render caustics, just make triangles that got smaller brighter and ones that got bigger dimmer. I think I used the ratio of the projected area to the original resting area.

The reflection and refraction raytracing is all hard-coded for the geometry in the scene, which makes it really easy. It's just a simple sphere and box intersection test. The "ambient occlusion" is done by making parts of the objects darker when they get near each other.

State of the art for real-time water uses a full 3D volumetric representation for the water like in this paper: http://www.matthiasmueller.info/publications/tallcells.pdf. This lets you get waves that can fold over themselves like real waves. I haven't seen any other realtime methods that have caustics as good as the ones in my demo though.

111.

C++ to JavaScript: Emscripten, Mandreel, and now Duetto(mozakai.blogspot.com ↗)

12 points · by constexpr · 13y ago · discuss

comment 13y ago · link · parent

Ouch, that's a great point about versioning.

The thing that appeals to me about asm.js is that it short-cuts the long, slow path of VM optimization and gives great performance now instead of five years down the road. Sure it's an ugly hack but that doesn't matter to your users, all they see is a much faster user experience.

Now all we need is a SIMD API for JS and we can write some truly amazing apps.

1234