Page MenuHome

OSL Attribute "geom:generated" only working when Texture Coordinate Node exists in Node Graph
Closed, ArchivedPublic

Description

System Information
Operating system: Windows-10-10.0.17763 64 Bits
Graphics card: GeForce GTX 1080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 416.34

Blender Version
Broken: version: 2.80 (sub 74), branch: master, commit date: 2019-07-05 06:13, hash: rB66684bdff30f

The OSL Attribute "geom:generated" only works when a Texture Coordinate Node exists somewhere in the Nodegraph and the "Generated" Output is connected to something. Adding a Principled Shader anywhere instead of the Texture Coordinate Node also seems to work.

(animated .gif)

Exact steps for others to reproduce the error

  • Switch to Cycles, CPU and enable OSL
  • Add an OSL script with the following code:
shader node_test(
    output point generated = 0
)
{
    generated = 0;
    getattribute("geom:generated", generated);
}
  • In the Default Material, delete The Principled Shader, add the OSL Script and try to use its output as color.
  • It's not working so add a "Texture Coordinate" Node and connect "Generated" to literally anything.
  • Recompile the Script -> now it works

Details

Type
Bug

Event Timeline

Another thing - the geom:generated attribute doesn't work with volumetric textures - only surface textures. Not sure if that's a bug or a limitation.

Brecht Van Lommel (brecht) closed this task as Archived.Jul 9 2019, 6:52 PM
Brecht Van Lommel (brecht) claimed this task.

That's a known limitation of OSL currently, we have no mechanism for OSL shaders to request certain attributes to be created.