Sign in to follow this  
VadimZabolotnov

ray trace

Recommended Posts

Hi !

[color=#000000][font=Arial, sans-serif][size=4]What do you think about , below[/size][/font][/color]

[color=#000000][font=Arial, sans-serif][size=4]ray trace engine as[/size][/font][/color]

[color=#000000][font=Arial, sans-serif][size=4]ray depth - 0 - raysterization[/size][/font][/color]
[color=#000000][font=Arial, sans-serif][size=4]ray depth - 1 - ray tracing[/size][/font][/color]

[color=#000000][font=Arial, sans-serif][size=4]?[/size][/font][/color]

[color=#000000][font=Arial, sans-serif][size=4]And for more I have some ideas about optimizations for ray depth - 1.[/size][/font][/color]

[color=#000000][font=Arial, sans-serif][size=4]If you interested about it I 'am write it.[/size][/font][/color]

Share this post


Link to post
Share on other sites
I don't know, it's nice for now as it takes advantage of very fast rasterization hardware already present in GPU's, but once (and if) special-purpose ray-tracing hardware is developed, this step should be unnecessary. It's also quite redundant on any other hardware than graphics cards. I suppose it's good to have, but the ray-tracing problem has pretty much been solved in theory, all we need now is cheap and efficient ray-tracing hardware so that it can actually compete on equal grounds with real-time rasterization.

That said, the one advantage of rasterization is that the memory access pattern is completely predictable (which is partly why it is so fast on special-purpose hardware), whereas in ray-tracing it is rather random, so it makes sense to use rasterization on high-latency/high-throughput memory hardware like GDDR5.

Another is that the performance of rasterization does not depend too much on resolution, but it does depend on scene complexity linearly (it's the opposite for ray-tracing). As scenes get more and more complex rasterization may become prohibitively expensive even with rasterization hardware, forcing a switch to fully ray-traced graphics (but I doubt it, as user resolution increases considerably faster than scene complexity).

A drawback of rasterization is that it cannot represent implicit surfaces without triangulating them explicitly first (and hence paying the storage tradeoff). Ray-tracing can, however depending on the surface's complexity the analytical intersection formula may be too expensive to compute anyway. This is mostly for spheres, cylinders, toruses, and simple shapes like that.

[quote]And for more I have some ideas about optimizations for ray depth - 1.[/quote]
Don't hesitate to post them, I'm sure there are many people on this board interested (including me)!

Share this post


Link to post
Share on other sites
[b] [url="http://www.gamedev.net/user/181063-bacterius/"]Bacterius[/url], Ok. for ray depth-1.[/b]

1) Polygons on screen is dividing to somes small squares. (around 16 pixels for example)

2) All vertices from all polygons are traced using sah bvh.

3.1) For all subpolygons find last bvh node which are intersected by all subpolygon vertices.

3.2) Trace other subpolygons points from founded lasts bvh nodes .

This in theory )) But , I have example for ray depth-0 where using triangles instead bvh nodes. and I have speed up to something around of 7.5x. ( for[color=#000000][font=verdana, arial, sans-serif][size=3] camera distance - 20.5 [/size][/font][/color]).

in detail, below
1) ray trace each forth (for example) pixels for horizontal and vertical ( [1280x960] -> [320x240] ) .
2) if all four pixels intersects one triangle - check intersection for other (12) pixels for this triangle only.

base (ray tracer ) . cuda. (push for download - "???????")
[url="http://www.gamedev.ru/files/?id=71921"]http://www.gamedev.ru/files/?id=71921[/url]

optimazed - as I described in detail (ray tracer ) . cuda. (push for download - "???????")
[url="http://www.gamedev.ru/files/?id=78149"]http://www.gamedev.ru/files/?id=78149[/url]
(may bugs on some devices)

I have also version for opencl. but I'am not complited optimizations for this yet.


[b] [url="http://www.gamedev.net/user/118803-invalidpointer/"]InvalidPointer[/url], where I can read about rasterizations before ray tracing for gpgpu ? [/b]

I saw only [url="http://research.nvidia.com/publication/high-performance-software-rasterization-gpus"]http://research.nvid...terization-gpus[/url]

I have no saw optimizations for ray trace depth -0 in optiX ver 2.1.1 . Edited by xma

Share this post


Link to post
Share on other sites
[quote name='xma' timestamp='1341252769' post='4954980']
Hi !

[color=#000000][font=Arial, sans-serif][size=4]What do you think about , below[/size][/font][/color]

[color=#000000][font=Arial, sans-serif][size=4]ray trace engine as[/size][/font][/color]

[color=#000000][font=Arial, sans-serif][size=4]ray depth - 0 - raysterization[/size][/font][/color]
[color=#000000][font=Arial, sans-serif][size=4]ray depth - 1 - ray tracing[/size][/font][/color]

[color=#000000][font=Arial, sans-serif][size=4]?[/size][/font][/color]
[/quote]

I've worked extensively on that approach in the past and I can tell you it works well. Rasterizing the scene for depth=0 gives you a nice performance improvement because it allows you to skip one tracing step. However, depth = 0 is the easiest and less expensive step because the rays are coherent. For depth > 0, the rays can get highly incoherent and will be the bottleneck of the rendering thus the advantages of using rasterization for the first step may become a lesser optimization.
Of course, all this depends on what kind of rendering complexity you're aiming at. In my case, I used ray tracing to complement the GPU rendered scene with a single bounce of ray-traced reflections which worked pretty well and fast. If you're interested, check my master thesis for details: [url="http://voltaico.net/serenity.html"]http://voltaico.net/serenity.html[/url]

Share this post


Link to post
Share on other sites
[b] [url="http://www.gamedev.net/user/50462-jcabeleira/"]jcabeleira[/url], how dou you combain rasterization and ray tracing ? [/b]
[b] do you realise rasterization on gpgpu?[/b]
on your screenshots are not visible reflections.
[b] What do you think about described about depth-1 optimization ?[/b] Edited by xma

Share this post


Link to post
Share on other sites
Might I suggest using beam tracing if you're going to go this route. [url="http://research.microsoft.com/apps/pubs/default.aspx?id=70423"]Microsoft actually has a paper on it[/url]. That's the non-linear version. The linear version is still complex. Tends to outperform raytracing solutions. Edited by Sirisian

Share this post


Link to post
Share on other sites
Excuse my ignorance, does depth 0 mean areas where no ray hits, e.g. the skybox? Or does it mean the first hit for each pixel and then we continue raytracing from there?

Share this post


Link to post
Share on other sites
[quote name='xma' timestamp='1341315039' post='4955242']
[b] [url="http://www.gamedev.net/user/181063-bacterius/"]Bacterius[/url], Ok. for ray depth-1.[/b]

1) Polygons on screen is dividing to somes small squares. (around 16 pixels for example)

2) All points from all polygons are traced using sah bvh.

3.1) For all subpolygons find last bvh node which are intersected by all subpolygon vertices.

3.2) Trace other subpolygons points from founded lasts bvh nodes .
...
[/quote]

You can't assume that if I trace a ray A in the general direction/origin of a bunch of other rays B, I only have to test intersection vs objects close to the first intersection of rays B.

Share this post


Link to post
Share on other sites
I do something like that, I use the usualy DX11 pipeline to rasterize the scene, I also create a voxelspace and then (using direct compute) I ray trace through the voxel space to create ambient occlusion:
http://twitpic.com/8iohd5/full

I am working since some months on a more advanced version, using tracing for the whole lighting solution as well as for transparent objects and volumetric effects, but as jcabeleira said, the first hit is the simpelst and fastest pass, beside that it also is quite important for anti aliasing, so you either have to render with a very high resolution und trace for sub pixel, or you end up with aliasing. On problem with the same reason is that HDR rendering can produce neighbouring pixel with very different magnitudes of light intensity. without high AA that you just can get through raytracing, you will see aliasing. you can of course try the hacky way of sperating tonemapping and resolve before gamma correction, but it's kind of breaking the purpose of using raytracing (high quality and correct images).

There are some games that trace in screen space through the gbuffer for some local reflections and more advance occlusion/shadow checks.

Share this post


Link to post
Share on other sites
[b] [url="http://www.gamedev.net/user/161370-jefferytitan/"]jefferytitan[/url], it mean the first hit for each pixel and then we continue raytracing from there . [/b]

[b] [url="http://www.gamedev.net/user/132352-jameszhao00/"]jameszhao00[/url], all bounding rays lies in one nearest to interected polygons bvh node. We may have artefacts only with small objects on this trace way. Or what are you about ? I don't understand you.[/b]
[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][size=3][left][background=rgb(247, 247, 247)]2) All VERTICES from all polygons are traced using sah bvh[/background][/left][/size][/font][/color] Edited by xma

Share this post


Link to post
Share on other sites
[quote name='xma' timestamp='1341315039' post='4955242']
InvalidPointer, where I can read about rasterizations before ray tracing for gpgpu ?
[/quote]

Doing a bit more research, it appears I was mistaken-- I think there were specific demos that used the approach rather than it being integrated into OptiX itself. The theory is pretty simple, for the most part; remember that a basic rasterized/depth-tested scene is pretty literally the set of first-hit junctures for each of the 'eye rays' in the final picture. So long as you have that depth and the camera information, you have sufficient data to reconstruct the world-space position of that particular part of the world. You can then feed those hit points into a more traditional ray-tracing architecture for secondary bounces.

EDIT: Upon further review I may be preaching to the converted here, but let me see if I can dig up the demo(s) in question. Edited by InvalidPointer

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this