6
$\begingroup$

enter image description here

I've been using Stored Named Attributes on this geo node to pass the values to the shader editor - and I've noticed some attributes on the shader have stopped receiving info -, and when I tried "muting" a few Stored Named Attributes on the geo node, some others started working again.

There are no competing attributes or something like that, I've more than triple checked.

I looked up how many attributes I have and they are 22. I never thought there was a limit. Is it like 20?

Or is this a glitch maybe? I'm on 4.0.2.

Edit: Is this it? https://projects.blender.org/blender/blender-manual/issues/92448

$\endgroup$

2 Answers 2

8
$\begingroup$

You link to an Eevee, not geonodes limitation:

Moreover, each of those can be read in Eevee:

It is when you use too many attributes in a single shader, that the later attributes are not loaded to the GPU memory - I was able to load up to 14 attributes at once:

When testing, change the "Iterations" or otherwise modify the node tree to force reevaluation...

$\endgroup$
2
  • 1
    $\begingroup$ Oh wow... So the max is 14 on a single material? Thats so low for complex projects. When you say to modify the node tree to force reevaluation, you mean compromissing others/swapping the ones that are ON, or that there is a way to read all the attributes by forcing it? And how would one achieve that? Thank you I really appreciate it. $\endgroup$ Jan 6 at 19:57
  • $\begingroup$ @PedroRibeiro I simply mean that when you test out which attributes you can read or not in the shader, make sure to change some value in the geonodes - afterwards you can again change it back (but better don't use the ctrl+z to undo), to make sure the object is refreshed. $\endgroup$ Jan 7 at 12:26
1
$\begingroup$

New info and (partial) solution

After the input from Markus von Broady's answer, I took a different turn on my project to account for the attributes limit in the shader editor. For this, I had to rearrange the way I was making my mesh so that the inputs that came from the geometry nodes to the shader editor were not all compacted in a single material but spread through various materials, each one not exceeding the supposed 14 limit per material.

Meanwhile all this, I also got an idea ((not a new concept but)) for virtually increasing the max number of attributes by 4 times. This is done by compacting 3 values/attributes all in one vector or a color and then unpacking them on the shader editor. Color has 4 floats instead of 3 (R,G,B, Alpha) but as in per 4.1.0 alpha the Separate Color node has alpha channel only on Geometry Nodes but not on the Shader Editor, which means you would be able to compact it, but then not to extract the 4th value in the alpha channel. EDIT!: Later after this post I freaking realized you can actually unpack the alpha channel, so you can use 4 slots. Its not through a separate color node but directly through the attribute node which has an alpha output in itself (how didn't i see that lol)!

Demonstration [old method using vector, color is better with 4]:

enter image description here

enter image description here

Anyways, so, with this method I was having the materials in my mesh with only like 3 attributes or less each. And everything was going fine till today, when some of my attributes started not working again, even tho I'm not exceeding the limit per material. I did some testing and turns out the limit is (EDIT) 14 only when you have no Texture Coordinate node and 13 when you do (12 if you use Generated - because I think it uses the 2 vectors that make up the objects bounding box)... and it isn't per shader, but per object. Yeh....

Summary

I'm gonna do a list of basically everything I know now about attribute limits: (I tested this both on 3.6.2 and 4.1.0 alpha.)

  • Like Markus tested you can have hundreds of stored named attributes per geometry node and that isn't the problem.
  • You can only receive a max of 14 attributes per object on the shader editor, independently of how many shaders they are spread on.
  • Having multiple geometry nodes in the object storing different attributes doesn't change anything, still the total max per object in the shaders is 14.
  • If a shader has more than 16 attributes, it will literally break and turn pink (only that one, not all in the object).

I'm leaving the .blend file in case people wanna test it out in the future.

I wish the devs would increase this limit in the future updates tho...

$\endgroup$
9
  • $\begingroup$ "the limit is 13 (not 14 as per Markus' answer..." - I think your material simply uses some other attribute, that takes the memory of the GPU. UVMap or something else... I don't think it's reasonable to say the limit is 13, when I succesfully loaded 14, there's a simple example and a .blend file to test for yourself :D BTW, I'm not actually saying the limit is 14, I don't know what the limit is, what I say is "I was able to load up to 14 attributes at once" - perhaps the limit is higher but I also somehow implicitly used the memory somehow. $\endgroup$ Jan 25 at 10:06
  • $\begingroup$ Dividing to multiple materials seems reasonable. Material boundary requires to duplicate vertices on the boundary (Blender doesn't show that, but the actual rendering dupilicates verts on UV seams, material boundaries and in some other cases), but that should be much better than having a complex material, because a shader program is run just so many times... Basically always optimize to have as simple material as possible. $\endgroup$ Jan 25 at 10:08
  • $\begingroup$ @MarkusvonBroady It's 14 you're right. I thought your .blend file was glitching or smt haha 😅sorry... because I wasn't able to reproduce it in my way. I couldn't comprehend how mine was different - yours was connected directly to the surface output, and mine had just a simple shader and mapping before (not affecting the logic of the GN attributes) -, but now that you say it could be a UVMap or smt else that made a lot of sense, and I went to do more tests. [1] (...) $\endgroup$ Jan 25 at 22:18
  • $\begingroup$ [2] (...) And yea, basically it's the Texture Mapping node that is adding more attributes - all of the inputs (not just UVMap but also Object, Normal, Reflection etc..) add at least 1, and with Generated adding 2 (this must be because I think Generated needs the 2 vectors that make up the objects bounding box). So to sum up, it's 14 max. but only in the use cases where you don't use no textures/vector mapping in the shader. [2] (...) $\endgroup$ Jan 25 at 22:18
  • 1
    $\begingroup$ The hidden 15th attribute is the normal. This limitation is now being documented, see projects.blender.org/blender/blender-manual/pulls/104697. $\endgroup$
    – scurest
    Feb 13 at 22:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .