those damn secondary rays! back

Board: Board index ‹ Ray tracing ‹ Tools, demos & sources

(L) [2008/09/20] [JohnTsakok] [ those damn secondary rays!] Wayback!

Hey guys,
I've been doing some work on some new tech to get faster, accurate, secondary rays through some new methods.  This is far from finished but I have a prototype win32 binary if you guys are interested in benchmarking on your machines.  It's basically Sponza with full reflection on.  There are no packets or frustums and everything is dispatched to the renderer from the application as single rays (even primary).  I got rid of my fast kd-tree and now use a BVH based structure.  Of course.. more info to come.
thanks
[IMG #1 Image]
demo:
[LINK http://www.eng.uwaterloo.ca/~jtsakok/secondary.zip]
[IMG #1]:Not scraped: https://web.archive.org/web/20080926182243im_/http://www.eng.uwaterloo.ca/~jtsakok/secondary.JPG
(L) [2008/09/21] [greenhybrid] [ those damn secondary rays!] Wayback!

typing "wine secondaray.exe" unfortunately gives me "needs sse3 support" [SMILEY :(] i am really out of date with my box, bwaha.
(L) [2008/09/21] [Stereo] [ those damn secondary rays!] Wayback!

I'm afraid, I can't launch it either. No error message, no nothing. => Missing SSE3 support on my Athlon X2 3800+.  [SMILEY #-o]
(L) [2008/09/21] [Michael77] [ those damn secondary rays!] Wayback!

Works for me on a core 2 quad 6600 and runs at about 8-10 fps. There are some green pixels (NaNs probably) and if I am not mistaken you only use 1 indirection which still produces quite coherent rays. Would be more interesting to see about 6 indirections or so because the really start to get incoherent.
However, I wonder where you use sse3?! I haven´t found any use for it so far. The only thing that is a littlebit helpfull may be the horizontal add, but haven´t really found a good application for it right now.
(L) [2008/09/21] [JohnTsakok] [ those damn secondary rays!] Wayback!

Yah.. Im out of town right now but Ill recompile..
Im not using any special SSE3 instructions so it should work when I reupload.
(L) [2008/09/23] [tarlack] [ those damn secondary rays!] Wayback!

the hadd can be used to compute scalar products of 3D vectors, if you can ensure that the 4th component is 0 :
Code: [LINK # Select all]__m128 tmp = _mm_mul_ps (v1, v2);
tmp = _mm_hadd_ps (tmp, tmp); //(v1.x * v2.x + v1.y * v2.y, v1.z * v2.z, <same thing>)
tmp = _mm_hadd_ps (tmp, tmp); //(v1.x * v2.x + v1.y * v2.y + v1.z * v2.z, <same thing> * 3)

with this you have the dot product replicated in the four floats, which is quite appreciable when you want to normalize a vector, you just have to use
Code: [LINK # Select all]__m128 tmp = _mm_mul_ps (v, v);
tmp = _mm_hadd_ps (tmp, tmp);
tmp = _mm_hadd_ps (tmp, tmp);
return _mm_mul_ps (v, _mm_rsqrt_ps (tmp));

note that there may be faster ways to do this, I would be interested if so !
(L) [2008/09/23] [Guest] [ those damn secondary rays!] Wayback!

Maybe something like normalising 4 vectors at a time using an SOA approach? [SMILEY :P]
(L) [2008/09/23] [tarlack] [ those damn secondary rays!] Wayback!

yes certainly, but that would need a major rewriting of all my renderer which is for the moment purely incoherent  [SMILEY :D]
(L) [2008/09/23] [bouliiii] [ those damn secondary rays!] Wayback!

Or just use the dot product instruction of the XBox 360 [SMILEY :)]
(L) [2008/09/23] [bouliiii] [ those damn secondary rays!] Wayback!

BTW, I am not sure haddps is really fast. Maybe a straightforward implementation using mulss, addss is faster. Don't really know actually. There is also a dot product in the SSE 4.1 instruction set (I never use it since it is only on Penryn). Once again, don't know how it is fast but it seems quite practical since you can choose which component to sum.
[LINK http://en.wikipedia.org/wiki/SSE4]
(L) [2008/09/24] [tbp] [ those damn secondary rays!] Wayback!

The rule of thumb was that all those horizontal ops were - sometimes horribly - slow and most of the time well worth the price trading decoding bandwidth by 'emulating' them with SSE2; but SSE4.x is supposed to behave.

back