Hi,
some time ago I worked on a custom shader for Substance Designer. After finishing it I wanted to support Substance Painter with the shader, too, but I realized that the shader has to be set up in a different way for Painter and that it's not possible to create a custom vertex shader there. Here's a link to a previous discussion on this forum:
https://forum.allegorithmic.com/index.php/topic,16318.0.html.
However, I figured out that there might be a way to implement the shader the way I want even if I have to use the default vertex shader for painter. I was able to copy some pieces of code into the custom fragment shader for Substance Painter (I work with 2.6.1) but some things had to be changed according to the shader documentation for Substance Painter. It looks like it's not possible to declare a specific version of OpenGL nor to integrate custom extensions because the custom shader code seems to get integrated into other, hardcoded GLSL code. And this is my problem right now:
vec3 get_environment_colour_UPDATED(in vec3 direction , in float lod)
{
return _linear(textureCubeLod(s_environment_map, texcoordEnvSwizzle(direction), lod).rgb);
}
vec3 cube_ambient(in vec3 N)
{
return _linear(textureCube(s_ambient, texcoordEnvSwizzle(N)).rgb);
}
In these few lines of code I use a function (
textureCubeLod) which was removed in the OpenGL version used in Substance Painter by default. In addition I use a function (
textureCube) which requires an extension but as mentioned before I'm unable to integrate custom extensions (Substance Painter generates errors if I do so). So here're the errors I get when I work without versions and extensions:
[GenericMaterial] FS compile log:
[GenericMaterial] ------------------
[GenericMaterial] File index:
[GenericMaterial] 0: shader-skeleton.frag.glsl
[GenericMaterial] 1: shader-common.frag.glsl
[GenericMaterial] 2: lib-utils.glsl
[GenericMaterial] 3: pbr-total-war.fs.glsl
[GenericMaterial]
[GenericMaterial] pbr-total-war.fs.glsl:208 | 3(208) : error C7616: global function textureCubeLod is removed after version 140
[GenericMaterial] pbr-total-war.fs.glsl:213 | 3(213) : error C7531: global function textureCube requires "#extension GL_NV_shadow_samplers_cube : enable" before use
So my question is:
is there a way to work around these problems or is it impossible to do so because I would have to change things which are hardcoded?Thanks for any help in advance!