TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: A raytracer to shade topographic maps in R

198 点作者 tylermw大约 7 年前

11 条评论

osrec大约 7 年前
That's a cool project and a nice write up. I remember as a 13 yr old being fascinated by 3D software. I think I just wanted to create something photo-realistic with a computer. I couldn't afford 3DSMax, so started on the steep learning curve with Blender. About the same time, they integrated Yafray into Blender, resulting in some outstanding renders, similar in quality to commercial packages. I was amazed and started delving into the maths - what a fun and confusing journey it was! Five years later when the maths was finally explained to me at university, I truly appreciated the work that went into things like Blender and Yafray. So kudos to you for your raytracer!
评论 #17067118 未加载
评论 #17066225 未加载
评论 #17065707 未加载
abirler大约 7 年前
I think the O(row * col * light_count * dist) algorithm could be optimized to run in O(row * col * light_count).<p>The idea is, imagine the light is coming from the left, and our height map consists of a single row that looks like (0,5,2,7,1).<p>By using the angle of the light, we can compute from left to right whether the current point should be visible. We only need to store the last point that was also visible since that is the only point that can block us from this light source. For the given example, at point of height 2 we only need to care about the previously visible point of height 5. If 2 isn&#x27;t visible, 5 remains the &quot;highest&quot; point, if 2 is visible, 2 becomes the &quot;highest&quot; point, there is no danger that 5 will block something beyond two since 2 wasn&#x27;t blocked. So at each point we only have to check with one previous point, not all.<p>If the light isn&#x27;t coming from exactly the left side, then we can tranform the image so in such a way that the light is now from the left. This transformation will take O(r * c) time per light.<p>Total complexity: O(transforms + visibilityChecks + mergingResults) = O(l * r * c)
评论 #17066477 未加载
leni536大约 7 年前
Your raytraced shadow maps have a bit of a &quot;glossy&quot; feel, it suggests that you don&#x27;t use linear colorspace for rendering these. I think colormagick also needs additional options to handle multiplication in linear colorspace. I didn&#x27;t look into any of your code, so I&#x27;m sorry if I&#x27;m wrong about this.
评论 #17073861 未加载
评论 #17066504 未加载
tylermw大约 7 年前
If you missed it, the github repo for the R package is located here:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;tylermorganwall&#x2F;rayshader" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tylermorganwall&#x2F;rayshader</a>
tabtab大约 7 年前
I have a bit of a complaint. I&#x27;ve used something similar to the &quot;derivative based model&quot; (DBM) for 3D shading before, and tested them on moonscapes.<p>The angle-to-brightness curve can be adjusted as needed to avoid under or over-emphasizing mountain slopes. The &quot;Andes&quot; example is probably a case of exaggerating topology to illustrate relative differences, and NOT in inherent fault of slope-to-brightness maps (DBM-like). I can&#x27;t say which one is more practical without going to the actual slopes to check the look and feel of the terrain and &quot;feel&quot; of the slopes. For technical accuracy, color coding is probably better (color-per-height), but slope-shaded maps are easier for regular folks to relate to.<p>Ray tracing is probably better when dealing with direct shadows and reflections, such as found with buildings. But for high level maps with mountains and rivers, I believe DBM is just fine if tuned right, and won&#x27;t differ noticeably from comparable ray tracing.<p>To avoid misinterpretations, the large-scale shading should more or less mirror a semi-cloudy day such that direct shadows and reflections would play an extremely minor role anyhow.<p>I should point out there is an element of subjectivity here. Illustrations often exaggerate to emphasize various attributes of the illustration&#x27;s target. Often there is a trade-off in terms of aiding the quick mental digestion of information versus &quot;native&quot; accuracy. Abstractions lie on purpose, or we wouldn&#x27;t call them &quot;abstractions&quot;.
评论 #17070375 未加载
评论 #17070115 未加载
评论 #17070801 未加载
JorgeGT大约 7 年前
This would be fantastic as a QGIS plugin, have you thought about applying to their grant program?
评论 #17068472 未加载
alkonaut大约 7 年前
What’s really baffling about all things rendering is when you realize that almost anything you can think of and optimize to render in 10ms with a ton of sweat, was already done in 1ms in a game engine. Ten years ago.
评论 #17067704 未加载
Remnant44大约 7 年前
Neat project!<p>I&#x27;m not sure if the author is familiar with ambient occlusion, but the method described here can be extended to generate ambient occlusion data which helps with a couple flaws. In particular:<p>- Although the shading is very nice (see Figure 8), the long shadow rays are distracting and are not very useful for cartography.<p>Ambient occlusion extends the idea presented here, except that instead of sending rays towards a relatively small light source, consider the light source to be the entire hemisphere of the sky, like on an overcast day. The result is wonderfully soft light that conveys form much like Figure 8, but without shadows.<p>Simply send out more rays to the entire sky hemisphere to create this effect.
bhouston大约 7 年前
I think it is likely possible to do this in screenspace ultra fast on demand using a shadow map &#x2F; SSAO technique.
评论 #17068567 未加载
pvillano大约 7 年前
I made something similar that runs in real time in 30 lines of code.
zython大约 7 年前
awesome stuff, how&#x27;d you make the illustrations (like Figure 6. )?
评论 #17067738 未加载
评论 #17067597 未加载