i’m busy with creating an editor, recently i’ve switched to deferred shading as opposed of forward shading, everything is working so far i’ve set up my fbo’s and render a full screen quad. but i’m having difficulties to get the actual light working. I’ve uploaded the binary to this site :
http://home.hccnet.nl/pj.holverda/ (binary.rar)
there is a basic map included in the rar, which can be loaded.
the actual deffered pass is in data/glsl/deferred_light.frag/vert
can you guys please, modify this, to add a point light(and maybe a directional light ) at a specific location.
regards,
Paul
Your problem is too broad, try to narrow it down to the point where its a specific question and you’ll have more luck. Most people are unwilling (or unable) to download a random binary and work through large amounts of other peoples source.
okay i’m sorry:), but try to download it anyway, the editor is coming along nicely;)
here are the relevant shaders
//vert
varying vec4 view;
varying vec3 eyeLight;
varying vec2 texCoord;
void main(void)
{
gl_Position = ftransform();
view = (gl_ModelViewMatrix * gl_Vertex);
//eyeLight = (gl_ModelViewMatrix * vec4(0.0,0.0, 256.0, 1.0)).xyz;
texCoord = gl_MultiTexCoord0.xy;
}
//fragment
uniform sampler2D tex0; //diffusetex
uniform sampler2D tex1; //normaltex(in eye space)
uniform sampler2D tex2; //depth texture
uniform vec3 lightPos;
uniform vec2 planes;
varying vec4 view;
varying vec3 lightVec;
varying vec3 eyeLight;
varying vec2 texCoord;
void main(){
vec4 base = texture2D(tex0, texCoord);
vec3 bump = texture2D(tex1, texCoord).xyz ;
float depth = texture2D(tex2, texCoord).r ;
float z = planes.y/(planes.x - depth);
//view = normalize(view);
vec3 modelView = vec3 (view.xy/view.z * z, z);
// compute light vector
vec3 LightVector = normalize( eyeLight-modelView );
float NdotL = dot( bump, LightVector );
//gl_FragData[0] = vec4(bump, 1.0);
gl_FragData[0] = base;//pow( depth, 100.0 );
}
i’ve think i’m almost there, i just need some pointers(no pun intended)
regards,
Paul