Johann Woelper 10 lat temu
rodzic
commit
488bf6b4d4
6 zmienionych plików z 209 dodań i 152 usunięć
  1. 2 2
      lmapper/bake.py
  2. 1 1
      lmapper/include.rib
  3. 43 25
      lmapper/options.rib
  4. 16 13
      lmapper/scene_all.rib
  5. 126 91
      lmapper/shaders/bake.sdl
  6. 21 20
      lmapper/shaders/bake.sl

+ 2 - 2
lmapper/bake.py

@@ -9,7 +9,7 @@ platform = sys.platform
 
 SHADERS = 'shaders'
 TEXTURES = 'textures'
-RES = 512
+RES = 4096
 
 os.environ['DL_SHADERS_PATH'] = os.path.join(root, SHADERS)
 os.environ['DL_TEXTURES_PATH'] = os.path.join(root, TEXTURES)
@@ -52,7 +52,7 @@ print gen_includes()
 cleanup()
 
 #subprocess.call(['renderdl', '-res', str(RES), str(RES), '-id', '-progress', 'options.rib'])
-subprocess.call(['renderdl', '-res', str(RES), str(RES), '-progress', 'options.rib'])
+subprocess.call(['renderdl', '-res', str(RES), str(RES), '-id','-progress', 'options.rib'])
 
 bake_post_render(root)
 

+ 1 - 1
lmapper/include.rib

@@ -1 +1 @@
-ReadArchive "/home/woelper/Documents/lab/lmapper/receiver/ground2.rib"
+ReadArchive "/Users/jwoelper/Documents/lab/lmapper/receiver/ground.rib"

+ 43 - 25
lmapper/options.rib

@@ -24,36 +24,54 @@ PixelFilter "mitchell" 4 4
 #an der commandline einfach mit -res x y angeben
 Format 512 512 1.0
 
-#Limit maximum ray depth
-Option "trace" "maxdepth" [2]
-#Option "limits" "geommemory" [8000]
-#Option "limits" "gridsize" [256]
+Projection "perspective" "fov" 50
+Translate 0 0 1250
+# from top
+Rotate -180 1 0 0
 
-Projection "perspective" "fov" 55
-Translate 0 0 15
-Rotate 90 1 0 0
-Rotate 25 1 0 0 
+# From side
+#Rotate 60 1 0 0 
+#Translate 0 0 0
+#Rotate -15 0 0 1
 
-#BAKE OPTIONS
-Attribute "cull" "backfacing" [0] "hidden" [0]
-#DICE BOTH SIDES EQUALLY
-Attribute "dice" "rasterorient" [0]
-Attribute "dice" "binary" [1]
-Attribute "sides" "backfacetolerance" [90]
-#GIVE DEPTH TO SURFACES
-#Attribute "sides" "integer doubleshaded" [1]
-#WICHTIG: wen zu low, artefakte in feinen disp-kanten
-Attribute "trace" "bias" [0.55]
-#SHADOW SHOULD BE INFLUENCED BY DISPLACEMENTS (SELFSHADOW)
-Attribute "trace" "displacements" 1
-Attribute "visibility" "transmission" ["shader"]
-Attribute "visibility" "trace" [1]
 
+Option "trace" "maxdepth" [4]
 
+WorldBegin
 
+    #Limit maximum ray depth
 
-	
+    #Option "limits" "geommemory" [8000]
+    #Option "limits" "gridsize" [256]
 
-# define meshes to bake / include in lighting simulation
-ReadArchive "scene_all.rib"
+    #BAKE OPTIONS
+    Attribute "cull" "backfacing" [0] "hidden" [0]
+    #DICE BOTH SIDES EQUALLY
+    Attribute "dice" "rasterorient" [0]
+    Attribute "dice" "binary" [1]
+    Attribute "sides" "backfacetolerance" [90]
+    #GIVE DEPTH TO SURFACES
+    #Attribute "sides" "integer doubleshaded" [1]
+    
+    # ADJUST AFTER HUGE SCALING CHANGES
+    Attribute "trace" "bias" [0.21]
+    
+    # SHADOW SHOULD BE INFLUENCED BY DISPLACEMENTS (SELFSHADOW)
+    Attribute "trace" "displacements" 1
 
+    # Turn on raytraced shadows
+    Attribute "visibility" "transmission" [1]
+    Attribute "visibility" "int diffuse" [1]
+    Attribute "visibility" "int specular" [1]
+
+    Attribute "shade" "transmissionhitmode" ["primitive"]
+    Attribute "visibility" "trace" [1]
+
+
+
+        
+
+    # define meshes to bake / include in lighting simulation
+    ReadArchive "scene_all.rib"
+
+WorldEnd

+ 16 - 13
lmapper/scene_all.rib

