Implemented specular reflective lighting for OpenGL 3.x, everything looks shiny (will add APIs to make it less shiny ;-)
Remove roof from kitchens/1.sdf, otherwise shadows and shinyness won't work (light is outside the room, bouncing against roof-top) Make kuka_iiwa/model.urdf more smooth, use .obj for per-vertex normals (using Blender, import STL, export OBJ, enable triangles, normals and Z-UP, Y forward)
This commit is contained in:
@@ -15,7 +15,12 @@ uniform mat4 ModelViewMatrix;
|
||||
uniform mat4 ProjectionMatrix;
|
||||
uniform mat4 DepthBiasModelViewProjectionMatrix;
|
||||
uniform mat4 MVP;
|
||||
uniform vec3 lightDirIn;
|
||||
uniform vec3 lightPosIn;
|
||||
uniform vec3 cameraPositionIn;
|
||||
uniform mat4 ViewMatrixInverse;
|
||||
uniform float materialShininessIn;
|
||||
uniform vec3 lightSpecularIntensityIn;
|
||||
uniform vec3 materialSpecularColorIn;
|
||||
|
||||
out vec4 ShadowCoord;
|
||||
|
||||
@@ -60,7 +65,13 @@ vec4 quatRotate ( in vec4 p, in vec4 q )
|
||||
return quatMul ( temp, vec4 ( -q.x, -q.y, -q.z, q.w ) );
|
||||
}
|
||||
|
||||
out vec3 lightDir,normal,ambient;
|
||||
out vec3 lightPos,normal,ambient;
|
||||
out vec4 vertexPos;
|
||||
out vec3 cameraPosition;
|
||||
out float materialShininess;
|
||||
out vec3 lightSpecularIntensity;
|
||||
out vec3 materialSpecularColor;
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
@@ -69,15 +80,19 @@ void main(void)
|
||||
|
||||
vec4 worldNormal = (quatRotate3( vertexnormal,q));
|
||||
|
||||
normal = normalize(worldNormal).xyz;
|
||||
normal = worldNormal.xyz;
|
||||
|
||||
lightDir = lightDirIn;
|
||||
|
||||
lightPos = lightPosIn;
|
||||
cameraPosition = cameraPositionIn;
|
||||
materialShininess = materialShininessIn;
|
||||
lightSpecularIntensity = lightSpecularIntensityIn;
|
||||
materialSpecularColor = materialSpecularColorIn;
|
||||
|
||||
vec4 localcoord = quatRotate3( position.xyz*instance_scale,q);
|
||||
vec4 vertexPos = MVP* vec4((instance_position+localcoord).xyz,1);
|
||||
|
||||
gl_Position = vertexPos;
|
||||
vertexPos = vec4((instance_position+localcoord).xyz,1);
|
||||
|
||||
vec4 vertexLoc = MVP* vec4((instance_position+localcoord).xyz,1);
|
||||
gl_Position = vertexLoc;
|
||||
ShadowCoord = DepthBiasModelViewProjectionMatrix * vec4((instance_position+localcoord).xyz,1);
|
||||
|
||||
fragment.color = instance_color;
|
||||
|
||||
Reference in New Issue
Block a user