Attribution for metadata code copied from DisplayObjectShader for custom Shader

I’m presently writing a lengthy GLSL fragment shader to be used via ShaderFilter. I had hoped to use the DisplayObjectShader class, since extending completes much of the vertex and fragment shader code, and one really only needs to provide a small portion of the fragment shader with @:glFragmentBody, which I had successfully already done.

However, my fragment body is going to be quite complicated, and I want different GLSL functions used in it to be kept in separate modules (or just distinct locations). I’m not an advanced enough Haxe user yet to figure out how to import and concatenate several GLSL sources and then place them inside the proper annotation for DisplayObjectShader. I tried instantiating DisplayObjectShader and then just reassigning the glFragmentSource field with the full fragment header + body + source concatenated properly, with my custom code injected, but was just getting a white visual (unclear why this was the case, because when I traced both the glVertexSource and glFragmentSource fields for the two versions of a simple shader at runtime, they were the same, but only the metadata version worked).

I then instantiated the plain old Shader class, copying all of the vertex shader code and fragment shader code from the metadata annotations in the DisplayObjectShader class, and assigned my constructed GLSL to the fields for that vanilla Shader instance, and it worked properly.

My main question then, is if I’m to proceed like this, is what is considered proper attribution for reusing that code? Is attribution even required, given that it is necessary for pretty much any shader to run? I like to be conservative with attribution in any case, so I’ve gone ahead and added it to my THIRD_PARTY_LICENSES file, and will point to that file in a comment above the copied code where it appears in my source. I will also include it in a third-party licenses screen in release builds, so that all distribution methods are covered. However, any clarity on the official requirements and preferences of the OpenFL devs would be much appreciated.

A lesser question I have is, might there be a better way achieve what I’m trying to achieve with my shader, where the code to be used in the fragment body will be scattered in several places?

As always, any comments and assistance are much appreciated! I’ve asked this as well in the Discord server, so please excuse the redundancy.

Welcome to the community @kevin-kmetz :smiley:

I’m not part of the dev team, I’m just a community… guy :sweat_smile: So I offer this in no official capacity. People like @joshtynjala, @Dimensionscape or @singmajesty may be able to provide more official advice.

OpenFL is licensed under the MIT license, which is quite permissive, but it does carry a license attribution requirement.

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

I’m not sure what “all copies or substantial portions” legally qualifies as, but to be on the safe side, an attribution citing the original MIT license and the copyright notice would seem to cover it.

2 Likes

Thanks, @Bink ! @joshtynjala replied to the version of the question I posed in the Discord server earlier. It conclusively answers my question, so I’ll post it here should anyone find it useful in the future:

if I copy code from an MIT/BSD project, I mainly ensure that the source file has a comment at the top of the file with the attribution and license text. as I understand it, this information is also supposed to be included with the compiled version somehow (it can be shown in a view in the app where the user can navigate to it, but that’s not strictly required, and it can also just be bundled inside or next to the binary somehow).

2 Likes