HNHacker News
TopNewBestAskShowJobs

tylermw

1,012 karma · joined January 8, 2018

https://www.tylermw.com
submissionscomments
tylermw··on Handbrewing Coffee
Except Chemex pots are cheap (+), durable (+++), and don't have a touchbar (++++++++++).
tylermw··on Rayshader – An open-source R package for producing 2D and 3D hillshaded maps
To zoom, just subset the matrix to the region of interest
tylermw··on Rayshader – An open-source R package for producing 2D and 3D hillshaded maps
FYI Mapzen is coming back as a Linux foundation project (just announced in the last week):

https://hub.packtpub.com/mapzen-an-open-source-mapping-platf...

tylermw··on Rayshader – An open-source R package for producing 2D and 3D hillshaded maps
I have not, but I'm including gltf 2.0 support in an upcoming version, so it should be possible to start exporting visualizations created with rayshader to more traditional 3D graphics workflows where you could take advantage of those features.
tylermw··on Rayshader – An open-source R package for producing 2D and 3D hillshaded maps
Great idea! The mesh it iterates over is inherently 2D (the surface intersection test just performs a bilinear interpolation between the grid points to compare to the ray height) so Bresenham's algorithm would work here. I'll implement it and see if it offers any significant speed improvements.
tylermw··on Rayshader – An open-source R package for producing 2D and 3D hillshaded maps
The maps are generated directly from elevation data--all you need is an array of elevation values and the full maps are generated from those. A good source of elevation data for the USA is the National Map [1], but a much more comprehensive source is the SRTM Space Shuttle data [2] (it covers almost the entire earth at a 30m resolution).

[1] https://viewer.nationalmap.gov/basic/ [2] https://dwtkns.com/srtm30m/

tylermw··on Rayshader – An open-source R package for producing 2D and 3D hillshaded maps
A second or two for everything you see here--the raytracing and color mapping bakes the texture into the surface, so after that the user can manipulate the 3D model to how they see fit. On larger datasets (10,000 x 10,000) it takes about a minute or so with default settings, but the user can cache the texture so they only have to calculate it once.
tylermw··on Rayshader – An open-source R package for producing 2D and 3D hillshaded maps
Thanks! Halfway down the page on this [1] post I share an image made with lidar data of downtown Austin. Lidar data is fairly noisy (this required a bit of pre-processing to remove artifacts) but you can indeed capture an urban environment fairly well.

[1] https://www.tylermw.com/portrait-mode-data/

tylermw··on Rayshader – An open-source R package for producing 2D and 3D hillshaded maps
Yep, I've seen those, and I've been tempted to throw together an example with rayshader to show how easy it is to do with just a few lines of code.

One of the main motivations behind developing rayshader was to democratize mapping--forcing people to become proficient in not one but two highly specialized software suites (any GIS software + blender) really made beautiful mapping unattainable for most. Plus, I just dislike GUIs in general, and wanted a code-based solution for map making :)

tylermw··on Rayshader – An open-source R package for producing 2D and 3D hillshaded maps
Developer of rayshader here: If you're interested in some of the thought process and details that went into creating and developing the package, I have a series of blog posts detailing them here (in order of appearance):

http://tylermw.com/throwing-shade/ HN comments: https://news.ycombinator.com/item?id=17065264

http://www.tylermw.com/making-beautiful-maps/ HN comments: https://news.ycombinator.com/item?id=17424061

http://www.tylermw.com/3d-maps-with-rayshader/ HN comments: https://news.ycombinator.com/item?id=17697046

http://www.tylermw.com/3d-printing-rayshader/ HN comments: https://news.ycombinator.com/item?id=17851229

http://www.tylermw.com/portrait-mode-data/ HN comments: https://news.ycombinator.com/item?id=18282640

