True. Solved for any object with a povray macro. See attached diff
against 8545. Change the simple 'shineFactor' calculation if needed,
it seems that the 'shineFactor' has to fall of very fast for a good
looking result.

I cheated for the translucentFinish macro for multiple-colored
isosurfaces, by assuming the same translucency for all textures.

diff to version 8545 is attached (including my previously mentioned changes)

On 10/30/07, Bob Hanson <[EMAIL PROTECTED]> wrote:

> I suggest maybe we want matte finish for all translucent objects, not so
> much for isosurfaces.

-- 
Greetings, Pim
http://www.molmod.com
Index: src/org/jmol/export/_PovrayExporter.java
===================================================================
--- src/org/jmol/export/_PovrayExporter.java	(revision 8545)
+++ src/org/jmol/export/_PovrayExporter.java	(working copy)
@@ -148,11 +148,15 @@
         + (float) Graphics3D.getSpecularPercent() / 100f + "\n"
         + "  roughness .00001\n  metallic\n  phong 0.9\n  phong_size 120\n}}"
         + "\n\n");
+
+    output("#declare boundBox = "
+        + "  box {<0,0," + slabZ + ">,<Width,Height," + depthZ + ">}\n\n");
     
     output("#macro clip()\n"
         + "  clipped_by { box {<0,0," + slabZ + ">,<Width,Height," + depthZ + ">}}\n"
         + "#end\n\n");
 
+    writeMacrosFinish();
     writeMacrosAtom();
     writeMacrosBond();
     writeMacrosJoint();
@@ -161,11 +165,38 @@
     //    writeMacrosRing();
   }
 
+  private void writeMacrosFinish() {
+    output("#macro translucentFinish(T)\n"
+        + " #local shineFactor = T;\n"
+        + " #if (T <= 0.25)\n"
+        + "  #declare shineFactor = (1.0-4*T);\n"
+        + " #end\n"
+        + " #if (T > 0.25)\n"
+        + "  #declare shineFactor = 0;\n"
+        + " #end\n"
+        + " finish {\n" + "  ambient "
+        + (float) Graphics3D.getAmbientPercent() / 100f + "\n" + "  diffuse "
+        + (float) Graphics3D.getDiffusePercent() / 100f + "\n" + "  specular "
+        + (float) Graphics3D.getSpecularPercent() / 100f + "\n"
+        + "  roughness .00001\n"  
+        + "  metallic shineFactor\n"  
+        + "  phong 0.9*shineFactor\n"  
+        + "  phong_size 120*shineFactor\n}"
+        + "#end\n\n");
+  }
+
+
   private void writeMacrosAtom() {
-    output("#macro a(X,Y,Z,RADIUS,R,G,B,T)\n" + " sphere{<X,Y,Z>,RADIUS\n"
-        + "  pigment{rgbt<R,G,B,T>}\n"
-        + "  clip()\n"
-        + "  no_shadow}\n" 
+    output("#macro a(X,Y,Z,RADIUS,R,G,B,T)\n" 
+        + " intersection {\n"
+        + "  sphere{<X,Y,Z>,RADIUS\n"
+        + "   pigment{rgbt<R,G,B,T>}\n"
+        + "   translucentFinish(T)\n"
+        + "   no_shadow}\n" 
+        + "  box {boundBox}\n"
+        + " pigment{rgbt<R,G,B,T>}\n"
+        + " translucentFinish(T)\n"
+        + " no_shadow}\n" 
         + "#end\n\n");
   }
 
@@ -176,6 +207,7 @@
     output("#macro b(X1,Y1,Z1,RADIUS1,X2,Y2,Z2,RADIUS2,R,G,B,T)\n"
         + " cone{<X1,Y1,Z1>,RADIUS1,<X2,Y2,Z2>,RADIUS2\n"
         + "  pigment{rgbt<R,G,B,T>}\n"
+        + "  translucentFinish(T)\n"
         + "  clip()\n"
         + "  no_shadow}\n" 
         + "#end\n\n");
@@ -183,10 +215,15 @@
 
   private void writeMacrosJoint() {
     output("#macro s(X,Y,Z,RADIUS,R,G,B,T)\n" 
-        + " sphere{<X,Y,Z>,RADIUS\n"
-        + "  pigment{rgbt<R,G,B,T>}\n" 
-        + "  clip()\n"
-        + "  no_shadow}\n" 
+        + " intersection {\n"
+        + "  sphere{<X,Y,Z>,RADIUS\n"
+        + "   pigment{rgbt<R,G,B,T>}\n" 
+        + "   translucentFinish(T)\n"
+        + "   no_shadow}\n" 
+        + "  box {boundBox}\n"
+        + " pigment{rgbt<R,G,B,T>}\n"
+        + " translucentFinish(T)\n"
+        + " no_shadow}\n" 
         + "#end\n\n");
   }
 
@@ -194,6 +231,7 @@
     output("#macro r(X1,Y1,Z1,X2,Y2,Z2,X3,Y3,Z3,R,G,B,T)\n"
         + " triangle{<X1,Y1,Z1>,<X2,Y2,Z2>,<X3,Y3,Z3>\n"
         + "  pigment{rgbt<R,G,B,T>}\n"
+        + "  translucentFinish(T)\n"
         + "  clip()\n"
         + "  no_shadow}\n" 
         + "#end\n\n");
@@ -201,10 +239,13 @@
 
   private void writeMacrosTextPixel() {
     output("#macro p(X,Y,Z,R,G,B)\n" 
-        + " box{<X,Y,Z>,<X+1,Y+1,Z+1>\n"
-        + "  pigment{rgb<R,G,B>}\n"
-        + "  clip()\n"
-        + "  no_shadow}\n" 
+        + " intersection {\n"
+        + "  box{<X,Y,Z>,<X+1,Y+1,Z+1>\n"
+        + "   pigment{rgb<R,G,B>}\n"
+        + "   no_shadow}\n" 
+        + "  box {boundBox}\n"
+        + " pigment{rgb<R,G,B>}\n"
+        + " no_shadow}\n" 
         + "#end\n\n");
   }
 
@@ -248,7 +289,8 @@
         + "\nAntialias=true"
         + "\nAntialias_Threshold=0.1" 
         + "\nDisplay=true"
-        + "\nPause_When_Done=true" 
+        + "\nPause_When_Done=true"
+        + "\nWarning_Level=5"
         + "\nVerbose=false" + "\n");
 
   }
