Results 1 to 6 of 6

Thread: raytracing during lightmap phase not working with animated camera...

  1. #1
    Join Date
    Aug 2005
    Posts
    169

    Default raytracing during lightmap phase not working with animated camera...

    I have a case where I'm raytracing in a lightmap shader and raytraced shadows are failing. Every object in the scene is set to cast shadows, but some objects weren't casting any shadows. It seems to be related to the camera's instance having a motion transformation. If I turn motion off, or remove the motion transformation from the camera then everything works. I should also mention it seems to be dependent upon the number of instances in the scene (although I've yet to figure out what the limit is), as when I select only a few instances to render they also render correctly (even with motion enabled). Changing the primary renderer from scanline to raytrace also works but introduces other problems (unrelated to this, perhaps I'll start another thread for that).

    Is there anything I can do other than setting mi_state_set_pri (which is the only thing I'm aware of that needs to be done to be able to reliably raytrace from within a lightmap shader)?

    Thanks in advance.

  2. #2
    Join Date
    Dec 2004
    Location
    Marina Del Rey, California
    Posts
    2,916

    Default

    What version are you working with?

    Scanline on is now (mr 3.10, AD 1013 apps) deprecated. Perhaps we should focus on your issues when you turn it off.

    Using bsp2?
    Barton Gawboy
    Training and Special Projects, NVIDIA ARC
    LAmrUG Forum Originator

  3. #3
    Join Date
    Aug 2005
    Posts
    169

    Default

    Hi Bart. It's 3.9 and yes I'm using bsp2. The other problem I was having after switching to raytrace is that it seems like the camera's motion transform isn't multiplied with the instance motion transform. So my motion vectors were NULL and I wasn't getting any motion blur in post. Not sure how to deal with that in my shader.

  4. #4
    Join Date
    Aug 2005
    Posts
    169

    Default

    I guess just try to determine if the primary renderer is scanline/raytrace, and then if scanline do the transformation myself?

  5. #5
    Join Date
    Jan 2007
    Location
    Berlin, Germany
    Posts
    90

    Default

    Hi Scissor,

    With scanline on / rasterizer, mental ray applies the inverse of the camera motion to the root of the scene, so that everything in the scene starts to move. In general, that has a strong negative impact on the performance. This was one of the reason for deprecating "scanline on".

    In mental ray 3.10, we have added a sting option "trace camera motion vectors" . If enabled, the motion component originated from the camera motion is added to the motion frambuffers / miState::motion passed to shaders.
    So, in 3.10 using scanline off + BSP2 and the string option would be a workaround for you.

    Another possible 3.9/3.10 workaround is to render the lightmap with scanline off, and then render the images with scanline on in a different frame.

    As for the missing shadows, there have been several fixes in 3.10, it is not clear if/which one could be relevant for your scene. A list of things which you could try out the following in 3.9:
    - use simple shadows mode instead of segmented/sorted shadows
    - do not use single-face (face front or face back) objects
    - increase bounding boxes of the missing-shadow objects
    - if you use multiply-instanced geometry, avoid more than 9 instances per object (this switches internal BSP2 code path). Create additional copies of objects if needed.
    May be one of these would help. A general recommendation is to update to 3.10.

    Best regards,
    Juri

  6. #6
    Join Date
    Aug 2005
    Posts
    169

    Default

    Thanks Juri, unfortunately moving to 3.10 isn't an option at this point. The 2 pass approach is a possibility but not preferred. Is it not possible to determine that we're in trace mode and then manually figure out the transformations and then encode my motion vectors framebuffer so it accounts for object deformation/transformation as well as camera transformation?

Posting Permissions

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