Announcement

Collapse
No announcement yet.

User-defined RGB colors in Render Element?

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

  • User-defined RGB colors in Render Element?

    I need to make a render pass in which I can set precise RGB value to render out as a kind of mask.

    This seemed like it might be accomplished with VRaySamplerInfo element, but I am stuck. It appears that the output is showing up as shades of gray in my test render.

    (Also, it would be really great if the numbers I input could be integers between 0 and 255, not normalized to 1.)

    Below is the basic idea of what I've tried so far. You can also check out the .max file here: https://www.dropbox.com/s/we84q1puy4..._Test.max?dl=0

    I'd really appreciate any help on this!

    Click image for larger version

Name:	VraySamplerInfo-Question.png
Views:	240
Size:	275.6 KB
ID:	1081318​​

  • #2
    Try using a VRayExtraTex element with a plugged VRayUserColor texture. In the "attribute name" set the "set_col" attribute. The attribute value format is written in the VRayUserColor - for your scenario it should look similar to what you've already written in the user-defined properties. Values are from 0 to 1, but you can easily get them via a VRayColor node, where you select the color based on 8-bit values and copy the float values from the "red", "green" and "blue" parameters.
    Aleksandar Hadzhiev | chaos.com
    Chaos Support Representative | contact us

    Comment


    • #3
      Thank you for the quick reply, Aleksandar! It works.

      Do you know of any way to input colors normalized to integers between 255 (typical RGB format) instead of to 1? (The data I'm working with uses that format, and I need to deal with hundreds of such objects per scene with no room for error when converting back to 255.) Just wondering if you have any leads on that.
      I may need to turn to Python/Maxscript if there isn't a native technique.

      Thanks again.
      Last edited by Zirnworks; 17-08-2020, 12:20 PM.

      Comment


      • #4
        You could use a VRayCompTex texture to divide the colors from VRayUserColor by 255 (you can use the VRayColor texture to get a solid (255.0, 255.0, 255.0) RGB color).

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

        Comment


        • #5
          After a bit more testing, I am running into a snag with this workflow.

          When I save out as a PNG, I get noise. I have tried many setting combinations. This is odd, because I know 24-bit PNGs are capable of saving perfectly flat, accurate colors. The application I'm using this for requires transparent PNG files with zero noise (the RGB colors have to match my inputs perfectly) and I can save perfectly flat PNG files from Photoshop. My only workaround right now is to save out of the VFB as a TIFF with alpha channel, bring into Photoshop, select alpha channel and delete black background, then save out as PNG, which takes a lot of extra time since I am batch rendering many images at once and they are quite large.

          (I didn't catch it when I tried it earlier, as I had initially tested the color matching with a screenshot of the VFB, which is devoid of noise.)

          Any idea how to get a PNG out of VFB without compromising the RGB colors?

          ---------------

          As to the info on VRayCompTex, thank you! I got it working, but it required making a 2nd user attribute in object properties (set to 255), and then calling on that attribute in VRayUserScalar map as the division amount. Is there a way to operate with a number without the need to put it inside the User Defined field? Thanks again for the help.
          Last edited by Zirnworks; 18-08-2020, 01:11 AM.

          Comment


          • #6
            Saving the PNG as 48-bit seems to eliminate the noise. Otherwise, yes, set a multiplier of 225 for the white VRayColor.
            Aleksandar Hadzhiev | chaos.com
            Chaos Support Representative | contact us

            Comment

            Working...
            X