+5
Виконано

Global value input.

bjorn 11 років тому оновлено Conor O'Kane 9 років тому 9
A checkbox on properties (Color, Float, Vector4 and Texture) to turn that input global. These will then not show up in the inspector, but be accessed by script via

Shader.SetGlobalColor
Shader.SetGlobalFloat
Shader.SetGlobalTexture
Shader.SetGlobalVector
Shader.SetGlobalMatrix

This also means that we will need a matrix4x4 input.

Відповідь

Відповідь
Виконано
This has now been implemented in Beta 0.26 :)
Good idea! We'll see when this gets done, bugs are priority at the moment. :)
Matrices would be a separate topic, as there isn't even a matrix datatype in SF yet
Was just looking for this feature hehe. +1
Відповідь
Виконано
This has now been implemented in Beta 0.26 :)
Any plans to include SetGlobalMatrix in this feature?
There's currently no matrix datatype, so that needs to be in place first. We'll see! I can research it today and see when/if it'll make it in
Thanks for the reply. I've been trying to create a lit particles shader in Shader Forge that will work with Unity's shuriken particle system, but the lack of SetGlobalMatrix is preventing progress.
I've been trying to do that as well, to get native lit particle support in SF - but it seems like it's near-impossible to grab the fragment position. Is that something the matrix helps with? :)
See this example here: https://gist.github.com/Farfarer/158b23f694c2c995f93e
It uses this...
Shader.SetGlobalMatrix ("_Camera2World", this.camera.cameraToWorldMatrix );

in a script on the camera. The shader then uses this to adjust positions to compensate for whatever hack Shurkien is doing to the particle positions which messes up their lighting inputs. I've been trying to recreate this approach in Shader Forge as I don't want additive or cutout particles, which is all that this example provides.