Results 1 to 4 of 4

Thread: Ray tracing in Lightwave -- some issues

  1. #1
    Super Member Captain Obvious's Avatar
    Join Date
    Dec 2004
    Location
    London
    Posts
    4,502

    Ray tracing in Lightwave -- some issues

    I've been building an "exposed edges" shader using the node system, but I got this strange issue. Basically, I was trying to use ambient occlusion that's offset from the surface by the surface normal, and then flipped, so it's firing back on itself. Conceptually, it worked fine, but it tends to show the wireframe of the mesh in some situations. I couldn't figure out a way to avoid it, so I set out to build my own shader (not compiled or anything; it's all done with the RayCast node and some math nodes). Basically, what it does is this:

    For every spot, it will create N rays, each one starting along the periferi of a circle that's placed as a tangent plane to the surface normal. These rays fire along the inverted surface normal, so they all fire "backwards." I got it working just fine, but then I noticed a problem, most likely the cause of my issues with the occlusion nodes:

    Any ray fired in Lightwave will pass through the polygon that spawned it! I then did a simple test:

    For each spot, fire a ray from (w.Pos + surface normal), heading in the direction of (surface normal * -1.0). When this was applied to a 1 m cube, each spot should return a value of 1.0. Each ray is offset from the surface by 1 meter (since the surface normal has an amplitude of 1 meter), and is fired back towards the surface. The ray length SHOULD then be 1 meter, but instead, the length is 2 meters! If the cube is scaled down to 0.5 meters, it returns 1.5 meters. Ie, the length returned is the surface normal amplitude PLUS the thickness of the object.

    If I clone the object and make the original unseen by rays and the clone unseen by camera, I get the expected results.

    I have no doubt that this is the cause of the wireframe showing through with my ambient occlusion shaders, as well.

    So, NewTek and shader developers, is there a way of telling the ray tracer NOT to behave like this? Many of my shaders depend upon any ray being able to intersect with any polygon, including the one that spawned it.
    Are my spline guides showing?

  2. #2
    obfuscated SDK hacker Lightwolf's Avatar
    Join Date
    Feb 2003
    Location
    Stuttgart, Germany
    Posts
    13,659
    Quote Originally Posted by Captain Obvious View Post
    So, NewTek and shader developers, is there a way of telling the ray tracer NOT to behave like this?
    Now doesn't that whole idea sound familiar?

    Erm, yes, there are flags in the SDK to be used with the new raytracing functions. Have a look at the 9.5 or 9.5.1 SDK - the chapter about the Raytracing functions.

    Cheers,
    Mike

  3. #3
    Super Member Captain Obvious's Avatar
    Join Date
    Dec 2004
    Location
    London
    Posts
    4,502
    We're stuck with 9.3.1 at the moment, unfortunately. Are the flags new for 9.5?
    Are my spline guides showing?

  4. #4
    obfuscated SDK hacker Lightwolf's Avatar
    Join Date
    Feb 2003
    Location
    Stuttgart, Germany
    Posts
    13,659
    Quote Originally Posted by Captain Obvious View Post
    We're stuck with 9.3.1 at the moment, unfortunately. Are the flags new for 9.5?
    Yes. Apparently a lot has been revamped to speed up raytracing in general.

    Cheers,
    Mike

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •