Announcement

Collapse
No announcement yet.

Vray texture lookup equivalent

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Vray texture lookup equivalent

    Hi,

    Hopefully I'm asking the right question as I wrap my mind around Vray and shaders. But I'm looking for a texture color lookup equivalent in Vray SDK similar to mental ray's mi_lookup_color_texture function in which I can provide an input image and a UV coordinate and return a color at that point in the image. I see the tex_sampler sample plugin in the SDK installation and I'm starting to step through that, but does this functionality exist in the SDK API itself or is it derived in one of these sample plugin classes/interfaces?

    Thanks,

  • #2
    I suppose that the V-Ray implementation is a bit more circuitous compared to mi_lookup_color_texture(), but a good place to start would be the TexBitmap sample in the SDK (vraysdk/samples/vray_plugins/textures/vray_texbitmap/), which is the texture that we translate File nodes into, and specifically the implementation of its getMappedFilteredColor() method. You will need to provide a BitmapBuffer plugin to serve as the texture source - you can create one as part of your shader if needed.

    Best regards,
    Vlado
    I only act like I know everything, Rogers.

    Comment


    • #3
      Great, thanks.

      I was able to register the 'BitmapBuffer' plugin within my camera plugin to look into my bitmap as a LUT for rgb values.

      However, I have another question. So basically I am referencing this image in the camera plugin as a LUT of positional xyz values that define a 3D projection surface that I'm trying to warp the camera output for. So the LUT is actually an HDR format image (EXR in this case with 32-bit depth channels) in order to store accurate xyz floating point values in the rgb channels. So these values range from -20.0 to 20.0 or so (depending on the scale). However, when I call my bitmap->getColor(uvCoord) and look at color.r, color.g, color.b, the values seem to have a min clamp at 0.0. So all my negative values in the LUT are returned as 0. Of course this makes sense for straight color... but I'm trying to reference the actual raw floating point value stored in these channels.

      I see there is a convention for getting/setting min/max clamp for color but manipulating this to have a larger negative clamp value for min doesn't seem to affect the returned values. So is there something under the hood that is clamping values returned by Color or AColor objects to 0.0. Is there a way to circumvent this? Is there any better way to get the raw floating point value stored within the channels of this LUT?

      Thanks,

      Comment


      • #4
        The BitmapBuffer plugin has a parameter called "allow_negative_colors", make sure to set it to 1.

        Best regards,
        Vlado
        I only act like I know everything, Rogers.

        Comment


        • #5
          Ah, that was my oversight, thanks!

          Comment

          Working...
          X