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 --- BiparamEditor.java | 4 +- BoundaryRep.java | 2 CameraPane.java | 60 +++++++++++++++++++++++++----- GroupEditor.java | 7 +++ Object3D.java | 4 + 5 files changed, 63 insertions(+), 14 deletions(-) diff --git a/BiparamEditor.java b/BiparamEditor.java index 1525688..9598f9c 100644 --- a/BiparamEditor.java +++ b/BiparamEditor.java @@ -66,9 +66,9 @@ */ super.SetupUI2(oe); - uDivsField = AddSlider(oe.ctrlPanel, "U #", biparam.minUDivs, 1024+biparam.minUDivs, biparam.uDivs); + uDivsField = AddSlider(oe.ctrlPanel, "U #", biparam.minUDivs, 250+biparam.minUDivs, biparam.uDivs); Return(); - vDivsField = AddSlider(oe.ctrlPanel, "V #", biparam.minVDivs, 1024+biparam.minVDivs, biparam.vDivs); + vDivsField = AddSlider(oe.ctrlPanel, "V #", biparam.minVDivs, (int)(250/6.28)+biparam.minVDivs, biparam.vDivs); Return(); // oe.aConstraints.gridwidth = 1; // oe.aConstraints.fill = GridBagConstraints.VERTICAL; diff --git a/BoundaryRep.java b/BoundaryRep.java index 4b1c03c..7fc9789 100644 --- a/BoundaryRep.java +++ b/BoundaryRep.java @@ -2163,7 +2163,7 @@ // if (slow) // aout 2013 // sept 2013 merde... - W = 13; + W = 3; // 13; // POSERATE if (CameraPane.tickcount > 0 || CameraPane.SLOWPOSE) diff --git a/CameraPane.java b/CameraPane.java index 073c943..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 @@ -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;" + /**/ diff --git a/GroupEditor.java b/GroupEditor.java index e40eb06..4fa02b1 100644 --- a/GroupEditor.java +++ b/GroupEditor.java @@ -285,6 +285,8 @@ genNormalsORGANItem.addActionListener(this); genNormalsCADItem = menu.add(new MenuItem("CAD Normals")); genNormalsCADItem.addActionListener(this); + genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals")); + genNormalsMESHItem.addActionListener(this); stripifyItem = menu.add(new MenuItem("Stripify")); stripifyItem.addActionListener(this); unstripifyItem = menu.add(new MenuItem("Unstripify")); @@ -2308,6 +2310,10 @@ if (event.getSource() == genNormalsCADItem) { GenNormals(true); + } else + if (event.getSource() == genNormalsMESHItem) + { + GenNormals(true); // TODO } else if (event.getSource() == genNormalsORGANItem) { @@ -4845,6 +4851,7 @@ private MenuItem clearItem; private MenuItem clearAllItem; private MenuItem genUVItem; + private MenuItem genNormalsMESHItem; private MenuItem genNormalsCADItem; private MenuItem genNormalsORGANItem; private MenuItem stripifyItem; diff --git a/Object3D.java b/Object3D.java index 2a7a2a3..ebab7df 100644 --- a/Object3D.java +++ b/Object3D.java @@ -5519,7 +5519,9 @@ display.options2[2] = material.factor; cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3); - display.options3[3] = material.cameralight/0.2f; + display.options4[0] = material.cameralight/0.2f; + display.options4[1] = material.subsurface; + display.options4[2] = material.sheen; // if (display.CURRENTANTIALIAS > 0) // display.options3[3] /= 4; -- Gitblit v1.6.2