From 314b34423070cf127464da79a53cddf6b1c38587 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Sat, 06 May 2017 20:33:17 -0400 Subject: [PATCH] Skin shader --- CameraPane.java | 62 +++++++++++++++++++++++++----- 1 files changed, 51 insertions(+), 11 deletions(-) diff --git a/CameraPane.java b/CameraPane.java index dda961a..8fe82ec 100644 --- a/CameraPane.java +++ b/CameraPane.java @@ -2000,10 +2000,12 @@ */ TextureData ReduceTexture(TextureData texturedata, int resolution) // String name) { + int pixelformat = texturedata.getPixelFormat(); + int stride = 1; - if (texturedata.getPixelFormat() == GetGL().GL_RGB || texturedata.getPixelFormat() == GetGL().GL_BGR) // || texturedata.getPixelFormat() == GL.GL_LUMINANCE) + if (pixelformat == GetGL().GL_RGB || pixelformat == GetGL().GL_BGR) // || texturedata.getPixelFormat() == GL.GL_LUMINANCE) stride = 3; - if (texturedata.getPixelFormat() == GetGL().GL_RGBA || texturedata.getPixelFormat() == GetGL().GL_BGRA) // || texturedata.getPixelFormat() == GL.GL_LUMINANCE_ALPHA) + if (pixelformat == GetGL().GL_RGBA || pixelformat == GetGL().GL_BGRA) // || texturedata.getPixelFormat() == GL.GL_LUMINANCE_ALPHA) stride = 4; int width = texturedata.getWidth(); @@ -7590,7 +7592,8 @@ float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation - float[] options3 = new float[]{1, 1, 1, 1}; // fog color. image intensity + float[] options3 = new float[]{1, 1, 1, 0}; // fog color + float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen static int imagecount = 0; // movie generation @@ -7923,7 +7926,7 @@ if (!BOXMODE) { - System.out.println("image: " + fullname + " (" + (GrafreeD.wav.cursor / 735 / 4) + ")"); + System.out.println("image: " + fullname + " (wav cursor=" + (GrafreeD.wav.cursor / 735 / 4) + ")"); } if (!BOXMODE) @@ -8784,7 +8787,7 @@ if (!IsFrozen()) { // dec 2012 - if (!(!flash && !lightMode && drawMode == DEFAULT && ANTIALIAS > 0)) + if (!ambientOcclusion && !(!flash && !lightMode && drawMode == DEFAULT && ANTIALIAS > 0)) { framecount++; shadowbuffer.display(); @@ -9379,6 +9382,7 @@ gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 63, options2, 0); gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 62, options3, 0); + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 61, options4, 0); options2[0] *= renderCamera.Distance(); @@ -10357,11 +10361,13 @@ "PARAM params6 = program.env[6];" + // bump, noise, borderfade, fog punchthrough "PARAM params7 = program.env[7];" + // noise power, opacity power "PARAM options0 = program.env[63];" + // fog density, intensity, elevation - "PARAM options1 = program.env[62];" + // fog rgb color, image intensity + "PARAM options1 = program.env[62];" + // fog rgb color + "PARAM options2 = program.env[61];" + // image intensity, subsurface, lightsheen "PARAM pointlight = program.env[127];" + // ... "PARAM zero = { 0.0, 0.0, 0.0, 0.0 };" + "PARAM halfhalf = { 0.25, 0.25, 0.25, 1.0 };" + "PARAM half = { 0.5, 0.5, 0.5, 1.0 };" + + "PARAM threequarter = { 0.75, 0.75, 0.75, 1.0 };" + "PARAM two = { 2.0, 2.0, 2.0, 1.0 };" + "PARAM ten = { 10, 10, 10, 1.0 };" + "PARAM one3rd = { 0.5, 0.33333333333, 0.333333333, 1.0 };" + @@ -10422,6 +10428,10 @@ "TEMP R1;" + "TEMP R2;" + "TEMP R3;" + + "TEMP min;" + + "TEMP max;" + + "TEMP average;" + + "TEMP saturation;" + "TEMP keep1;" + "TEMP keep2;" + "TEMP keep3;" + @@ -10952,10 +10962,40 @@ // skin? // Saturation for skin - /**/ // c'est ici - (Skinshader? "DP3 temp.x, final,one;" + + /**/ + (Skinshader? + "DP3 average.x, final,one;" + + "MUL average, one3rd.xxxx,average.xxxx;" + + + "MIN min.x, final.x,final.y;" + + "MIN min.x, min.x,final.z;" + + + "MAX max.x, final.x,final.y;" + + "MAX max.x, max.x,final.z;" + + "MOV max, max.xxxx;" + + + "SUB saturation, max, final;" + + + "ADD temp.x, max.x, one10th.x;" + + "RCP temp.x, temp.x;" + + "MUL temp.x, temp.x, half.x;" + + "MUL saturation, saturation, temp.xxxx;" + + + "DP3 ndotl.x, normald, light;" + + "MAX ndotl.x, ndotl.x, -ndotl.x;" + + + "SUB temp.x, one.x, ndotl.x;" + + "ADD temp.x, temp.x, options2.z;" + // lightsheen + "ADD temp.y, one.y, options2.y;" + // sursurface + "MUL temp.x, temp.x, temp.y;" + + + "MUL saturation, saturation, temp.xxxx;" + + "SUB_SAT temp, max, saturation;" + +/** + "DP3 temp.x, final,one;" + "MUL R2, one3rd.xxxx,temp.xxxx;" + - "SUB temp, final,R2;" + + "SUB temp, final, R2;" + + // using light angle "DP3 ndotl.x, normald,light;" + //"SLT ndotl.y, ndotl.x, zero.x;" + @@ -10968,7 +11008,6 @@ // using light intensity "MOV ndotl.z, R2.x;" + "MUL ndotl.z, ndotl.z, ndotl.z;" + // tuning... - // june 2014 "MAD R1.x, ndotl.z,slope.y,one.x;" + // "SUB ndotl.x, one.x, ndotl.x;" + @@ -10980,6 +11019,7 @@ //"MUL R2.y, shadow.x,R2.y;" + // avril 2014 "MAD temp.x, R2.y, ndotl.y, temp.x;" + // red shift (skin) +/**/ // "ADD final, R2,temp;" + "MOV final, temp;" @@ -11069,7 +11109,7 @@ /**/ // HDR "MOV temp.z, final.a;" + - "MUL final, final,options1.w;" + + "MUL final, final,options2.x;" + "MOV final.a, temp.z;" + /**/ -- Gitblit v1.6.2