tag:blogger.com,1999:blog-6950833531562942289.post5721025470712836644..comments2024-03-05T02:44:27.041-08:00Comments on C0DE517E: Raytracing MythsDEADC0DEhttp://www.blogger.com/profile/01477408942876127202noreply@blogger.comBlogger22125tag:blogger.com,1999:blog-6950833531562942289.post-27056249760584750082011-09-23T04:36:51.441-07:002011-09-23T04:36:51.441-07:00I appreciate your precise and abstract overview. R...I appreciate your precise and abstract overview. Raytracing seems a bit like hydrogen fueled cars. If you don't have to think to an end, it's the optimal solution.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6950833531562942289.post-38307108539364391302011-09-23T01:39:16.032-07:002011-09-23T01:39:16.032-07:00Ray tracing may be O(log(n)) where n is the numbe...Ray tracing may be O(log(n)) where n is the number of primitives, but building the acceleration structure is O(n) or higher - which means that if you have to rebuild the acceleration structure every frame, which you would need to at least for animated characters in a game, that supposed advantage of raytracing simply disappears.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6950833531562942289.post-35402301789987118462011-09-21T06:01:08.681-07:002011-09-21T06:01:08.681-07:00eyedl"There could be also a discussion betwee...eyedl"There could be also a discussion between power (of GI lighting) versus interactive feedback, but anyways..."<br /><br />Actually in this case raytracing wins on both counts - a big factor in why raytracing is starting to make strong inroads in film/vfx is because it's much better for interactive feedback. Raytracers can render with progressive refinement much more easily than other techniques, which often require length shadow map/point clouds generation before you even see a single rendered pixel. It makes it very difficult to iterate quickly when you have to wait so long, just to find out that your light is in the wrong place, and move it again. With a raytracer it can easily show you a noisy/low quality result that improves over time, which is often enough for quickly tweaking lights/materials interactively. And especially if you're using something like a pathtracer, the low-quality version of what you see is qualitatively the same render as what you will get in the final frame - i.e. you don't have to disable features to get fast feedback, you get the same thing, but with less samples.<br /><br />I'd also be careful using the argument along the lines of 'prman does it and it's used a lot in film, so it must be good'. prman is an excellent renderer, and it's not particularly because it's a (semi) rasteriser. It incredibly flexible, is very well battle-hardened from years of use and development, and facilities have built up huge investments in infrastructure around it. Suffice to say for better or worse, it's not going anywhere any time soon, but I'm not sure if they were to re-design it today, with the problems of today, they'd do again it the same way. It should also be noted that the latest release of prman contains a lot more functionality to replicate the sort of things (physically based materials/lighting, importance sampling) that's commonplace in raytracers today.<br /><br />Anyway, just some thoughts from a someone who's currently working on an animated feature, using REYES renderers.Mattnoreply@blogger.comtag:blogger.com,1999:blog-6950833531562942289.post-91639110113696034172011-09-20T16:26:31.228-07:002011-09-20T16:26:31.228-07:00Erich: I never thought that raytracing is not ther...Erich: I never thought that raytracing is not there to stay! I'm trying to paint a fair picture and maybe show an interesting way of looking at these two algorithms. I'm not a pro-rasterizer or such, actually I probably know more about raytracing than I know about rasterization (without probably, I SURELY do) and I used to do research in MonteCarlo GI.DEADC0DEhttps://www.blogger.com/profile/01477408942876127202noreply@blogger.comtag:blogger.com,1999:blog-6950833531562942289.post-68746653855657935532011-09-20T16:22:57.646-07:002011-09-20T16:22:57.646-07:00Jono: I agree and I'm not very up-to-date on w...Jono: I agree and I'm not very up-to-date on what most studios are doing, but it's not that black-and-white. Rasterization is still useful because even if first-hit is an increasingly small part of the rendering time, it's still the most important by far. Antialiasing, accurate derivatives, fast programmable shading, easy displacement and so on are still things which are easier on a rasterizer. Also methods that are originating from realtime GI are finding their way back to the offline world (i.e. the recent PRMan fast AO stuff), and this is pushing back the need of using RT everywhere.DEADC0DEhttps://www.blogger.com/profile/01477408942876127202noreply@blogger.comtag:blogger.com,1999:blog-6950833531562942289.post-39564476144980921512011-09-20T15:07:00.536-07:002011-09-20T15:07:00.536-07:00Great post.
A comment about the off-line visual e...Great post.<br /><br />A comment about the off-line visual effects rendering world isn't quite accurate.<br /><br />The trend towards ray-tracing isn't because it's faster, it's because it's <b>easier</b>. This is true in two ways:<br /><br />1. Given that a renderer has to have good ray-tracing for (certain) global illumination effects, then why put effort into a rasterizer which is an increasingly small part of render time.<br /><br />2. It's easier for artists to work with a pure ray-tracer as they don't need to spend as much time dealing with handling all the special purpose algorithms a non-raytracer uses (shadow maps, point-based global illumination, etc).<br /><br />The studios using a full ray-tracer will tell you it's SLOWER to render, but they get good results faster so do fewer iterations.<br /><br />This is dramatically different than the real-time world! This may be a place where what the film studios are doing does NOT predict where the game studios will go!Jonohttps://www.blogger.com/profile/06952154446473686247noreply@blogger.comtag:blogger.com,1999:blog-6950833531562942289.post-34348240459746647642011-09-20T13:45:48.707-07:002011-09-20T13:45:48.707-07:00One major advantage of unbiased renderers is that ...One major advantage of unbiased renderers is that the results can be merged in an unbiased way from shared-nothing renders.<br /><br />Tiling would be the equivalent for rasterizing renderers, but tiling does not improve image quality, only coverage in screen space.<br /><br />My company, Fohr, has a physically-correct real-time virtual lighting and camera system for film production. Path tracing is here to stay, and has an enormous advantage in "artist time" over rasterization approaches like Renderman.Erich Oceanhttp://erichocean.comnoreply@blogger.comtag:blogger.com,1999:blog-6950833531562942289.post-57284262461595652982011-09-20T13:39:00.066-07:002011-09-20T13:39:00.066-07:00David: agreed, raytracing is becoming more and mor...David: agreed, raytracing is becoming more and more relevant in the offline world, GI started to gain momentum because it allowed artists to get better results faster (as you say) instead of having to place lights everywhere. <br /><br />There could be also a discussion between power (of GI lighting) versus interactive feedback, but anyways...<br /><br />Still RT it's not a clear winner _there_ where rendering times and resources mean less, and where you can buy lots of processing power. <br /><br />There are also other factors to consider in the commercial success like the history of the various renderers, their robustness, their programmability and so on, so it's not really about raytracing vs rasterization. <br /><br />Anyways that was not really my point, what I wanted to say is that complexity wise it's not true that RT will be needed because of the explosion in triangle counts, again, PRMan deals with these pretty well (better than any other software really), so these things do not matter.DEADC0DEhttps://www.blogger.com/profile/01477408942876127202noreply@blogger.comtag:blogger.com,1999:blog-6950833531562942289.post-8667961135669560222011-09-20T12:32:35.873-07:002011-09-20T12:32:35.873-07:00For these very large scenes, you just use tricks l...For these very large scenes, you just use tricks like LOD to reduce the number of primitives so that size of primitive is roughly size of pixel. Thus in practice rasterization scales fine even to extremely detailed scenes. If number of pixels is N and you decimate meshes appropriately and depth complexity is D, then rasterization and ray tracing should both take O(ND) time with potentially some log factors in there depending on how your hierarchical data structures work (and both require linear time in number of primitives to precompute the data structures).<br /><br />Also correct decimation is really beneficial for both approaches for quality reasons. If you throw a billion polygon soup into a renderer without filtering out high frequencies you'll just get horrible aliasing. For both rasterization and ray tracing you can just take more samples to get rid of the aliasing, but decimating meshes helps you by prefiltering out high frequencies.<br /><br />It isn't clear that either method should have a big asymptotic advantage (beyond log factors) if implemented correctly.Connelly Barneshttps://www.blogger.com/profile/02568908952592933174noreply@blogger.comtag:blogger.com,1999:blog-6950833531562942289.post-54587321588424989902011-09-20T10:40:10.539-07:002011-09-20T10:40:10.539-07:00@DEADCODE,
In regards to movies. Pixar is hybrid ...@DEADCODE,<br /><br />In regards to movies. Pixar is hybrid but ILM/Sony are mostly path tracers Sony's renderer is a unbiased path tracer.<br /><br />I think WETA does 1st bounce ray tracing w/ AO.<br /><br />I think the shift in offline world is to path tracing because it gives better results out of the boxDavidhttps://www.blogger.com/profile/13054661789458451193noreply@blogger.comtag:blogger.com,1999:blog-6950833531562942289.post-21612621325123966752011-09-20T10:38:30.774-07:002011-09-20T10:38:30.774-07:00viktor: I've removed that part, thanks for the...viktor: I've removed that part, thanks for the suggestion<br /><br />guillaume: Yes and no. RT needs spatial structures not only to deal with depth complexity but also to deal with complexity in screen space. Of course you could use a software rasterizer to do occlusion culling, then apply LODs, then maybe partition triangles in screen tiles and then sort and raytrace them.<br /><br />That will probably be not too slow, but will also make your raytracer fundamentally the same with a tiled rasterizer with just the last bit of the loop inverted.<br /><br />It won't probably have much sense in terms of practical application but it's fine, my whole point of the article was to show that indeed the two techniques are the same with the order you do things switched, and this leds to some different set of trade-offs but not a fundamental, general victory of one over the other.DEADC0DEhttps://www.blogger.com/profile/01477408942876127202noreply@blogger.comtag:blogger.com,1999:blog-6950833531562942289.post-65638109825059668722011-09-20T08:28:50.815-07:002011-09-20T08:28:50.815-07:00Excellent post! I've been making similar argu...Excellent post! I've been making similar arguments while reviewing papers for years.<br /><br />The religious side of the discussion also has interesting dynamics. Most folks start out squarely in one camp due to their early experiences, which, like religions, they often can't control (e.g. college or game dev : country & parents). As they gain experience, many become agnostic, but a minority become even more entrenched (similar to scientists with any religion?). Like with religion, hard-core devotees are typically immune to reason.<br /><br />In addition to parallel performance, computing trends make it important to analyze the algorithms in terms of power usage, where coherent memory access becomes even more important than hiding latency. This tends to favor rasterization with current algorithms and architectures, as the rasterizer and texture units in a GPU provide orders of magnitude power improvements that are difficult to match with a ray intersection unit and incoherent primitive access.<br /><br />The tension between performance, power, and the growing need for random visibility access for global illumination will provide fertile ground for rendering research for years to come.Daniel Wexlerhttps://www.blogger.com/profile/18231125109418235754noreply@blogger.comtag:blogger.com,1999:blog-6950833531562942289.post-12825534316311797062011-09-20T08:27:11.852-07:002011-09-20T08:27:11.852-07:00Bram said…
"Will nr of pixels on your screen ...Bram said…<br />"Will nr of pixels on your screen double? No!"<br /><br />Retina displays are coming, so number of pixels onscreen may well double next year.sambeauhttps://www.blogger.com/profile/16308991958394630403noreply@blogger.comtag:blogger.com,1999:blog-6950833531562942289.post-90677906071554640892011-09-20T07:21:07.755-07:002011-09-20T07:21:07.755-07:00So what's stopping the opposite argument as we...So what's stopping the opposite argument as well? If you're using occlusion culling to throw away 80% of the scene in the rasterizer, you can do the same in the raytracer.<br /><br />The occlusion culling has nothing to do with either rendering algorithm.<br /><br />You argue that you can use the same acceleration structures that raytracers use in a rasterizer, so why not use the rasterizer acceleration techniques in a raytracer.<br /><br />All you're describing really are heuristics to remove objects from the scene. These heuristics can be applied regardless of rendering algorithm (local illumination only). I could even apply them to a voxel engine.Guillaumehttps://www.blogger.com/profile/07200624062849242013noreply@blogger.comtag:blogger.com,1999:blog-6950833531562942289.post-63661831138294310882011-09-20T01:58:23.204-07:002011-09-20T01:58:23.204-07:00I agree with most of your post, ray-tracing leaves...I agree with most of your post, ray-tracing leaves the perfect world of absolute parallel heaven when bounding volumes and shading are implemented. However, you are absolutely wrong about one thing:<br /><br />"If we write things in "theory", or rather, with a theory based on an over-simplistic model, if we are idiots, raytracing wins..."<br /><br />That's like saying that a child who doesn't know something is stupid or an idiot.<br />People who reach a wrong conclusion based on the knowledge they currently have does not make them idiots. This is part of the learning process for EVERY SINGLE HUMAN BEING. <br /><br />It really bothers me when people throw insults in their posts. I figure that if the guy who wrote the blog post about ray tracing on alt dev follows your blog he wouldn't be very happy if he feels that you are calling him an idiot.Viktorhttps://www.blogger.com/profile/09475223830485383319noreply@blogger.comtag:blogger.com,1999:blog-6950833531562942289.post-64290694618774452392011-09-20T00:10:38.962-07:002011-09-20T00:10:38.962-07:00In realtime or offline? In realtime I think it'...In realtime or offline? In realtime I think it's extremely optimistic, but we'll see I guess. Your considerations about the resolution and so on are true, but they can be reversed even.<br /><br />The number of primitives have been growing a lot and still for realtime rasterization is easily winning on raytracing and it does not seem to want to stop.<br /><br />Again, for me the offline is a good glimpse into the future. And the offline is hybrid, for the first-hit is still mostly rasterization. Usage of raytracing in movies and such is still quite limited.DEADC0DEhttps://www.blogger.com/profile/01477408942876127202noreply@blogger.comtag:blogger.com,1999:blog-6950833531562942289.post-17630613893894306492011-09-19T22:13:23.214-07:002011-09-19T22:13:23.214-07:00fair enough...
Personally, I think the industry s...fair enough...<br /><br />Personally, I think the industry shift from rasterizing to ray tracing is really close.<br /><br />Mainly because of two trends:<br /><br />- historic trend of the nr of primitives in a scene<br />- historic trend of the nr of pixels on a screen<br /><br />Did you know that for the last 20 yrs, on my desk, and probably yours as well, was a display with 10^6 pixels?<br /><br />On a logarithmic scale, the nr of pixels stay the same!!!<br />from 800x600, to 1920x1080, both roughly 10^6.<br /><br />However, if you look at poly count:<br />In 1991 you would have a 1000 triangle scene max.<br />In 2011 you typically have 1M triangle scenes.<br /><br />Three orders of magnitude difference!<br /><br />Will scene size double for apps in 2013? Yes!<br />Will nr of pixels on your screen double? No!<br /><br />So.... because RT scales linearly with pixel count, it will have an easy time in the future: it's not the pixels that go up, it's the nr of primitives, which ray tracing handles with ease. If Moore's law applied to screen resolutions, ray tracing in real time would never be feasible. But it does not.<br /><br />So my prediction: real time ray tracing going main stream in 2 to 4 years.Bramhttps://www.blogger.com/profile/07666511303597120943noreply@blogger.comtag:blogger.com,1999:blog-6950833531562942289.post-75367654922807170222011-09-19T21:53:48.186-07:002011-09-19T21:53:48.186-07:00Bram: then again, in theory I do believe you can d...Bram: then again, in theory I do believe you can devise an algorithm with logarithmic big-O notation for both. Spatial acceleration ala raytracing on a rasterizer is not going to be as fast, but I don't think it has a different big-O complexity.<br /><br />In practice, I don't care about big-O, I care about performance with current and "foreseeable future" problem sizes, as everyone should do. And we are not yet even at a stage were we do need LogN with rasterization, both the realtime and offline rasterization worlds seem to be living just fine with mostly linear algorithms. They are just that fast.<br /><br />If you're in the few fields were depth complexity, massively occluded scenes, maybe out-of-core rendering is required, then things may be different even right now, but that's a very specific field where rasterization still can do something and again, I don't see the average CG scene approaching problematic depth complexities anytime soon. I don't think Pixar has any plans to kill Reyes, when that will happen then maybe I'll start worrying about raytracing in realtime.DEADC0DEhttps://www.blogger.com/profile/01477408942876127202noreply@blogger.comtag:blogger.com,1999:blog-6950833531562942289.post-26257895408569638942011-09-19T21:41:12.510-07:002011-09-19T21:41:12.510-07:00Sorry,
I read your posting too hastily.
I agree w...Sorry,<br /><br />I read your posting too hastily.<br />I agree with your analysis.<br />And yes, apples vs apples means that the rasterizer should use spatial subdiv as well.<br /><br />However... I still have some doubts though.<br /><br />You have to be careful with sentences like "throw away 80% of the scene" as you put it.<br /><br />In big-O complexity... the 80% is a <b>meaningless</b> detail!<br /><br />If culling gives the rasterizer 80% less work, or factor 5 speedup... who cares? The nr of operations will be O(N/5) which is still O(N).<br /><br />Constant factor speed ups are of no relevance, if you want to render your billion triangle models.<br /><br />So the question that remains for me: will the spatial subdiv for the rasterizer reduce 'the primitives seen' from N to log(N), if so, I think your whole argument may be valid.<br /><br />Does spatial subdiv help the rasterizer as much as the ray tracer would? Not sure.. you gave some indications on why it would be different.<br /><br />Also I concur: moving scenes is a different kettle of fish, I was referring to static scenes.<br /><br /> BramBramhttps://www.blogger.com/profile/07666511303597120943noreply@blogger.comtag:blogger.com,1999:blog-6950833531562942289.post-91515999984890401042011-09-19T19:55:17.737-07:002011-09-19T19:55:17.737-07:00Also, let me be clear about what I think when I sa...Also, let me be clear about what I think when I say "in practice".<br /><br />If you take even a commercial raytracer and a rasterizer, put one million subpixel triangles on the same spot, yes, the raytracer will smoke the rasterizer and that's the kind of "practice" that lazy researchers and college students writing tests do.<br /><br />I imagine more for example a game engine with maybe some software occlusion culling and some rough spatial subdivision for frustum. And I expect it to throw away 80% of the scene faster than a raytracer would take just to update the acceleration structures (moving objects are still considered a reserach topic in the RT realm). Then some draw ordering, some LODs and the hardware early-z rejection do the rest, and you won't be screaming at your arstists to lower the "depth complexity" of a level.<br /><br />You might object that this won't scale forever. Maybe true, I can't foresee "forever" but we're just scratching the basics of occlusion culling with rasterization, I can see that in the offline world rasterization and LODs are still working great, and even in the state of the art research for rendering massive and occluded models (which is not a common case!) raytracing holds an edge but rasterization is present as well.<br /><br />To wrap it up I'm not denying that raytracing is more conductive to these sorts of optimizations and algorithms than rasterization, it is. It's easier to reason of occlusion and spatial subdivision in that setting.<br /><br />I don't think thought that either in theory, on in the real world, that is a remarkable disadvantage.DEADC0DEhttps://www.blogger.com/profile/01477408942876127202noreply@blogger.comtag:blogger.com,1999:blog-6950833531562942289.post-28746246414100803082011-09-19T18:29:21.794-07:002011-09-19T18:29:21.794-07:00Bram: You surely can think I'm wrong, but I wo...Bram: You surely can think I'm wrong, but I would like you to elaborate a bit more.<br /><br />Do you think that it's not possible to discard primitives in a rasterizer? <br /><br />In theory or in practice? <br /><br />About the theory, I tried to show why I don't think it's true, I think the same complexity arguments about spatial subdivision apply to rasterizing them too.<br /><br />In practice, spatial subdivision is used in raytracers way more than in rasterizers, I agree. And it's true that many raytracers are robust in regards of scene complexity, but also rasterizers have their ways of occlusion culling, which work pretty well... HOMs, if you want to stay inside pure rasterization (as I wrote) but also other techniques (see the recent Umbra 3 stuff at Siggraph2011 for example).DEADC0DEhttps://www.blogger.com/profile/01477408942876127202noreply@blogger.comtag:blogger.com,1999:blog-6950833531562942289.post-24788862022540215922011-09-19T17:47:02.594-07:002011-09-19T17:47:02.594-07:00With all due respect: I think you are wrong.
Ray ...With all due respect: I think you are wrong.<br /><br />Ray tracing can be made almost insensitive to primitive count. That is why ray tracing a billion primitives is faster than rasterizing a billion primitives.<br /><br />Rasterizing is O(N) in N number of primitives.<br />Twice as many primitives, means twice the amount of work. If you double the number of primitives for a ray tracer, the work load is nearly unaffected, and typically goes up by something like 1% or so.<br /><br />This is because of the spatial data structures that allow the ray tracer to discard the bulk of the data.Bramhttps://www.blogger.com/profile/07666511303597120943noreply@blogger.com