@@ -1,16 +1,13 @@
-WorldBegin
+#WorldBegin
 	AttributeBegin
-        Attribute "light" "shadows" "on" #Turn on automatic shadows
+        
 		#Attribute "light" "integer samples" [128]
-		
         #LightSource "mp_light_occlusion" 2 "intensity" [0.15] "float samples" 8 "float maxbright" [0.5]
-        LightSource "mp_light_spot" 3 "float coneangle" [50] "float blur" [0.2] "float samples" [8] "float decay" [0] "intensity" [1.0] "color lightcolor" [1 1 0.8] "from" [0 200 600] "to" [0 0 0] "string __category" ["sun"]
-		#LightSource "spotlight" 77 "float coneangle" [50] "string shadowmap" ["raytrace"] "float blur" [0.2] "float samples" [8] "float decay" [0] "intensity" [1.0] "color lightcolor" [1 1 1] "from" [0 200 600] "to" [0 0 0] "string __category" ["sun"]
-		#LightSource "physicalsun" 44 "from" [0 200 600] "to" [0 0 0] "string __category" ["sun"]
-        
+        LightSource "mp_light_spot" 3 "float coneangle" [50] "float blur" [0.1] "float samples" [32] "float decay" [0] "intensity" [1.0] "color lightcolor" [1 1 0.8] "from" [200 -2000 1000] "to" [0 0 0] "string __category" ["sun"]
+		
         #The athmospheric light, derived from a HDRI map
 		#LightSource "envlight2" 2 "string envmap" ["textures/env.tdl"] "float Kenv" [5] "float samples" [32] "float Kocc" [1] "string __category" ["env"] 
-        LightSource "mp_envlight2" 4 "string envmap" ["textures/env.tdl"] "float Kenv" [5] "float samples" [32] "float Kocc" [1] "color light_color" [.6 .6 .6] "string __category" ["env"]
+        LightSource "mp_envlight2" 4 "string envmap" ["textures/env.tdl"] "float Kenv" [5] "float samples" [32] "float Kocc" [1] "color light_color" [1 1 1] "string __category" ["env"]
 		
         #LightSource "ambientlight" 10 "string __category" ["env"]
 		#LightSource "ambientlight" 10 
@@ -22,13 +19,19 @@ WorldBegin
             Surface "bake" "string bakefile" ["receiver"] "string texColName" [""] "string texSpecName" [""] "float Ka" [0.5] "float Kd" [0.4] "float Ks" [0.5] "float roughness" [0.1]
             #Surface "paintedplastic"
             
-            Attribute "displacementbound" "sphere" [1.5]
-            Displacement "mp_disp" "float offset" [0] "float Km" [2] "string texname" ["textures/heightmap.tdl"]
+            Attribute "displacementbound" "sphere" [210]
+            Displacement "mp_disp" "float offset" [.01] "float Km" [200] "string texname" ["textures/tweaked_heightmap.tdl"]
             ReadArchive "include.rib"
         AttributeEnd
 
-        #Translate 0 0 2
-        #Sphere 1 -1 1 360
+        #Translate 1 0 0
+        #Cone 2 1 360
+
+        
+        AttributeBegin
+            Surface "paintedplastic"
+            ReadArchive "caster/objects.rib"
+        AttributeEnd
 
 	AttributeEnd
-WorldEnd
+#WorldEnd

+ 126 - 91
lmapper/shaders/bake.sdl

@@ -4,7 +4,7 @@
 # DO NOT EDIT THIS FILE !!!                                                #
 ############################################################################
 
-# Compiled with 3Delight 12.0.19 linux64 (Aug 25 2015, 42ac0c) "Suspiria"
+# Compiled with 3Delight 12.0.19 darwin-x86_64 (Aug 25 2015, 42ac0c) "Suspiria"
 
 %code 7 121
 0
@@ -37,18 +37,19 @@
 0
 0
 0
-13
+14
 0 12 0
-0 1 2.00000003e-01
 0 1 5.00000000e-01
+0 1 2.00000003e-01
+0 4 "_diff.bake&binary"
 0 4 ""
 0 1 1.00000001e-01
+0 1 0.00000000e+00
 0 4 "env"
 0 4 "_env.bake&binary"
 0 4 "sun"
-0 4 "_diff.bake&binary"
 0 4 "_spec.bake&binary"
-0 1 0.00000000e+00
+0 4 "_shading.bake&binary"
 0 1 1.00000000e+00
 0 1 1.57079637e+00
 5
@@ -69,35 +70,35 @@
 
 3
 
-1 41 29 
+1 42 30 
 
 1
 3 
 
 3
 
-1 42 30 
+1 43 29 
 
 1
 3 
 
 3
 
-1 43 30 
+1 44 29 
 
 1
 3 
 
 3
 
-7 44 31 
+7 45 32 
 
 1
 3 
 
 3
 
-1 45 32 
+1 46 33 
 
 1
 3 
@@ -143,61 +144,80 @@
 
 0
 
-3
+4
+4 0 0 0
 4 0 0 0
 10 0 0 0
 1 0 0 0
-6
+10
 10 0 0 0
 3 0 0 0
 3 0 0 0
+3 0 0 0
+3 0 0 0
+3 0 0 0
 9 0 0 0
 8 0 0 0
+8 0 0 0
 1 0 0 0
-148
-
-9 2 38 38 38 
-9 3 39 39 39 
-135 52 15 1 
-1 48 40 
-178 47 6 33 0 0 
-235 47 46 
-177 49 6 52 48 33 
-232 49 0 27 
-26 50 0 19 
-135 53 18 1 
-37 54 53 52 
-25 50 50 54 
-170 2 46 44 34 
-190 46 13 14 50 28 
+196
+
+9 3 40 40 40 
+135 57 15 1 
+40 59 4 
+135 58 59 1 
+4 52 34 
+4 53 34 
+1 50 41 
+178 49 6 35 0 0 
+235 49 50 
+177 51 6 57 50 35 
+232 51 0 31 
+26 54 0 19 
+135 59 18 1 
+37 60 59 57 
+25 55 54 60 
+19 52 52 55 
+170 2 48 45 36 
+190 48 13 14 52 28 
 234 
-179 47 6 33 0 0 
-236 -49 
-1 48 40 
-178 47 6 35 0 0 
-235 47 64 
-177 49 6 52 48 35 
-232 49 0 45 
-135 53 18 1 
-37 54 53 52 
-25 50 19 54 
-2 51 0 
-170 2 46 44 36 
-190 46 13 14 50 28 
-170 2 46 44 37 
-190 46 13 14 51 28 
-26 50 50 51 
-19 2 2 50 
+179 49 6 35 0 0 
+236 -53 
+1 50 41 
+178 49 6 37 0 0 
+235 49 46 
+177 51 6 57 50 37 
+232 51 0 27 
+135 59 18 1 
+37 60 59 57 
+25 55 19 60 
+19 53 53 55 
+170 2 48 45 31 
+190 48 13 14 53 28 
 234 
-179 47 6 35 0 0 
-236 -67 
-
-35
-5 10 14 17 23 26 32 36 40 44 48 52 57 63 64 70 72 75 81 84 
-90 94 98 102 106 109 114 120 125 131 135 139 140 146 148 
-8
+179 49 6 37 0 0 
+236 -49 
+158 56 57 58 46 
+170 2 47 45 38 
+190 47 13 14 56 28 
+170 2 48 45 39 
+25 55 52 42 
+25 54 53 43 
+19 52 55 54 
+190 48 13 14 52 28 
+26 52 0 52 
+1 50 44 
+25 53 56 50 
+19 2 52 53 
+
+47
+5 9 12 16 19 22 25 31 34 40 44 48 52 56 60 64 69 75 76 82 
+84 87 93 96 102 106 110 114 118 122 127 133 134 140 142 147 152 158 163 167 
+171 175 181 185 188 192 196 
+9
 3
 15
+4
 6
 19
 18
@@ -218,58 +238,73 @@
 4 0 0 0
 10 0 0 0
 1 0 0 0
-6
+9
 10 0 0 0
 3 0 0 0
 3 0 0 0
+3 0 0 0
+3 0 0 0
 9 0 0 0
 8 0 0 0
+8 0 0 0
 1 0 0 0
-135
-
-9 3 39 39 39 
-135 61 15 1 
-1 57 40 
-178 56 6 33 0 0 
-235 56 46 
-177 58 6 61 57 33 
-232 58 0 27 
-26 59 0 19 
-135 62 18 1 
-37 63 62 61 
-25 59 59 63 
-170 2 55 44 34 
-190 55 13 14 59 28 
+181
+
+9 3 40 40 40 
+135 69 15 1 
+40 71 4 
+135 70 71 1 
+4 65 34 
+4 66 34 
+1 63 41 
+178 62 6 35 0 0 
+235 62 50 
+177 64 6 69 63 35 
+232 64 0 31 
+26 67 0 19 
+135 71 18 1 
+37 72 71 69 
+25 68 67 72 
+19 65 65 68 
+170 2 61 45 36 
+190 61 13 14 65 28 
 234 
-179 56 6 33 0 0 
-236 -49 
-1 57 40 
-178 56 6 35 0 0 
-235 56 56 
-177 58 6 61 57 35 
-232 58 0 37 
-135 62 18 1 
-37 63 62 61 
-25 59 19 63 
-2 60 0 
-170 2 55 44 36 
-190 55 13 14 59 28 
-170 2 55 44 37 
-190 55 13 14 60 28 
+179 62 6 35 0 0 
+236 -53 
+1 63 41 
+178 62 6 37 0 0 
+235 62 46 
+177 64 6 69 63 37 
+232 64 0 27 
+135 71 18 1 
+37 72 71 69 
+25 68 19 72 
+19 66 66 68 
+170 2 61 45 31 
+190 61 13 14 66 28 
 234 
-179 56 6 35 0 0 
-236 -59 
-
-32
-5 9 12 18 21 27 31 35 39 43 47 52 58 59 65 67 70 76 79 85 
-89 93 97 101 104 109 115 120 126 127 133 135 
+179 62 6 37 0 0 
+236 -49 
+158 67 69 70 46 
+170 2 61 45 38 
+190 61 13 14 67 28 
+170 2 61 45 39 
+25 68 65 42 
+25 67 66 43 
+19 65 68 67 
+190 61 13 14 65 28 
+
+43
+5 9 12 16 19 22 25 31 34 40 44 48 52 56 60 64 69 75 76 82 
+84 87 93 96 102 106 110 114 118 122 127 133 134 140 142 147 152 158 163 167 
+171 175 181 
 
 %comment-3dl 7 121
 6
 "MacroBlocks_*opacity"
-"MwowIDMKIDEgMCAzCiAxNSA2MSA1NyAzCjcgNAogNCAwIDEKIDYxIDAgMTkgMTggNTkKMjEgNAogNCAwIDIKIDYxIDAgMTkgMTggNTkgNjA="
+"NAowIDcKIDIgMCA2CiAxNSA0IDY1IDY2IDY5IDcwIDYzIDMKMTEgNQogNCAxIDAKIDY5IDAgMTkgMTggNjUKMjYgNAogMyAxIDAKIDY5IDE5IDE4IDY2CjM5IDMKIDMgMSAwCiA2NiA0MiA0MyA2NQ=="
 "MacroBlocks_surface"
-"NAowIDQKIDEgMCA0CiAxNSA1MiA0OCAyIDMKOCA0CiA0IDAgMQogNTIgMCAxOSAxOCA1MAoyMiA0CiA0IDAgMgogNTIgMCAxOSAxOCA1MCA1MQozMCAyCiAyIDEgMAogNTAgNTEgMg=="
+"NQowIDcKIDIgMCA2CiAxNSA0IDUyIDUzIDU3IDU4IDUwIDMKMTEgNQogNCAxIDAKIDU3IDAgMTkgMTggNTIKMjYgNAogMyAxIDAKIDU3IDE5IDE4IDUzCjM5IDMKIDMgMSAwCiA1MyA0MiA0MyA1Mgo0MyA0CiA0IDAgMQogNTIgNTYgMCA0NCAy"
 "OpCodesForDerivatives_*opacity"
 "MAo="
 "OpCodesForDerivatives_surface"

+ 21 - 20
lmapper/shaders/bake.sl

@@ -8,32 +8,33 @@ surface bake (float Ka = 0.2, Kd = 0.5, Ks = 0.5;
   
   extern point P;
 
+
+color env = 0;
+color lambert = 0;
+
+// ENV ILLUMINANCE LOOP
 illuminance( "env", P,Nn, PI/2 )
-  {
-    
-    // working bake( concat(bakefile,"_sun.bake&binary"), s, t, (diffuse(Nn)) );
-    //Ln = normalize(L);
-    color env = Cs * Cl * normalize(L).Nn;
-    
+  {    
+    env += Cs * Cl * normalize(L).Nn; 
     bake( concat(bakefile,"_env.bake&binary"), s, t, env );
   }
 
 
-illuminance( "sun", P, Nn, PI/2 )
+// SUN ILLUMINANCE LOOP
+illuminance("sun", P, Nn, PI/2 )
   {
     
-    // working bake( concat(bakefile,"_sun.bake&binary"), s, t, (diffuse(Nn)) );
-    //Ln = normalize(L);
-    color lambert = Cl * normalize(L).Nn;
-    color specular = Cs;
-    
-    bake( concat(bakefile,"_diff.bake&binary"), s, t, lambert );
-    bake( concat(bakefile,"_spec.bake&binary"), s, t, specular );
-    
-    Ci += lambert*specular;
+    lambert += Cl * normalize(L).Nn;
+    bake( concat(bakefile,"_diff.bake&binary"), s, t, lambert ); 
   }
-  
-  
-  
-  
+
+color spec = specular(Nn, V, roughness);
+bake( concat(bakefile,"_spec.bake&binary"), s, t, spec );
+bake( concat(bakefile,"_shading.bake&binary"), s, t, (Ka * env + Kd * lambert) );
+
+
+
+Ci = (Cs * (Ka * env + Kd * lambert) + 1 * Ks * spec);
+
+
 }