tylermw··on The present phase of stagnation in the foundations of physics is not normal
Love this comment left on the post by Peter Shor (of Shor's algorithm--the algorithm that kicked off the quantum computing frenzy). I assume it's him and not an imposter.

"It's not just that scientists don't want to move their butts, although that's undoubtedly part of it. It's also that they can't. In today's university funding system, you need grants (well, maybe you don't truly need them once you have tenure, but they're very nice to have).

So who decides which people get the grants? It's their peers, who are all working on exactly the same things that everybody is working on. And if you submit a proposal that says "I'm going to go off and work on this crazy idea, and maybe there's a one in a thousand chance that I'll discover some of the secrets of the universe, and a 99.9% chance that I'll come up with bubkes," you get turned down.

But if a thousand really smart people did this, maybe we'd actually have a chance of making some progress. (Assuming they really did have promising crazy ideas, and weren't abusing the system. Of course, what would actually happen is that the new system would be abused and we wouldn't be any better off than we are now.)

So the only advice I have is that more physicists need to not worry about grants, and go hide in their attics and work on new and crazy theories, the way Andrew Wiles worked on Fermat's Last Theorem."

(new comment right below)

"Let me make an addendum to my previous comment, that I was too modest to put into it. This is roughly how I discovered the quantum factoring algorithm. I didn't tell anybody I was working on it until I had figured it out. And although it didn't take years of solitary toil in my attic (the way that Fermat's Last Theorem did), I thought about it on and off for maybe a year, and worked on it moderately hard for a month or two when I saw that it actually might work.

So, people, go hide in your attics!"

tylermw··on Show HN: An open source R package to add depth of field to images
Pedantic comments on the internet? Never... :)
tylermw··on Show HN: An open source R package to add depth of field to images
Author here! This is part of a series where I describe the development of an R package I've been developing for mapping and visualization:

Show HN: A raytracer to shade, plot, and 3D print topographic maps in R, part 4 http://www.tylermw.com/3d-printing-rayshader/

Show HN: A raytracer to shade and visualize topographic maps in R, part 3 http://www.tylermw.com/3d-maps-with-rayshader/

Show HN: A raytracer to shade topographic maps in R, Part 2 http://www.tylermw.com/making-beautiful-maps/

Show HN: A raytracer to shade topographic maps in R http://tylermw.com/throwing-shade/

tylermw··on Show HN: A raytracer to shade, plot, and 3D print topographic maps in R, part 4
Author here: this is the fourth entry in a series of posts where I describe the development the R package `rayshader`.

Previous posts:

Part 3

https://news.ycombinator.com/item?id=17697046

Part 2

https://news.ycombinator.com/item?id=17424061

Part 1

https://news.ycombinator.com/item?id=17065264

tylermw··on Show HN: A raytracer to shade and visualize topographic maps in R, part 3
Go for it!
tylermw··on Show HN: A raytracer to shade and visualize topographic maps in R, part 3
Great to hear! Would love to see what you end up using it for!
tylermw··on Show HN: A raytracer to shade and visualize topographic maps in R, part 3
Author here: This is the third post is a series on what was originally just a ray tracer to shade topographic maps, but has now evolved into a tool to more generally visualize elevation and bathymetric data.
tylermw··on Show HN: A raytracer to shade topographic maps in R, Part 2
I'll be sure to put it on my list! The American west's landscape is just incomparable to anywhere else in the country. I'm an east coaster myself, but nothing out here compares to the beauty and grandeur of the canyons, mountains, and gorges you find out west.
tylermw··on Show HN: A raytracer to shade topographic maps in R, Part 2
It really was fantastic! If it wasn't for the massive crowds constantly pushing you towards the Sistine Chapel, it would be a great place to spend an hour or two just admiring the small details in each map.
tylermw··on Show HN: A raytracer to shade topographic maps in R, Part 2
I have indeed! HN user "CyberDildonics" commented with a link to it in the original post. Would be useful if I ever move from bilinear interpolation to determine surface intersection to tessellation.
tylermw··on Show HN: A raytracer to shade topographic maps in R, Part 2
You can certainly throw something into actual 3D rendering software and get something similar--if you know how to use it! That's the point. This is a way to go straight from DEM to beautiful map, without having to teach yourself Blender or open any external program. You can go straight from matrix to map in just a few lines of code--and adjusting each layer to match the aesthetic you're after is easy.

