Ahora el script importa un mesh en alta otro en baja bakea la textura en el de baja borra todos los mesh.
Genera un mesh de una calidad media y crea una textura.
Tengo que conseguir que las texturas del bake se guarden en disco duro y se apliquen al material del mes de calidad media.
Le estoy dando vueltas a como guardar la imagen del normal con el mismo nombre que el mesh de calidad media, y aplicarlo al material que tiene.
Juani sabes cómo se indica guardar en disco las texturas del normal map.
estoy dándole cabezazos con.
bpy, ops, object, bake(type=COMBINED, pass_filter=set(), filepath=, width=512, height=512, margin=16, use_selected_to_active=False, cage_extrusión=0, cage_object=, normal_space=TANGENT, normal_r=POS_X, normal_g=POS_Y, normal_b=POS_Z, save_mode=INTERNAL, use_clear=False, use_cage=False, use_split_materials=False, use_automatic_name=False, uv_layer=).
Pero no logro hacerlo. Un saludo a todos y gracias por vuestro tiempo y ayuda.
Enlace con los ficheros necesarios para probar el script:
https://mega.nz/#F.T9520AQC.SdiHFxm4yPTeRrQwxmWcw
Import bpy, os
bpy, context, scene, render, bake_type = NoRMALS\nbpy, context, scene, render, use_bake_selected_to_active = True
folder = I:/catalunyaMetOrtoPru/demOrto/1/
for f in os, listdir(folder):
pathFiles = folder + f
basename, ext = os, path, splitext(f)
if pathFiles, find(\_Dem, tif) >= 1:
bpy, ops, importgis, georaster(importMode = DEM_RAW, filepath = pathFiles, rastCRS = EPSG:3857)
bpy, ops, tesselation, delaunay()
objetos_escena = bpy, data, objects
for objeto in objetos_escena:
objeto, select = False
for objeto in objetos_escena:
if objeto, name == basename:
objeto, select = True
bpy, ops, object, delete()
for objeto in objetos_escena:
if objeto, name, startswith(TIN):
nameHighDem = basename + High
objeto, name = nameHighDem
bpy, ops, importgis, georaster(importMode = PLANE, filepath = pathFiles, rastCRS = EPSG:3857)
objetos_escena = bpy, data, objects
for objeto in objetos_escena:
if objeto, name == basename:
nameLowDem = basename + Low
objeto, name = nameLowDem
escena = bpy, context, scene
objetos_escena = bpy, data, objects
bpy, ops, object, select_all(False)
objetos_dict = {}
for objeto in objetos_escena:
if objeto, type ==MESH:
objeto, select = False
nombre = objeto, name
values = nombre, split(\_)
if values[0] in objetos_dict.keys():
objetos_dict[values[0].append(objeto)
else:
objetos_dict[values[0] = [objeto].
For key in objetos_dict.keys():
list = objetos_dict[key]
bpy, ops, object, select_all(False)
list[0].select = True
list[1].select = True
escena, objects, active = list[1]
bpy, ops, object, bake_image()
bpy, ops, object, select_all(False)
list[0].select = True
bpy, ops, object, delete()
list[1].select = True
bpy, ops, object, delete()
for f in os, listdir(folder):
path = folder + f
basename, ext = os, path, splitext(f)
if path, find(\_Dem, tif) >= 1:
bpy, ops, importgis, georaster(importMode = DEM, filepath = path, rastCRS = EPSG:3857, fillNodata=True)
objeto = bpy, data, objects[basename]
objeto, select = True
bpy, context, scene, objects, active = objeto
bpy, ops, object, modifier_apply(apply_as=DATA, modifier=DEM)
bpy, ops, object, modifier_apply(apply_as=DATA, modifier=DEM.001)
if path, find(\_Orto.jpg) >= 1:
img = bpy, data, images, load(path)
cTex = bpy, data, textures, new(ColorTex, type = IMAGE)
cTex.image = img
materialSimple = bpy, data, materials, new(basename)
objeto, data, materials, append(materialSimple)
materialSimple, specular_color = (0,0,0)
materialSimple, specular_intensity = 0
mtex = materialSimple, texture_slots, add()
mtex.texture = cTex.
-- IMÁGENES ADJUNTAS --
🖼️
Estamos trabajando para mostrar las imágenes del foro
Adjunto #225566