Results 1 to 6 of 6

Thread: How to get UV derivatives wrt screen space axis?

Hybrid View

  1. #1
    Join Date
    May 2012
    Location
    Taipei, Taiwan
    Posts
    10

    Default How to get UV derivatives wrt screen space axis?

    Hi to all,

    I'm trying to write a mr Ptex shader for Maya 2012.
    In the ptex API, the inputs for filter eval function include two vectors that are the UV derivatives (du/da, dv/da) and (du/db, dv/db), where a and b are screen coordinates.
    My question is how can I get those derivatives in a mr shader?

    Thank you very much for your help

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

    Default

    Have you checked the latest documentation on mi_query which will give query codes for those?

    I'm curious as to what we might be missing in our standard ptex shader that forces you to make your own. Or, are you writing it only because you are in Maya 2012 instead of Maya 2013?
    Barton Gawboy
    Training and Special Projects, NVIDIA ARC
    LAmrUG Forum Originator

  3. #3
    Join Date
    May 2012
    Location
    Taipei, Taiwan
    Posts
    10

    Default

    Hi bart,

    Thank you for answering!
    I've checked the documentation on mi_query but I can't find what I want.
    The only query code I found similar are miQ_PRI_VERTICES_DERIVS_* but I don't think these are UV derivatives with respect to screen space. And I think those are similar to state->derivs[].
    Do I miss or misunderstand something?

    Thanks for your help again!

    BTW, yes we are in Maya 2012 so we need to write our own Ptex shader.

  4. #4

    Default

    The query call you are looking for is
    miQ_PRI_UV_DIFFERENTIALS
    It returns an array of four floats, duv_dx in the first two entries, followed by duv_dy.
    For Ptex you would also need miQ_PRI_SDS_UV (returns barycentric coordinates within the base level
    face, and the base face index).
    We could post the code how to set up the values for PtexFilter::eval, however it makes not much sense
    because if you have a version of mental ray which provides these query calls you also have access to our
    Ptex lookup shader.
    Without these query calls there is not really a chance to implement it in a shader. Too many things have to
    be taken into account (region splitting, displacement, approximation etc).

    Gunter

  5. #5
    Join Date
    Feb 2012
    Location
    New York, NY
    Posts
    27

    Default

    rockneptune,

    Check Nico Rehberg's page here - looks like he developed one that works in Maya 2012 (with limitations, I think). I haven't tried it myself, just came across it when I was getting the HOT update for Maya 2013. Good luck,

    -Nick

  6. #6
    Join Date
    May 2012
    Location
    Taipei, Taiwan
    Posts
    10

    Default

    Thank you guys! For all the responses!

    Actually I've already wrote one(with limitations, too) which is very similar to Nico's.
    I'm just trying to do screen align filtering.
    I'll try to figure out what else I can do.
    Anyway, thanks!

Posting Permissions

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