Everything here is produced and adjustable programmatically: need to change the highlight color in the texture? Just use the create_texture function with the colors. Want to tone down raytraced shadows? Decrease the max_darken value in add_shadow. Rotate the sun direction or the color of the water? It's all straightforward. This library is designed to be as seamless and flexible as possible, so you never have to leave R to produce a nice looking map.

tylermw··on Show HN: A raytracer to shade topographic maps in R, Part 2
GDAL does has hillshading routines (gdaldem hillshade), but it does not have the raytracing, spherical UV shading, or ambient occlusion layers included in rayshader. It's hillshading routine is basically the rayshader's lamb_shade function--functional, but not going to win any beauty contests.

GRASS does have a raytracing option, but if you look up the images produced by it--they aren't pretty. Much more of a functional API to see where actual shadows are falling, and not at all something to produce nice looking maps.

The real killer feature in rayshader is the seamless API for combining all of these layers. Being able to adjust the intensity of each layer individual, add water, change color and texture programmatically--no other software focuses nearly as much on the aesthetics of a great looking map.

I haven't found anything other than actual 3D modeling software that can produce similar-style hillshades--combining texturing, raytracing, local shadows, and ambient occlusion. What's great (in my highly biased opinion!) about this package is the ability to go programmatically straight from the DEM to a hillshade, without having to save the data and load it into Blender or something similar.

tylermw··on Show HN: A raytracer to shade topographic maps in R, Part 2
Author here--This is a follow-up to my last post, here:

https://news.ycombinator.com/item?id=17065264

The feedback in that thread was great, and I ended up implementing several of the suggestions given in the comments. Thanks for all the help!

tylermw··on Ask HN: What are some technical topics I can blog about?
Just write articles that you would find interesting to read--don't worry about the subject. I like reading technical articles that have lots of illustrative figures and modest amounts of interactivity, so that's how I write.
tylermw··on Show HN: A raytracer to shade topographic maps in R
I do address all of your concerns in the article.

For the angle-to-brightness curve, one of my footnotes says:

"I believe his code only lacks a step that implements a minimum threshold on the slope before it gets colored--a step that would remove the problems seen in Figure 1 in flat areas."

With regards to misinterpretations:

"There's a tradeoff between realism and actual topographic information--real shadows can tell you about the relative height of two objects, but nothing about the slope of the land in the shadow itself."

(I also mention how you can adapt the rayshading technique for a local model that doesn't have that problem)

And later on in that paragraph, about subjectivity:

"Thirdly, cartography has an artistic and practical component, and it’s true what reliefshading.com said in the non-computational shade it threw at global models–sometimes, you need to tweak the direction of the light hitting a particular mountain or valley because it looks better."

tylermw··on Show HN: A raytracer to shade topographic maps in R
First time I've heard of QGIS, so nope! But it looks like they support C++ plug-ins, so it wouldn't be hard to port it over. Don't know anything about their approval process, though.
tylermw··on Show HN: A raytracer to shade topographic maps in R
Check out the last few posts on my blog! I use this method a few times to help demonstrate points:

http://www.tylermw.com/visualizing-a-reddit-hug-of-death-and...

http://www.tylermw.com/soma-water-filters-are-worthless-how-...

tylermw··on Show HN: A raytracer to shade topographic maps in R
Thanks! I drew the frames in Inkscape and animated them together using the Scrollmagic JavaScript library.
tylermw··on Show HN: A raytracer to shade topographic maps in R
I'll look into that, thanks for the note. My Imagemagick knowledge is by far my weakest link.
tylermw··on Show HN: A raytracer to shade topographic maps in R
One thing I didn't mention in the article are a few optimizations I made that make it significantly less than O(row * col * light_count * dist). First, if the ray exits the map region (either by going higher than the highest point on the map, or outside the boundaries), it stops propagating that ray and calls it a non-intercept (cutting down on the "dist" complexity). Second, if you're drawing multiple rays for a finite sized light source, I first order them by angle and send the rays out from the lowest to the highest angle. If a ray at a lower angle doesn't intercept a surface, higher angles won't either. So you save a lot on the "light_count" complexity.
← PreviousPage 5 of 6Next →