Raytracing, vertex culling, Alexander Reshetov's code

Started by Mark_Larson, September 15, 2008, 02:48:26 PM

Previous topic - Next topic

Mark_Larson


    * Edit post
    * Report this post
    * Reply with quote

"Faster Ray Packets-Triangle Intersection Through Vertex Cul

Postby Mark_Larson on Sat Aug 30, 2008 6:40 am
Here is the new thread. I already got the code. I am currently adding support for Linux. It will be able to compile under both Linux and Windows. Got the #defines from tbp's alphablend code.

let's discuss how we can speed it up once I get it converted. Dr Eck? Can I email the code to others? I just wanted to check first. I don't have a website to post it at. Unless someone volunteers to host it.

I need to make changes to how they are timing the code to make it more accurate. They are doing a CPUID and then a RDTSC. They didn't boost the priority or time an empty loop to subtract the loop overhead.
BIOS programmers do it fastest ;)

Mark_Larson
     

        * Private message
        * Website
        * YIM

Top

    * Report this post
    * Reply with quote

Re: "Faster Ray Packets-Triangle Intersection Through Vertex Cul

Postby syoyo on Wed Sep 03, 2008 8:09 am

    Mark_Larson wrote:Here is the new thread. I already got the code. I am currently adding support for Linux. It will be able to compile under both Linux and Windows. Got the #defines from tbp's alphablend code.

    let's discuss how we can speed it up once I get it converted. Dr Eck? Can I email the code to others? I just wanted to check first. I don't have a website to post it at. Unless someone volunteers to host it.

    I need to make changes to how they are timing the code to make it more accurate. They are doing a CPUID and then a RDTSC. They didn't boost the priority or time an empty loop to subtract the loop overhead.



Here's my VC + BVH code. VC code is ported to gcc so it run on Linux and Mac OS X properly.

http://lucille.svn.sourceforge.net/svnr ... /eleonore/
http://www.slideshare.net/syoyo/vertex- ... ?src=embed
(Algorithm illustration)

On code hosting. github or gist would be the good place.
http://github.com/
http://gist.github.com/

User avatar
syoyo
     

        * Private message
        * Website

Top

    * Edit post
    * Report this post
    * Reply with quote

Re: "Faster Ray Packets-Triangle Intersection Through Vertex Cul

Postby Mark_Larson on Wed Sep 03, 2008 8:33 am

    syoyo wrote:

        Mark_Larson wrote:Here is the new thread. I already got the code. I am currently adding support for Linux. It will be able to compile under both Linux and Windows. Got the #defines from tbp's alphablend code.

        let's discuss how we can speed it up once I get it converted. Dr Eck? Can I email the code to others? I just wanted to check first. I don't have a website to post it at. Unless someone volunteers to host it.

        I need to make changes to how they are timing the code to make it more accurate. They are doing a CPUID and then a RDTSC. They didn't boost the priority or time an empty loop to subtract the loop overhead.



    Here's my VC + BVH code. VC code is ported to gcc so it run on Linux and Mac OS X properly.

    http://lucille.svn.sourceforge.net/svnr ... /eleonore/
    http://www.slideshare.net/syoyo/vertex- ... ?src=embed
    (Algorithm illustration)

    On code hosting. github or gist would be the good place.
    http://github.com/
    http://gist.github.com/




thanks :) The last time I was here a year ago, you couldn't upload files to the forum. You now can. So I don't need to host it, but thanks :)

I'll look at your BVH code after I get his stuff working under Linux with gcc. icc already works. He had added support for VC++ and icc.
BIOS programmers do it fastest ;)

Mark_Larson
     

        * Private message
        * Website
        * YIM

Top

    * Report this post
    * Reply with quote

Re: "Faster Ray Packets-Triangle Intersection Through Vertex Cul

Postby syoyo on Wed Sep 03, 2008 9:37 am

    Mark_Larson wrote:
    thanks :) The last time I was here a year ago, you couldn't upload files to the forum. You now can. So I don't need to host it, but thanks :)



ompf's thread is filled so rapidly(because there are a lot of smart guys here), I sometimes couldn't catch up with a thread and miss it :wink:

User avatar
syoyo
     

        * Private message
        * Website

Top

    * Report this post
    * Reply with quote

Re: "Faster Ray Packets-Triangle Intersection Through Vertex Cul

Postby jogshy on Wed Sep 03, 2008 8:24 pm
very interesting, thanks
"The force is illogical" - Mr.Spock -

User avatar
jogshy
     
    Location: Spain

        * Private message
        * Website

Top

    * Edit post
    * Report this post
    * Reply with quote

Re: "Faster Ray Packets-Triangle Intersection Through Vertex Cul

Postby Mark_Larson on Thu Sep 04, 2008 2:41 pm
I heard back from the author of the code in email. I asked him if I could post his code. I haven't heard back from him.

I have an Athlon 64 running Windows. It's an older computer. I ran the code with the optimization flags he suggests in his PDF.

Code: Select all
      /O3 /QxT ( which I actually think are for ICC and not MSVC, but it gives the same compiler flags for both compilers)



I got 49.751625 cycles with those flags.

So then I went through and tried a wide assortment of flags.

Code: Select all
    /fp:fast is like fastmath.
    /GL is enable link time code optimization.
    /Ox turns on maximum optimizations.  This one gave the BIGGEST speed up by far.
    And then I boosted the process and thread priority to HIGH for both.
    cl -o resh /GL /fp:fast /Ox Reshetov_mark.cpp


the new time is 5.522560 cycles. Again my processor under Windows 32-bit is an Athlon 64.
BIOS programmers do it fastest ;)

Mark_Larson
     

        * Private message
        * Website
        * YIM

Top

    * Edit post
    * Report this post
    * Reply with quote

