Does VRay API provide Du() Dv() functions and dPdu dPdv primitive variables ?

hi,

I’m implementing a parallax shader and that has to take use of these functions & variables to calculate the local tangent space of shading point. I just find primitive variables provided by VRay SDK are dPdx and dPdy. Dose VRay SDK provide the functions & primitives mentioned as title ?

I find that there’s a function called “computeTangentVectors” in misc_ray.h but the calculation different from i’ve ever seen in renderman, i remember in renderman the tangent vectors along s and t are calculated as follows:
vector along t = Du(t)*dPdu + Dv(t)*dPdv
vector along s = Du(s)*dPdu + Dv(s)*dPdv

So the questions about this issus are:
1. Does the “computeTangentVectors” do exactly the same thing ?
2. Does this function also work if i pass in a bumped normal vector rather than geometry normal ?
3. What space should i convert the normal vector to before passing to the function ?
4. If VRay don’t provide infomation such as dv & dv, is it possible to retrieve the area of mircopolygon ?

No.

4. is it possible to retrieve the area of mircopolygon ?No. V-Ray does not work with micropolygons.

With that said, in order to get two vectors along the U and V spaces for a specific UVW mapping channel, you can use the following code (keep in mind that internally V-Ray works in (offset) world space):```
VR::MappedSurface *mappedSurf=static_castVR::MappedSurface*(GET_INTERFACE(rc.rayresult.sd, EXT_MAPPED_SURFACE));
if (mappedSurf) {
// getLocalUVWTransform() returns a Transform where:
// *) The offset contains the UVW coordinates of the shaded point.
// *) The matrix portion contains a matrix that transforms differential vectors from
// world space to UVW space.
VR::Transform tm=mappedSurf->getLocalUVWTransform(rc, -1);

// By inverting the matrix, we get a matrix that transforms from differential UVW space
// to world space.
tm.m.makeInverse0f();

VR::Vector along_u=tm.m[0]; // The U direction is the first column of the matrix.
VR::Vector along_v=tm.m[1]; // The V direction is the second column of the matrix.

}


Let me know if this helps.

Best regards,
Vlado