0
Completed

Allow PerRendererData attribute for types other than Material

Daniele Giardini 8 years ago updated 8 years ago 7

I saw you already talked about the PerRendererData attribute, and marked it as solved because it's already allowed with textures. But I can confirm that, contrary to what Unity's manual may suggest, it works also with other properties like Color etc. So it would be nice to be able to set it via Shader Forge also for other property types, instead of having to edit the shader manually.


P.S. Here's a post showing the PerRendererData attribute with colors.

P.P.S. Just got SF after ages of lurking around! It's awesome :)

Answer

Answer
Completed

You don't seem to need the attribute for colors, I'm pretty sure it's only for textures ¯\_(ツ)_/¯


P.P.P.S. I am an idiot and in the title wrote "other than Material" instead of "other than Texture". I can't find a way to change the title, soooo :P

Under review

I'm pretty sure you can do this without the attribute, no?

What do you mean? To use MaterialPropertyBlock with colors you need the PerRendererData attribute, and currently you can't apply that on a property other than a Texture (unless you edit the shader code manually after each change made with Shader Forge).

I don't understand your reply, am I missing something?

Answer
Completed

You don't seem to need the attribute for colors, I'm pretty sure it's only for textures ¯\_(ツ)_/¯


(Interestingly enough, adding the attribute does nothing, and using material.color seems to render faster than both. I'm not quite sure what's going on to be honest)

It seems like if you want to animate every frame, using MaterialPropertyBlock is faster, but if you only want to assign it once, material.color is faster. Regardless, the attribute made no difference in my tests

Damn I didn't realize that! And yes, I made some tests now and it's all pretty weird. Sorry for the mistake :P