Re: "Faster Ray Packets-Triangle Intersection Through Vertex Cul

Postby Mark_Larson on Fri Sep 05, 2008 11:05 am
The writer of the code is on a business trip and finally contacted me. It turns out the code is under a NDA, and I will have to sign a NDA with him. That also means I can't post the code here. I responded to him if I could grab the code from the PDF and use that here instead. So I am waiting to hear back. I"ll keep you guys updated.

Mark
BIOS programmers do it fastest ;)

Mark_Larson
     

        * Private message
        * Website
        * YIM

Top

    * Report this post
    * Reply with quote

Re: "Faster Ray Packets-Triangle Intersection Through Vertex Cul

Postby Phantom on Tue Sep 09, 2008 10:58 am
Jumping in here from nowhere:

Are you talking about Alexander Reshetov's code? What could possibly be wrong with doing a human-based OCR of a public paper and posting the result on a forum?
--------------------------------------------------------------
Arauna - Game-oriented real-time ray tracing
http://igad.nhtv.nl/~bikker

Phantom
    Overlord
     
    Location: Houten, Netherlands

        * Private message
        * Website

Top

    * Report this post
    * Reply with quote

Re: "Faster Ray Packets-Triangle Intersection Through Vertex Cul

Postby greenhybrid on Sun Sep 14, 2008 8:49 am

    Phantom wrote:Jumping in here from nowhere:

    Are you talking about Alexander Reshetov's code? What could possibly be wrong with doing a human-based OCR of a public paper and posting the result on a forum?



NDA is NDA. Intellectual Property is non-sense, but existent. There was that Shared Source program by Microsoft, enabling peer-review. Nevertheless you were not allowed to modify and reuse the code. And as long as you didn't pay a plethora of money to them, the Microsoft-Dudes wouldn't have modified the code for you, so the code was open, but still useless.

If you transcribe code from the paper it is effectively the same as scanning/ocr'ing or copy+pasting it. Copy is Copy.
greenhybrid.net | picogen.org
1. For any SetPixel thou have called, thy life shalt end in eternal fire a 1024 times.
2. Thou shalt summon a Buffer, in a single breath with a Spell of Alignment.
3. A Pointer into thy Aligned Buffer saves thee and thy Spirit.

User avatar
greenhybrid
     
    Location: Germany -> NRW -> Nettetal

        * Private message
        * Website
        * Jabber

Top

    * Report this post
    * Reply with quote

Re: "Faster Ray Packets-Triangle Intersection Through Vertex Cul

Postby Nobody's-IP on Mon Sep 15, 2008 6:26 am

    greenhybrid wrote:Intellectual Property is non-sense, but existent.



I fully agree. If you don't want others to learn from you, just don't teach them anything. Keep your ideas for yourself. This IP business is completely silly. It's like: "Look, I have a nice idea, it's this and that. But you can't use it. You aren't allowed to extend it. And if you dare you have to pay a million bucks or go to jail. I really never wanted someone else to use my brilliant ideas but I wan't to show off how smart I am. By the way: my company patented "being smart" so you have to pay license fees to even understand what it means when I tell you that I'm smarter than you..."

If this IP lobby existed in the past, we would still sit on trees.

Nobody's-IP
     

Top

    * Report this post
    * Reply with quote

Re: "Faster Ray Packets-Triangle Intersection Through Vertex Cul

Postby Shadow007 on Mon Sep 15, 2008 7:01 am

    greenhybrid wrote:NDA is NDA. ...


NDA is NDA ... as in Non-Disclosure Agreement ... right ? For me, NDAs are there to protect trade secrets, and confidential informations. The author (and Intel Corporation) already displosed the information to the public by publishing the document and presenting it at the conference... So I don't get it where an NDA applies.

There are two other possible protections : Patents, and Copyright. I don't know if Intel and Reshetov patented the algorithm, but as far as I can tell, here in europe it should have no meaning/value.

As greenhybrid puts it,

    greenhybrid wrote:If you transcribe code from the paper it is effectively the same as scanning/ocr'ing or copy+pasting it. Copy is Copy.

Yes, there is a "problem" with copyright, in that the author has rights to his "code", and scanning/ocr'ing/transcribing without his assent would be the same : simply copyright infringement...

It leaves one option : clean-room re-implementation, which I think most of you guys could do without much problems, given that all the algorithmic details are described in the paper...

Shadow007
     

        * Private message

BIOS programmers do it fastest, hehe.  ;)

My Optimization webpage
htttp://www.website.masmforum.com/mark/index.htm

Mark_Larson

The author got my NDA, and I am speeding up his code.  I am looking at writing my own code, after I understand better how his works.

just keeping ya'll updated.
BIOS programmers do it fastest, hehe.  ;)

My Optimization webpage
htttp://www.website.masmforum.com/mark/index.htm

Mark_Larson

there is actually a very interesting discussion on another board about this topic with the author of the code.  The author works at Id.  And he is the one I signed the NDA with.  They are looking at doing raycasting( not tracing) for parts of the scene.  There is a pdf that goes into detail how it works.  You can search for the PDF.  The name of the article is.
"Faster Ray Packets-Triangle Intersection Through Vertex Culling"

The PDF actually has code in it at the very end.  So you can see a simple implementation.

here is a slideshow of it
http://www.slideshare.net/syoyo/vertex-culling-illustration-at-sbr07/



the Id guys name on the board is Zelex.  His real name is Jon Olick.  I highly recommend you read the board messages, to get an better idea how the code is actually supposed to work.

http://ompf.org/forum/viewtopic.php?f=3&t=904

This will give people a starting point to understand
BIOS programmers do it fastest, hehe.  ;)

My Optimization webpage
htttp://www.website.masmforum.com/mark/index.htm