I am very new to blender and would like to understand the mistake I am doing with the color ramp node. I am currently using color ramp to assign different textures to each object in my scene. The complete surface should have the same RGB value. I then use this rendered image and filter out objects based on the pixel values. I have created a simple scene with 2 default cubes(pass index for the bottom cube in 0 and for the upper cube is 1) and added the color ramp settings as shown in the image. But, when I render with this settings, the RGB values on the surface are not uniform. Can someone please help me with this issue. I am using Blender 2.8.
2 Answers
If you over expose your render you can see patern.
Render saved as PNG 8-bit. Nothing is pluged into Surface socket of Material Output node. Tested with Eevee, Cycles, Samples ... all same result. Even if compression is set to zero.
The only difference did PNG saved as 16-bit. Completely black. So I guess OpenEXR will work as well. So the issue comes from output file format.
... and just for lovers of generic graphics - JPEG
And as mentioned already - Cryptomatte seems to me as a better friend, especially for material. With this ColorRamp 0/1 option I can't imagine to work on more complex object.
-
$\begingroup$ If this A is correct for you, consider mark Q as Solved by click on check mark vote number, so others can see it as answered from list of Q. You can uncheck it any time. $\endgroup$– vkliduFeb 7, 2020 at 21:24
The first thing I noticed is that you're plugging the Color Ramp directly into the material output without running that first through a shader node like "diffuse" or "Principled BSDF". Not sure if that would fix your problem. Although, Considering your end goal of filtering out objects by the color value, you should look into the Cryptomatte feature. That is basically its purpose and it's a super-powerful feature that many 3d apps and compositing programs support. You might give it a try instead of your current method.
https://docs.blender.org/manual/en/latest/compositing/types/matte/cryptomatte.html
https://www.youtube.com/watch?v=VBJQM-gIob8
edit: Just a little info also on why you're seeing different colors across the object. The color your pushing is still being effected the lighting in the scene. If you add the color ramp to an emission shader the color should be even across the object. As a side hint, you don't need to open your render in another image editor to check the color values. Just right-click hold on the image in the rendered window and you'll see a black footer show up with all the color info an more.
-
$\begingroup$ Pluging ColorRamp directly is the best way to avoid any other influence of light in a scene. And YES Cryptomatte is probably the best option (thanks to antialiased edges), but less comfortable for compositing (so many connections) and also produce edge issue for overlaping pixels. $\endgroup$– vkliduFeb 7, 2020 at 18:26
-
$\begingroup$ You might be right on plugging the color ramp directly, I've always thought it was more efficient to run something through a shader, that way the output was receiving the right type of data. Can't find any info on this though. As for Cryptomatte, I've never had issues with overlapping pixels. I've been using it for years on different apps. I do know that the quality of the matte is based on the amount of samples in the render. $\endgroup$ Feb 7, 2020 at 18:40