@@ -355,8 +397,9 @@
       int nColix = 0;
       for (int i = 0; i < nVertices; i++) {
         color = color4(colixes[i]);
-        if (!htColixes.containsKey(color))
+        if (!htColixes.containsKey(color)) {
           htColixes.put(color, new Integer(nColix++));
+        }
       }
       String[] list = new String[nColix];
       Enumeration e = htColixes.keys();
@@ -366,8 +409,11 @@
       }
 
       output("texture_list { " + nColix);
-      for (int i = 0; i < nColix; i++)
-        output("\n, texture{pigment{rgbt<" + list[i] + ">}}");
+      for (int i = 0; i < nColix; i++) 
+        output("\n, texture{pigment{rgbt<" + list[i] + ">}" 
+          + " translucentFinish(" 
+          + translucencyFractionalFromColix(colixes[0]) + ")}");
+          // just using the transparency of the first colix there... 
       output("\n}\n");
     }
     output("face_indices { " + nFaces);
@@ -406,8 +452,10 @@
 
     if (colixes == null) {
       output("pigment{rgbt<" + color4(colix) + ">}\n");
+      output("  translucentFinish("  
+        + translucencyFractionalFromColix(colix) +")\n");
     }
-    output("  finish {finishMatte}\n");
+    output("  no_shadow\n");
     output("  clip()\n");
     output("}\n");
 
Index: src/org/openscience/jmol/app/PovrayDialog.java
===================================================================
--- src/org/openscience/jmol/app/PovrayDialog.java	(revision 8545)
+++ src/org/openscience/jmol/app/PovrayDialog.java	(working copy)
@@ -953,6 +953,7 @@
       data.append("Preview_End_Size=" + mosaicPreviewComboEnd.getSelectedItem() + "\n");
     }
     
+    data.append("Warning_Level=5\n");
     data.append("Verbose=false\n");
     return data.toString();
   }
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to