Possible to use drivers and access scene data? And regarding programming... #265
-
Hiya, I was wondering if it's possible to use drivers so I could for example, get bone rotation data from my rig or perhaps utilize two empties forming a vector? I tried right clicking as I would expect to do in EEVEE and it doesn't seem like this is the way to do it. May I ask how if it's possible? Lastly, if it is possible is there any way I could do it in pure code (.mesh.glsl)? Thank you! EDIT:Oh, I also moved from the latest Release version to the Development branch pre-release version and now the include directive for NPR_Pipeline.glsl doesn't work anymore.
I looked at the files and apparently the Pipeline is now located outside the Shaders folder - how do I approach fully programming a shader now? Thanks again. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
There's a limitation in Blender that doesn't allow to retrieve the relative path (and therefore adding drivers) for some types of node properties: For now you can override the property from the material panel and add the driver there: I have thought about adding the option to setup Malt properties with Python callbacks, but I'm on the fence since this would prevent some scene loading performance optimizations. In any case, it's not possible to setup drivers directly from the shader code.
The shader API has been redesignes and some new features have made fully writing shaders in GLSL a bit harder. So where you used to write something like: #include "Pipelines/NPR_Pipeline.glsl"
uniform vec3 ambient_color = vec3(0.1,0.1,0.1);
uniform vec3 diffuse_color = vec3(1.0,0.1,0.1);
void COMMON_PIXEL_SHADER(Surface S, inout PixelOutput PO)
{
vec3 diffuse = diffuse_color * get_diffuse_half();
PO.color.rgb = ambient_color + diffuse;
} now it would be: /*META
@ambient_color: default=vec3(0.1,0.1,0.1);
@diffuse_color: default=vec3(1.0,0.1,0.1);
*/
vec3 basic_shading(vec3 ambient_color, vec3 diffuse_color)
{
vec3 diffuse = diffuse_color * diffuse_half_shading();
return ambient_color + diffuse;
} and load the file either as a local library or as a plugin library: |
Beta Was this translation helpful? Give feedback.
There's a limitation in Blender that doesn't allow to retrieve the relative path (and therefore adding drivers) for some types of node properties:
https://developer.blender.org/T51096
For now you can override the property from the material panel and add the driver there:
I have thought about adding the option to setup Malt properties with Python callbacks, but I'm on the fence since this would prevent some scene loading performance optimizations.
In any case, it's not possible to setup drivers directly from the shader code.