Announcement

Collapse
No announcement yet.

SamplerInfo texture seems to work differently with Bake to texture & Render elements

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

  • SamplerInfo texture seems to work differently with Bake to texture & Render elements

    Hi there,

    In order to export world space normals of my whole scene (with bump mapping), I use the SamplerInfo texture from the Render elements. But whatever I do, the negative values are never stored in my saved image (EXR half floating point). I tried to use the SamplerInfo texture in the "Bake to texture" tool, and then the result is as expected (it shows black negative values).

    Click image for larger version

Name:	VraySamplerInfo.jpg
Views:	252
Size:	241.0 KB
ID:	1134147
    Left: SamplerInfo in Bake to texture tool. Negative values are black. Saved to EXR and verified in Photoshop, negative values are conserved.
    Right: SamplerInfo in Render elements. Negative values exist (I see them with the picker of the frame buffer) BUT they are not black. Saved to EXR and verified in Photoshop, negative values doesn't exist anymore.

    Both SamplerInfo textures are set to signed (vector).

    Is there some clampling occuring during the save process? Or am I missing something?

  • #2
    First of all, the ExtraTex + SamplerInfoTex previews RGB values, whereas the SamplerInfo displays vectors. Also, if you're saving through the "Separate render channels" option (which goes through the 3ds Max native output options) vectors are going to be saved as RGB colors [0-1] (check the overview on the docs page). And finally, the Vector (signed) works only for multi-channel EXRs, which we should probably include this information on the documentation page as well. I think you can remap the values in Nuke via a Grade node or you can simply save out the image as a multi-channel EXR.
    Aleksandar Hadzhiev | chaos.com
    Chaos Support Representative | contact us

    Comment


    • #3
      Thank you for your answer!

      Originally posted by hermit.crab View Post
      First of all, the ExtraTex + SamplerInfoTex previews RGB values, whereas the SamplerInfo displays vectors. Also, if you're saving through the "Separate render channels" option (which goes through the 3ds Max native output options) [URL="https://docs.chaos.com/display/VMAYA/Normals"]vectors are going to be saved as RGB colors [0-1]
      I don't use the ExtraTex here. Tell me if I'm wrong, but in my case, as you can see above, the SamplerInfoTex (left image) previews vectors (black areas with negative values). And the SamplerInfo (render elements, right image) displays RGB color (but the eyedropper still shows negative values). I'm not saving through the Separate render channel but directy from the Vray frame buffer window (but maybe it's all the same).

      Originally posted by hermit.crab View Post
      And finally, the Vector (signed) works only for multi-channel EXRs
      However, it seems that I can save a signed EXR without the multi-channel enabled: when the SamplerInfoTex is rendered by the Bake to texture tool (the left image of my 1st post). If I open the EXR with Photoshop, the negative values are still there.
      I find it strange that the frame buffer displays negative values with the eyedropper but convert these to positive values when saving to a floating point format. It's confusing, no?
      Click image for larger version

Name:	Untitled-2.jpg
Views:	258
Size:	223.2 KB
ID:	1134185

      Is there no way to force the frame buffer to display (in black) and save negative values, like the same frame buffer does perfectly when SamplerInfoTex is rendered with the Bake to texture ?

      My EXR file is for Unity. I'm not sure multi-channel works in this case. And yes I could remap it directly in my shader, but it it will add some extra work to the GPU, that's why I would like to get it directly from Vray. But I'll go this way if there is no other solution.

      Comment


      • #4
        I don't use the ExtraTex here. Tell me if I'm wrong, but in my case, as you can see above, the SamplerInfoTex (left image) previews vectors (black areas with negative values). And the SamplerInfo (render elements, right image) displays RGB color (but the eyedropper still shows negative values). I'm not saving through the Separate render channel but directy from the Vray frame buffer window (but maybe it's all the same).
        Not sure how you're baking the VRaySamplerTex then, but that doesn't matter since you can reproduce the behavior without baking as well (SamplerTex in ExtraTex RE). Both images have identical pixel values (you can easily confirm by just comparing the ExtraTex with the SamplerInfo elements).
        By preview, I mean how the pixels are displayed (and what they represent). That being said, it's actually the other way around as mentioned earlier. An easy way to determine this is by looking at the (0,0,0) background which in RGB terms represents pure black, unlike vector values. Also, when previewing elements in the VFB - the RGB color value are colored, whereas data (vector) values are grey.

        However, it seems that I can save a signed EXR without the multi-channel enabled: when the SamplerInfoTex is rendered by the Bake to texture tool (the left image of my 1st post). If I open the EXR with Photoshop, the negative values are still there.
        I find it strange that the frame buffer displays negative values with the eyedropper but convert these to positive values when saving to a floating point format. It's confusing, no?
        Well, yes, because the VRaySamplerTex is already in RGB values. Whereas the VRaySamplerInfo element needs to be converted to a certain range (either [0 - 1] or [-1 - 1]) for it to be saved as color data.

        Is there no way to force the frame buffer to display (in black) and save negative values, like the same frame buffer does perfectly when SamplerInfoTex is rendered with the Bake to texture ?
        My EXR file is for Unity. I'm not sure multi-channel works in this case. And yes I could remap it directly in my shader, but it it will add some extra work to the GPU, that's why I would like to get it directly from Vray. But I'll go this way if there is no other solution.
        I don't think so. It is how such "data" elements (i.e. VRayVelocity, VRayZDepth, VRayNormals, etc.) are previewed in the VFB. Well, you can use the VRayExtraTex plus VRaySamplerInfoTex method instead.
        Last edited by hermit.crab; 16-12-2021, 04:39 AM.
        Aleksandar Hadzhiev | chaos.com
        Chaos Support Representative | contact us

        Comment


        • #5
          Originally posted by hermit.crab View Post
          Well, you can use the VRayExtraTex plus VRaySamplerInfoTex method instead.
          That would be THE perfect workaround but unfortunately the VraySamplerInfoTex doesn't have an option to retrieve the bump mapping (unlike the SamplerInfo does), and I need this to capture small texturing details.
          It could be useful to add this feature to mimic the SamplerInfo from the Render element, in the future...if it happens, be sure I'll use it

          Meanwhile, I'll go for the remapping directly in my shader.

          Thank you for your explanations and for your help!

          Comment

          Working...
          X