How much ram should I assign to minecraft, have 8gb and want to play with shaders?
Always half, so 4.
Is there a reason for this?
I don't know, that's the "rule".
You could also allocate 6GB, then other programs have to cope with less
Then I find your answer less helpful. I thought there was a reason for "always".
So that the other programs still have enough, as I said, you could also assign 6GB, but then you should do without other background programs (Google, Discord, etc.)
But why half then, when I have 32 GB available, for example, and my background programs only need 4 GB?
Yes, you are right, with a higher RAM the whole thing no longer counts, please forgive me.