I did it! once again a thanks to serega-kkz for this, as I was looking at his shader for adjusting the ambient, I then noticed his code was pulling light attributes through, and attr_light0(3) looked like a light attribute, so I did a similar process to my own code like his to pull light attributes into my own code.
I did not take long to figure out which attribute I needed, and there it worked, with some tweaks, I got it near perfect
here is the finished shader, the vertex.
# version 150 // vertex shader
uniform mat4 p3d_ModelViewMatrix;
uniform mat4 p3d_ModelViewMatrixInverse;
uniform mat4 p3d_ModelViewProjectionMatrix;
in vec2 p3d_MultiTexCoord0;
in vec3 p3d_Normal;
in vec3 p3d_Binormal;
in vec3 p3d_Tangent;
in vec4 p3d_Vertex;
out vec2 vUv;
out mat3 tbnMatrix;
// “loadPrcFileData('', "gl-coordinate-system default”)” must be set for this to work
void main() {
vUv = p3d_MultiTexCoord0;
vec3 tan = normalize(mat3(p3d_ModelViewMatrix) * p3d_Tangent);
vec3 bi = normalize(mat3(p3d_ModelViewMatrix) * -p3d_Binormal);
vec3 nrm = normalize(mat3(transpose(p3d_ModelViewMatrixInverse)) * p3d_Normal);
tbnMatrix = mat3(normalize(tan), normalize(bi), normalize(nrm));
gl_Position = p3d_ModelViewProjectionMatrix * p3d_Vertex;
}
and the fragment
# version 150 // fragment shader
uniform sampler2D p3d_Texture0;
uniform sampler2D p3d_Texture1;
in vec2 vUv;
in mat3 tbnMatrix;
out vec4 p3d_FragColor;
uniform struct p3d_LightSourceParameters{
vec4 position;
} p3d_LightSource[1];
void main (){
// Directional Light (Global)
vec4 color = vec4(0.6, 0.6, 0.6, 0.6) * 0.6;
vec3 forward = vec3(0, 1, 0);
vec3 face = p3d_LightSource[0].position.xyz;
vec4 scale = vec4(1.0, 1.0, 1.0, 1.0); // colorscale
vec4 ambient = vec4(0.5, 0.5, 0.5, 0.5);
vec4 diffuse = vec4(0.64, 0.64, 0.64, 1);
float specular = 12.5; // negative causes a rim light effect.
// Translate tangent-space normal in map to view-space.
vec3 tsNrm = normalize((texture(p3d_Texture1, vUv).xyz * 2) - 1);
vec3 eyeNrm = normalize(tbnMatrix * tsNrm);
vec3 halfvec = normalize(face - forward);
vec4 gloss = color * pow(clamp(dot(eyeNrm, halfvec), 0.0, 1.0), specular);
// Begin view-space light summation
vec4 shadow = diffuse + (color * clamp(dot(eyeNrm, face), 0.0, 1.0));
vec4 summation = clamp((ambient * 0.2) + (shadow * diffuse), 0.0, 1.0);
summation.a = diffuse.w;
vec4 result = (summation * scale).rbga * texture(p3d_Texture0, vUv).rgba;
// End view-space light calculations
vec3 texel = result.rgb + gloss.rgb;
p3d_FragColor = vec4(texel, 1.0);
}
now I would mark serega-kkz as the solution since his work solved the shader, but it was originally thuamaturge whom answered the question.weather it was possible to extract shaders from the shader generator.
I will say I want to thank you both though, since you guys made this shader possible, there is still the transparency issue but because panda3d did not provide a shader for
the effect, I will have to source the shader from a outside source, so it is probably best I do this one on my own. anyway, you guys have a good one. 