Is there a way to get an average value in material nodes? I am only aware of this option in compositor: https://docs.blender.org/manual/en/dev/compositing/types/output/levels.html

  • 1
    $\begingroup$ What do you mean by an average value for a material node? In the compositor node, there's a well-defined input for which the average is calculated. $\endgroup$ – remco Apr 12 '18 at 8:05
  • $\begingroup$ I'm looking for a way to display average value of a vector, for instance if I plug in the separated X value i want to get 0.5 displayed evenly $\endgroup$ – Johan Apes Apr 12 '18 at 8:11
  • $\begingroup$ You can make a node group that calculates average value according to your needs. In Vector context the average value doesn't really make lot sense but you can calculate it by x + y + z / 3. Maybe you'd want the actual vector length/magnitude instead? $\endgroup$ – kheetor Apr 12 '18 at 8:55
  • $\begingroup$ Maybe, I'm probably not explaining it right, how would I go about that? $\endgroup$ – Johan Apes Apr 12 '18 at 9:11
  • $\begingroup$ You can calculate Vector length by x^2 + y^2 + z^2 and using squareroot on that (math node set to Power with value of 0.5). Can't post images here. Post broader question if you're not sure of your approach. $\endgroup$ – kheetor Apr 12 '18 at 12:20

I think there is an issue with your premise. The Average Value node works in the compositor by performing operations on a bounded, finite image, with the resolution you set in the Render settings.

In material nodes, however, the vectors you use, and by extension, the colors, are in an infinite vector space. Not only that, but they aren't (by default) quantized. In compositing, there is a finite number of pixels, making it easy to average the image. In material nodes, you can keep zooming in forever, making it much trickier to get an average value1.

So, the answer to your question is that it isn't possible, because material nodes don't work the same way as compositing. If you ask a new question with a more specific problem, though, we might be able to help you find a way to do what you want to do.

1While it is (sometimes) mathematically possible to find an average value over an infinite vector space with calculus, I suspect that would be very tricky to implement in nodes (and probably impossible without OSL).

  • $\begingroup$ Thanks for the explanation, makes sense, I will try to rephrase it to a specific problem $\endgroup$ – Johan Apes Jun 6 '18 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.