Shader License

General discussion regarding the OpenMW project.
For technical support, please use the Support subforum.
Post Reply
visvaldas
Posts: 27
Joined: 24 May 2015, 20:31

Shader License

Post by visvaldas » 11 Jul 2018, 21:23

As far as I can see it is not really clear under which license the shaders are released.
According to https://openmw.org/faq/#legal_stuff
All fonts, shaders and other assets shipped with OpenMW are licensed under separate terms. Details can be found in the Readme file or in the Wiki.
The wiki link though says nothing about the shaders and the shader files themselves contain no license header.

Background: I would like to use some of the shader code in a LGPL-licensed project of mine: https://www.sas1946.com/main/index.php/ ... 926.0.html - a graphics extender for Il-2 Sturmovik.

User avatar
psi29a
Posts: 3981
Joined: 29 Sep 2011, 10:13
Github profile: https://github.com/psi29a/
Contact:

Re: Shader License

Post by psi29a » 11 Jul 2018, 21:46

Anything not explicitly licensed is covered under the GPLv3.

https://salsa.debian.org/games-team/ope ... /copyright
and
https://github.com/OpenMW/openmw/blob/master/LICENSE

The FAQ entry is a bit dated for when we shipped other fonts and had other licensed assets.

For example here:
https://salsa.debian.org/games-team/ope ... am/0.26.0/
notice all the other licenses in the root directory.

https://salsa.debian.org/games-team/ope ... 1def6bf2f7
^-- most explicit licenses dealing with 3rd party libs/assets we had in our repo at one point.

User avatar
AnyOldName3
Posts: 941
Joined: 26 Nov 2015, 03:25

Re: Shader License

Post by AnyOldName3 » 11 Jul 2018, 22:42

The only shader that might not be completely covered by our blanket GPL3 licence is the water shader as that was based on some other work. It says where it came from at the top of the file.

There are a couple of ways you could approach this situation.

Firstly, the LGPL is generally pretty good at bridging between GPL and non-GPL code, so you might find that if you include OpenMW's shaders with an explicit GPL header, no licences are violated. I know this can be done in the opposite direction, so I'd check with someone more knowledgeable than me, but it's possible that this is fine.

Alternatively, you could just not use OpenMW's shaders. Everything in them is either fairly standard or fairly Morrowind-specific. If you want to learn to implement a specific effect, OpenGL's official tutorials are generally pretty good.
AnyOldName3, Master of Shadows

User avatar
Thunderforge
Posts: 402
Joined: 06 Jun 2017, 05:57
Github profile: https://github.com/Thunderforge

Re: Shader License

Post by Thunderforge » 12 Jul 2018, 21:41

psi29a wrote:
11 Jul 2018, 21:46
The FAQ entry is a bit dated for when we shipped other fonts and had other licensed assets.
I have the ability to edit the FAQ. What do we want it to say?

visvaldas
Posts: 27
Joined: 24 May 2015, 20:31

Re: Shader License

Post by visvaldas » 13 Jul 2018, 08:08

It actually is the water shader from which I'm using code ;)
Turns out, its just the fresnel and specular calculations.

Code: Select all

float fresnel_dielectric(vec3 Incoming, vec3 Normal, float eta)
{
    float c = abs(dot(Incoming, Normal));
    float g = eta * eta - 1.0 + c * c;
    float result;

    if(g > 0.0)
    {
        g = sqrt(g);
        float A =(g - c)/(g + c);
        float B =(c *(g + c)- 1.0)/(c *(g - c)+ 1.0);
        result = 0.5 * A * A *(1.0 + B * B);
    }
    else
        result = 1.0;  /* TIR (no refracted component) */

    return result;
}

float calcSpecular(vec3 view_dir, vec3 normal, float hardness)
{
    vec3 R = reflect(view_dir, normal);
    vec3 lVec = -sunDir;
    
    return pow(max(dot(R, lVec), 0.0), hardness);
}

User avatar
AnyOldName3
Posts: 941
Joined: 26 Nov 2015, 03:25

Re: Shader License

Post by AnyOldName3 » 13 Jul 2018, 14:28

The specular function is just boring old Phong reflection, which has been standard since the 70s and is so ubiquitous that it's part of OpenGL's fixed-function pipeline. It's only not used in really recent games which use something based on real life, like Cook-Torrance instead, so there's no reason to treat it as something you took from OpenMW. If you're particularly concerned, just copy it from Wikipedia instead.

The Fresnel stuff is a little less common, but there are still a zillion tutorials on it, so you'll be able to find something else to base it off which is compatible with an LGPL licence.
AnyOldName3, Master of Shadows

User avatar
psi29a
Posts: 3981
Joined: 29 Sep 2011, 10:13
Github profile: https://github.com/psi29a/
Contact:

Re: Shader License

Post by psi29a » 13 Jul 2018, 14:34

Thunderforge wrote:
12 Jul 2018, 21:41
I have the ability to edit the FAQ. What do we want it to say?
How does this sound?
Unless otherwise indicated, all OpenMW code is covered under the GPLv3.
I assume that shaders is covered under code as well. As for assets, such as icons/images... I'm not so sure. Can they be covered under the GPLv3? Should they be governed by a CC-BY license? We'll need to track down those who made them and ask. Maybe also state that if you contribute to the project, that it has to be under either GPLv3, CC0 or CC-BY license.

User avatar
AnyOldName3
Posts: 941
Joined: 26 Nov 2015, 03:25

Re: Shader License

Post by AnyOldName3 » 13 Jul 2018, 15:11

Images can be covered by the GPL, but it's not necessarily the best licence to put those things under.
AnyOldName3, Master of Shadows

User avatar
Thunderforge
Posts: 402
Joined: 06 Jun 2017, 05:57
Github profile: https://github.com/Thunderforge

Re: Shader License

Post by Thunderforge » 13 Jul 2018, 21:49

psi29a wrote:
13 Jul 2018, 14:34
How does this sound?
Unless otherwise indicated, all OpenMW code is covered under the GPLv3.
I assume that shaders is covered under code as well.
I agree. My understanding is that, so long as the repository has always had a license indicating that it is GPLv3, then any contributions to it have always been GPLv3. Since we're talking about stuff beyond just "Code", I assume we ought to have the FAQ instead say:
Unless otherwise indicated, all OpenMW code, assets, and other project contributions are covered under the GPLv3.
Will that work? Or is it too broad?
psi29a wrote:
13 Jul 2018, 14:34
Maybe also state that if you contribute to the project, that it has to be under either GPLv3, CC0 or CC-BY license.
Do we even want to open up the door to other licenses? What benefit do we gain by doing so? Are we concerned that people won't be contributing if it's under GPLv3? And is there any downside to the existing images being licensed as GPLv3?

User avatar
AnyOldName3
Posts: 941
Joined: 26 Nov 2015, 03:25

Re: Shader License

Post by AnyOldName3 » 14 Jul 2018, 00:04

Anything with a more permissive licence can be sublicensed as GPL3 when it's added to our repo. Anything with a less permissive licence isn't allowed in our repo in the first place.
AnyOldName3, Master of Shadows

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests