\r
# Generate normal maps for X-Plane scenery?\r
# Strong recommendation: yes\r
-mstr_xp_scn_normalmaps = False\r
+mstr_xp_scn_normalmaps = True\r
\r
# Paths to required X-Plane scenery tools\r
#mstr_xp_meshtool = "/home/marcus/Developer/Projects/orthographic/bin/MeshTool"\r
# Now we convert this into a DDS\r
_tmpfn = mstr_datafolder + "z_orthographic/orthos/" + self._latlngfld + "/" + str(self._ty) + "_" + str(self._tx)\r
os.system(mstr_xp_ddstool + " --png2dxt1 " + _tmpfn + ".png " + _tmpfn + ".dds" )\r
- \r
os.remove(mstr_datafolder + "z_orthographic/orthos/" + self._latlngfld + "/" + str(self._ty) + "_" + str(self._tx) + ".png")\r
\r
# Now generate the normal map for this ortho.\r
if mstr_xp_genscenery and mstr_xp_scn_normalmaps:\r
# Generate the normal normal map first (hah)\r
nrm = mstr_xp_normalmap()\r
- nrmimg = nrm.generate_normal_map_for_layer(self._tile, False)\r
+ #nrmimg = nrm.generate_normal_map_for_layer(self._tile, False)\r
\r
# Now we need to walk through the water layers and generate a combined normal map\r
wtrlyr = Image.new("RGBA", (self._imgsize, self._imgsize))\r
for w in waterlayers:\r
wtrlyr.alpha_composite(w)\r
- wtrlyr = wtrlyr.resize((int(mstr_photores/4), int(mstr_photores/4)), Image.Resampling.BILINEAR)\r
+ wtrlyr = wtrlyr.resize((int(mstr_photores/2), int(mstr_photores/2)), Image.Resampling.BILINEAR)\r
wtrimg = nrm.generate_normal_map_for_layer(wtrlyr, True)\r
\r
# Blend\r
- nrmimg.alpha_composite(wtrimg)\r
+ #nrmimg.alpha_composite(wtrimg)\r
\r
# Save\r
- nrmfln = mstr_datafolder + "z_orthographic/normals/" + self._latlngfld + "/" + str(self._ty) + "_" + str(self._tx) + ".png"\r
- nrmimg.save(nrmfln)\r
+ nrmfln = mstr_datafolder + "z_orthographic/normals/" + self._latlngfld + "/" + str(self._ty) + "_" + str(self._tx) \r
+ wtrimg.save(nrmfln + ".png")\r
\r
\r
# Generates some random tree.\r
# Blue (reflectivity) and alpha (specularity) need to be 1 - but can be adjusted as needed\r
\r
# Resize original\r
- image = image.resize((int(mstr_photores/4), int(mstr_photores/4)), Image.Resampling.BILINEAR)\r
+ #image = image.resize((int(mstr_photores/4), int(mstr_photores/4)), Image.Resampling.BILINEAR)\r
\r
nmp = Image.new("RGBA", (image.width, image.height), (128,128,0,0))\r
\r
# Sobel filter\r
dx = (it_tr + 2.0 * it_r + it_br) - (it_tl + 2.0 * it_l + it_bl)\r
dy = (it_bl + 2.0 * it_b + it_br) - (it_tl + 2.0 * it_t + it_tr)\r
- dz = 10 # This is usually a good value for strength\r
+ dz = 3\r
+ #dz = 10 # This is usually a good value for strength\r
v = (dx, dy, dz)\r
nrm = self.normalize_vector(v)\r
\r
terstr = terstr + "\r\n"
terstr = terstr + "LOAD_CENTER " + str(cnt_x) + " " + str(cnt_y) + " " + str(dmt) + " 2048\r\n"
terstr = terstr + "BASE_TEX_NOWRAP ../../orthos/" + self._latlngfld + "/" + str(lat)+"_"+str(lng)+".dds\r\n"
- #if mstr_xp_scn_normalmaps:
- # terstr = terstr + "NORMAL_TEX 1.0 ../../normals/" + self._latlngfld + "/" + str(lat)+"_"+str(lng)+".png\r\n"
+ if mstr_xp_scn_normalmaps:
+ terstr = terstr + "NORMAL_TEX 1.0 ../../normals/" + self._latlngfld + "/" + str(lat)+"_"+str(lng)+".dds\r\n"
terfln = mstr_datafolder + "z_orthographic/terrain/" + self._latlngfld + "/" + str(lat)+"_"+str(lng)+".ter"