Normand Briere
2019-06-09 3ae9b1de47e51e7c150412f2bb14383cb6a5f8f8
CameraPane.java
....@@ -12502,8 +12502,8 @@
1250212502
1250312503 // display shadow only (bump == 0)
1250412504 "SUB temp.x, half.x, shadow.x;" +
12505
- "MOV temp.y, -params6.x;" +
12506
- "SLT temp.z, temp.y, zero.x;" +
12505
+ "MOV temp.y, -params5.z;" + // params6.x;" +
12506
+ "SLT temp.z, temp.y, -one2048th.x;" +
1250712507 "SUB temp.y, one.x, temp.z;" +
1250812508 "MUL temp.x, temp.x, temp.y;" +
1250912509 "KIL temp.x;" +
....@@ -12834,7 +12834,7 @@
1283412834 //once = true;
1283512835 }
1283612836
12837
- System.out.print("Program #" + mode + "; length = " + program.length());
12837
+ System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length());
1283812838 System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : ""));
1283912839 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
1284012840
....@@ -12967,12 +12967,16 @@
1296712967
1296812968 "ADD " + depth + ".z, " + depth + ".z, temp.x;" +
1296912969 //"SUB " + depth + ".z, " + depth + ".z, temp.x;" + // back face shadowing!
12970
+
12971
+ // Compare fragment depth in light space with shadowmap.
1297012972 "SUB temp.x, fragment.texcoord[1].z, " + depth + ".z;" +
1297112973 "SGE temp.y, temp.x, zero.x;" +
12972
- "SUB " + shadow + ".y, one.x, temp.y;" +
12974
+ "SUB " + shadow + ".y, one.x, temp.y;" + // Specular is fully occluded
12975
+
12976
+ // Reverse comparison
1297312977 "SUB temp.x, one.x, temp.x;" +
1297412978 "MUL " + shadow + ".x, temp.x, temp.y;" +
12975
- "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // specular is fully occluded
12979
+ "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // diffuse
1297612980 "POW " + shadow + ".x, " + shadow + ".x, params5.z;" + // fake depth
1297712981
1297812982 "SLT " + shadow + ".z, fragment.texcoord[1].z, " + depth + ".z;" +
....@@ -12987,6 +12991,10 @@
1298712991 "DP3 temp.x, normal, lightd;" +
1298812992 "SLT temp.x, temp.x, zero.x;" + // shadoweps
1298912993 "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
12994
+
12995
+ // No shadow when out of frustrum
12996
+ "SGE temp.x, " + depth + ".z, one.z;" +
12997
+ "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
1299012998 "";
1299112999 }
1299213000