def voronoi_map(size, scale_factor, H, influence): """ Build a disturbed voronoi texture to mix with noise """ voronoi_map = numpy.zeros((size, size), dtype='float16') factor = (size / scale_factor) for x in range(size): for y in range(size): # Scale coordinates scaled_x = x / factor scaled_y = y / factor coords = Vector((scaled_x, scaled_y, 0)) # Distort coordinates with noise distortion = noise.fractal(coords, H, 2, 8) coords[0] += distortion / H coords[1] += distortion / H voronoi_data = noise.voronoi(coords) points = voronoi_data[0] # Voronoi F1F2 value = points[1] - points[0] voronoi_map[x, y] = value return voronoi_map / influence
def createPerlinTerrain(volData, Hfactor, Lacunarity, octaves): for x in range(volData.getWidth()): for y in range(volData.getHeight()): perlinVal = noise.fractal(Vector((x, y, 0)), Hfactor, Lacunarity, octaves) #for debuugging pourpose comment the line below #print("perlin values: " + str(perlinVal)) perlinVal += 1.0 perlinVal *= 0.5 perlinVal *= volData.getWidth() for z in range(volData.getDepth()): if (z < perlinVal): uVoxelValue = 245 else: uVoxelValue = 0 volData.setVoxelAt(x, y, z, uVoxelValue) return volData
def fractal_function(position, freq, amp, H, lacunarity, octaves, offset, gain, noise_basis, fractal_type): if fractal_type == 1: func = noise.fractal(position, H, lacunarity, octaves, noise_basis) elif fractal_type == 2: func = noise.multi_fractal(position, H, lacunarity, octaves, noise_basis) elif fractal_type == 3: func = noise.hetero_terrain(position, H, lacunarity, octaves, offset, noise_basis) elif fractal_type == 4: func = noise.hybrid_multi_fractal(position, H, lacunarity, octaves, offset, gain, noise_basis) elif fractal_type == 5: func = noise.ridged_multi_fractal(position, H, lacunarity, octaves, offset, gain, noise_basis) return func
def sv_main( verts=[], h_factor=1.0, lacunarity=1.0, octaves=3 ): data = [] in_sockets = [ ['v','Vector', verts], ['s', 'H Factor ', h_factor], ['s', 'Lacunarity', lacunarity], ['s', 'octaves', octaves] ] out_sockets = [ ['s', 'Float Data', [data]] ] if verts and verts[0]: for v in verts[0]: out = noise.fractal(v, h_factor, lacunarity, octaves ) data.append(out) return in_sockets, out_sockets
def fractal(nbasis, verts, h_factor, lacunarity, octaves, offset, gain): return [ noise.fractal(v, h_factor, lacunarity, octaves, nbasis) for v in verts ]
def fractal(nbasis, verts, h_factor, lacunarity, octaves, offset, gain): return [noise.fractal(v, h_factor, lacunarity, octaves, nbasis) for v in verts]
def noise_gen(coords, props): terrain_name = props[0] cursor = props[1] smooth = props[2] triface = props[3] sphere = props[4] land_mat = props[5] water_mat = props[6] texture_name = props[7] subd_x = props[8] subd_y = props[9] meshsize_x = props[10] meshsize_y = props[11] meshsize = props[12] rseed = props[13] x_offset = props[14] y_offset = props[15] z_offset = props[16] size_x = props[17] size_y = props[18] size_z = props[19] nsize = props[20] ntype = props[21] nbasis = props[22] vlbasis = props[23] distortion = props[24] hardnoise = int(props[25]) depth = props[26] amp = props[27] freq = props[28] dimension = props[29] lacunarity = props[30] offset = props[31] gain = props[32] marblebias = int(props[33]) marblesharpnes = int(props[34]) marbleshape = int(props[35]) height = props[36] height_invert = props[37] height_offset = props[38] maximum = props[39] minimum = props[40] falloff = int(props[41]) edge_level = props[42] falloffsize_x = props[43] falloffsize_y = props[44] stratatype = props[45] strata = props[46] addwater = props[47] waterlevel = props[48] vert_group = props[49] remove_double = props[50] fx_mixfactor = props[51] fx_mix_mode = props[52] fx_type = props[53] fx_bias = props[54] fx_turb = props[55] fx_depth = props[56] fx_frequency = props[57] fx_amplitude = props[58] fx_size = props[59] fx_loc_x = props[60] fx_loc_y = props[61] fx_height = props[62] fx_offset = props[63] fx_invert = props[64] x, y, z = coords # Origin if rseed == 0: origin = x_offset, y_offset, z_offset origin_x = x_offset origin_y = y_offset origin_z = z_offset o_range = 1.0 else: # Randomise origin o_range = 100 seed_set(rseed) origin = random_unit_vector() ox = (origin[0] * o_range) oy = (origin[1] * o_range) oz = 0 origin_x = (ox - (ox * 0.5)) + x_offset origin_y = (oy - (oy * 0.5)) + y_offset origin_z = oz + z_offset ncoords = (x / (nsize * size_x) + origin_x, y / (nsize * size_y) + origin_y, z / (nsize * size_z) + origin_z) # Noise type's if ntype in [0, 'multi_fractal']: value = multi_fractal( ncoords, dimension, lacunarity, depth, noise_basis=nbasis) * 0.5 elif ntype in [1, 'ridged_multi_fractal']: value = ridged_multi_fractal(ncoords, dimension, lacunarity, depth, offset, gain, noise_basis=nbasis) * 0.5 elif ntype in [2, 'hybrid_multi_fractal']: value = hybrid_multi_fractal(ncoords, dimension, lacunarity, depth, offset, gain, noise_basis=nbasis) * 0.5 elif ntype in [3, 'hetero_terrain']: value = hetero_terrain( ncoords, dimension, lacunarity, depth, offset, noise_basis=nbasis) * 0.25 elif ntype in [4, 'fractal']: value = fractal(ncoords, dimension, lacunarity, depth, noise_basis=nbasis) elif ntype in [5, 'turbulence_vector']: value = turbulence_vector(ncoords, depth, hardnoise, noise_basis=nbasis, amplitude_scale=amp, frequency_scale=freq)[0] elif ntype in [6, 'variable_lacunarity']: value = variable_lacunarity(ncoords, distortion, noise_type1=nbasis, noise_type2=vlbasis) elif ntype in [7, 'marble_noise']: value = marble_noise( (ncoords[0] - origin_x + x_offset), (ncoords[1] - origin_y + y_offset), (ncoords[2] - origin_z + z_offset), (origin[0] + x_offset, origin[1] + y_offset, origin[2] + z_offset), nsize, marbleshape, marblebias, marblesharpnes, distortion, depth, hardnoise, nbasis, amp, freq) elif ntype in [8, 'shattered_hterrain']: value = shattered_hterrain(ncoords, dimension, lacunarity, depth, offset, distortion, nbasis) elif ntype in [9, 'strata_hterrain']: value = strata_hterrain(ncoords, dimension, lacunarity, depth, offset, distortion, nbasis) elif ntype in [10, 'ant_turbulence']: value = ant_turbulence(ncoords, depth, hardnoise, nbasis, amp, freq, distortion) elif ntype in [11, 'vl_noise_turbulence']: value = vl_noise_turbulence(ncoords, distortion, depth, nbasis, vlbasis, hardnoise, amp, freq) elif ntype in [12, 'vl_hTerrain']: value = vl_hTerrain(ncoords, dimension, lacunarity, depth, offset, nbasis, vlbasis, distortion) elif ntype in [13, 'distorted_heteroTerrain']: value = distorted_heteroTerrain(ncoords, dimension, lacunarity, depth, offset, distortion, nbasis, vlbasis) elif ntype in [14, 'double_multiFractal']: value = double_multiFractal(ncoords, dimension, lacunarity, depth, offset, gain, nbasis, vlbasis) elif ntype in [15, 'rocks_noise']: value = rocks_noise(ncoords, depth, hardnoise, nbasis, distortion) elif ntype in [16, 'slick_rock']: value = slick_rock(ncoords, dimension, lacunarity, depth, offset, gain, distortion, nbasis, vlbasis) elif ntype in [17, 'planet_noise']: value = planet_noise(ncoords, depth, hardnoise, nbasis)[2] * 0.5 + 0.5 elif ntype in [18, 'blender_texture']: if texture_name != "" and texture_name in bpy.data.textures: value = bpy.data.textures[texture_name].evaluate(ncoords)[3] else: value = 0.0 else: value = 0.5 # Effect mix val = value if fx_type in [0, "0"]: fx_mixfactor = -1.0 fxval = val else: fxcoords = Trans_Effect((x, y, z), fx_size, (fx_loc_x, fx_loc_y)) effect = Effect_Function(fxcoords, fx_type, fx_bias, fx_turb, fx_depth, fx_frequency, fx_amplitude) effect = Height_Scale(effect, fx_height, fx_offset, fx_invert) fxval = Mix_Modes(val, effect, fx_mixfactor, fx_mix_mode) value = fxval # Adjust height value = Height_Scale(value, height, height_offset, height_invert) # Edge falloff: if not sphere: if falloff: ratio_x, ratio_y = abs(x) * 2 / meshsize_x, abs(y) * 2 / meshsize_y fallofftypes = [ 0, sqrt(ratio_y**falloffsize_y), sqrt(ratio_x**falloffsize_x), sqrt(ratio_x**falloffsize_x + ratio_y**falloffsize_y) ] dist = fallofftypes[falloff] value -= edge_level if (dist < 1.0): dist = (dist * dist * (3 - 2 * dist)) value = (value - value * dist) + edge_level else: value = edge_level # Strata / terrace / layers if stratatype not in [0, "0"]: if stratatype in [1, "1"]: strata = strata / height strata *= 2 steps = (sin(value * strata * pi) * (0.1 / strata * pi)) value = (value * 0.5 + steps * 0.5) * 2.0 elif stratatype in [2, "2"]: strata = strata / height steps = -abs(sin(value * strata * pi) * (0.1 / strata * pi)) value = (value * 0.5 + steps * 0.5) * 2.0 elif stratatype in [3, "3"]: strata = strata / height steps = abs(sin(value * strata * pi) * (0.1 / strata * pi)) value = (value * 0.5 + steps * 0.5) * 2.0 elif stratatype in [4, "4"]: strata = strata / height value = int(value * strata) * 1.0 / strata elif stratatype in [5, "5"]: strata = strata / height steps = (int(value * strata) * 1.0 / strata) value = (value * (1.0 - 0.5) + steps * 0.5) # Clamp height min max if (value < minimum): value = minimum if (value > maximum): value = maximum return value
def noise_gen(coords, props): terrain_name = props[0] cursor = props[1] smooth = props[2] triface = props[3] sphere = props[4] land_mat = props[5] water_mat = props[6] texture_name = props[7] subd_x = props[8] subd_y = props[9] meshsize_x = props[10] meshsize_y = props[11] meshsize = props[12] rseed = props[13] x_offset = props[14] y_offset = props[15] z_offset = props[16] size_x = props[17] size_y = props[18] size_z = props[19] nsize = props[20] ntype = props[21] nbasis = int(props[22]) vlbasis = int(props[23]) distortion = props[24] hardnoise = int(props[25]) depth = props[26] amp = props[27] freq = props[28] dimension = props[29] lacunarity = props[30] offset = props[31] gain = props[32] marblebias = int(props[33]) marblesharpnes = int(props[34]) marbleshape = int(props[35]) height = props[36] height_invert = props[37] height_offset = props[38] maximum = props[39] minimum = props[40] falloff = int(props[41]) edge_level = props[42] falloffsize_x = props[43] falloffsize_y = props[44] stratatype = props[45] strata = props[46] addwater = props[47] waterlevel = props[48] vert_group = props[49] remove_double = props[50] fx_mixfactor = props[51] fx_mix_mode = props[52] fx_type = props[53] fx_bias = props[54] fx_turb = props[55] fx_depth = props[56] fx_frequency = props[57] fx_amplitude = props[58] fx_size = props[59] fx_loc_x = props[60] fx_loc_y = props[61] fx_height = props[62] fx_offset = props[63] fx_invert = props[64] x, y, z = coords # Origin if rseed is 0: origin = x_offset, y_offset, z_offset origin_x = x_offset origin_y = y_offset origin_z = z_offset o_range = 1.0 else: # Randomise origin o_range = 10000.0 seed_set(rseed) origin = random_unit_vector() ox = (origin[0] * o_range) oy = (origin[1] * o_range) oz = (origin[2] * o_range) origin_x = (ox - (ox / 2)) + x_offset origin_y = (oy - (oy / 2)) + y_offset origin_z = (oz - (oz / 2)) + z_offset ncoords = (x / (nsize * size_x) + origin_x, y / (nsize * size_y) + origin_y, z / (nsize * size_z) + origin_z) # Noise basis type's if nbasis == 9: nbasis = 14 # Cellnoise if vlbasis == 9: vlbasis = 14 # Noise type's if ntype in [0, 'multi_fractal']: value = multi_fractal(ncoords, dimension, lacunarity, depth, nbasis) * 0.5 elif ntype in [1, 'ridged_multi_fractal']: value = ridged_multi_fractal(ncoords, dimension, lacunarity, depth, offset, gain, nbasis) * 0.5 elif ntype in [2, 'hybrid_multi_fractal']: value = hybrid_multi_fractal(ncoords, dimension, lacunarity, depth, offset, gain, nbasis) * 0.5 elif ntype in [3, 'hetero_terrain']: value = hetero_terrain(ncoords, dimension, lacunarity, depth, offset, nbasis) * 0.25 elif ntype in [4, 'fractal']: value = fractal(ncoords, dimension, lacunarity, depth, nbasis) elif ntype in [5, 'turbulence_vector']: value = turbulence_vector(ncoords, depth, hardnoise, nbasis, amp, freq)[0] elif ntype in [6, 'variable_lacunarity']: value = variable_lacunarity(ncoords, distortion, nbasis, vlbasis) elif ntype in [7, 'marble_noise']: value = marble_noise( (ncoords[0] - origin_x + x_offset), (ncoords[1] - origin_y + y_offset), (ncoords[2] - origin_z + z_offset), (origin[0] + x_offset, origin[1] + y_offset, origin[2] + z_offset), nsize, marbleshape, marblebias, marblesharpnes, distortion, depth, hardnoise, nbasis, amp, freq ) elif ntype in [8, 'shattered_hterrain']: value = shattered_hterrain(ncoords, dimension, lacunarity, depth, offset, distortion, nbasis) elif ntype in [9, 'strata_hterrain']: value = strata_hterrain(ncoords, dimension, lacunarity, depth, offset, distortion, nbasis) elif ntype in [10, 'ant_turbulence']: value = ant_turbulence(ncoords, depth, hardnoise, nbasis, amp, freq, distortion) elif ntype in [11, 'vl_noise_turbulence']: value = vl_noise_turbulence(ncoords, distortion, depth, nbasis, vlbasis, hardnoise, amp, freq) elif ntype in [12, 'vl_hTerrain']: value = vl_hTerrain(ncoords, dimension, lacunarity, depth, offset, nbasis, vlbasis, distortion) elif ntype in [13, 'distorted_heteroTerrain']: value = distorted_heteroTerrain(ncoords, dimension, lacunarity, depth, offset, distortion, nbasis, vlbasis) elif ntype in [14, 'double_multiFractal']: value = double_multiFractal(ncoords, dimension, lacunarity, depth, offset, gain, nbasis, vlbasis) elif ntype in [15, 'rocks_noise']: value = rocks_noise(ncoords, depth, hardnoise, nbasis, distortion) elif ntype in [16, 'slick_rock']: value = slick_rock(ncoords,dimension, lacunarity, depth, offset, gain, distortion, nbasis, vlbasis) elif ntype in [17, 'planet_noise']: value = planet_noise(ncoords, depth, hardnoise, nbasis)[2] * 0.5 + 0.5 elif ntype in [18, 'blender_texture']: if texture_name != "" and texture_name in bpy.data.textures: value = bpy.data.textures[texture_name].evaluate(ncoords)[3] else: value = 0.0 else: value = 0.5 # Effect mix val = value if fx_type in [0,"0"]: fx_mixfactor = -1.0 fxval = val else: fxcoords = Trans_Effect((x, y, z), fx_size, (fx_loc_x, fx_loc_y)) effect = Effect_Function(fxcoords, fx_type, fx_bias, fx_turb, fx_depth, fx_frequency, fx_amplitude) effect = Height_Scale(effect, fx_height, fx_offset, fx_invert) fxval = Mix_Modes(val, effect, fx_mixfactor, fx_mix_mode) value = fxval # Adjust height value = Height_Scale(value, height, height_offset, height_invert) # Edge falloff: if not sphere: if falloff: ratio_x, ratio_y = abs(x) * 2 / meshsize_x, abs(y) * 2 / meshsize_y fallofftypes = [0, sqrt(ratio_y**falloffsize_y), sqrt(ratio_x**falloffsize_x), sqrt(ratio_x**falloffsize_x + ratio_y**falloffsize_y) ] dist = fallofftypes[falloff] value -= edge_level if(dist < 1.0): dist = (dist * dist * (3 - 2 * dist)) value = (value - value * dist) + edge_level else: value = edge_level # Strata / terrace / layers if stratatype not in [0, "0"]: if stratatype in [1, "1"]: strata = strata / height strata *= 2 steps = (sin(value * strata * pi) * (0.1 / strata * pi)) value = (value * 0.5 + steps * 0.5) * 2.0 elif stratatype in [2, "2"]: strata = strata / height steps = -abs(sin(value * strata * pi) * (0.1 / strata * pi)) value = (value * 0.5 + steps * 0.5) * 2.0 elif stratatype in [3, "3"]: strata = strata / height steps = abs(sin(value * strata * pi) * (0.1 / strata * pi)) value = (value * 0.5 + steps * 0.5) * 2.0 elif stratatype in [4, "4"]: strata = strata / height value = int( value * strata ) * 1.0 / strata elif stratatype in [5, "5"]: strata = strata / height steps = (int( value * strata ) * 1.0 / strata) value = (value * (1.0 - 0.5) + steps * 0.5) # Clamp height min max if (value < minimum): value = minimum if (value > maximum): value = maximum return value
def landscape_gen(x, y, z, falloffsize, options): # options = [0, 1.0, 'multi_fractal', 0, 0, 1.0, 0, 6, 1.0, 2.0, 1.0, 2.0, # 0, 0, 0, 1.0, 0.0, 1, 0.0, 1.0, 0, 0, 0, 0.0, 0.0] rseed = options[0] nsize = options[1] ntype = options[2] nbasis = int(options[3][0]) vlbasis = int(options[4][0]) distortion = options[5] hardnoise = options[6] depth = options[7] dimension = options[8] lacunarity = options[9] offset = options[10] gain = options[11] marblebias = int(options[12][0]) marblesharpnes = int(options[13][0]) marbleshape = int(options[14][0]) invert = options[15] height = options[16] heightoffset = options[17] falloff = int(options[18][0]) sealevel = options[19] platlevel = options[20] strata = options[21] stratatype = options[22] sphere = options[23] x_offset = options[24] y_offset = options[25] # origin if rseed == 0: origin = 0.0 + x_offset, 0.0 + y_offset, 0.0 origin_x = x_offset origin_y = y_offset origin_z = 0.0 else: # randomise origin seed_set(rseed) origin = random_unit_vector() origin[0] += x_offset origin[1] += y_offset origin_x = ((0.5 - origin[0]) * 1000.0) + x_offset origin_y = ((0.5 - origin[1]) * 1000.0) + y_offset origin_z = (0.5 - origin[2]) * 1000.0 # adjust noise size and origin ncoords = (x / nsize + origin_x, y / nsize + origin_y, z / nsize + origin_z) # noise basis type's if nbasis == 9: nbasis = 14 # to get cellnoise basis you must set 14 instead of 9 if vlbasis == 9: vlbasis = 14 # noise type's if ntype == 'multi_fractal': value = multi_fractal(ncoords, dimension, lacunarity, depth, nbasis) * 0.5 elif ntype == 'ridged_multi_fractal': value = ridged_multi_fractal(ncoords, dimension, lacunarity, depth, offset, gain, nbasis) * 0.5 elif ntype == 'hybrid_multi_fractal': value = hybrid_multi_fractal(ncoords, dimension, lacunarity, depth, offset, gain, nbasis) * 0.5 elif ntype == 'hetero_terrain': value = hetero_terrain(ncoords, dimension, lacunarity, depth, offset, nbasis) * 0.25 elif ntype == 'fractal': value = fractal(ncoords, dimension, lacunarity, depth, nbasis) elif ntype == 'turbulence_vector': value = turbulence_vector(ncoords, depth, hardnoise, nbasis)[0] elif ntype == 'variable_lacunarity': value = variable_lacunarity(ncoords, distortion, nbasis, vlbasis) + 0.5 elif ntype == 'marble_noise': value = marble_noise(x * 2.0 / falloffsize, y * 2.0 / falloffsize, z * 2 / falloffsize, origin, nsize, marbleshape, marblebias, marblesharpnes, distortion, depth, hardnoise, nbasis) elif ntype == 'shattered_hterrain': value = shattered_hterrain(ncoords[0], ncoords[1], ncoords[2], dimension, lacunarity, depth, offset, distortion, nbasis) elif ntype == 'strata_hterrain': value = strata_hterrain(ncoords[0], ncoords[1], ncoords[2], dimension, lacunarity, depth, offset, distortion, nbasis) elif ntype == 'planet_noise': value = planet_noise(ncoords, depth, hardnoise, nbasis)[2] * 0.5 + 0.5 else: value = 0.0 # adjust height if invert != 0: value = (1 - value) * height + heightoffset else: value = value * height + heightoffset # edge falloff if sphere == 0: # no edge falloff if spherical if falloff != 0: fallofftypes = [ 0, hypot(x * x, y * y), hypot(x, y), abs(y), abs(x) ] dist = fallofftypes[falloff] if falloff == 1: radius = (falloffsize / 2)**2 else: radius = falloffsize / 2 value = value - sealevel if (dist < radius): dist = dist / radius dist = (dist * dist * (3 - 2 * dist)) value = (value - value * dist) + sealevel else: value = sealevel # strata / terrace / layered if stratatype != '0': strata = strata / height if stratatype == '1': strata *= 2 steps = (sin(value * strata * pi) * (0.1 / strata * pi)) value = (value * (1.0 - 0.5) + steps * 0.5) * 2.0 elif stratatype == '2': steps = -abs(sin(value * strata * pi) * (0.1 / strata * pi)) value = (value * (1.0 - 0.5) + steps * 0.5) * 2.0 elif stratatype == '3': steps = abs(sin(value * strata * pi) * (0.1 / strata * pi)) value = (value * (1.0 - 0.5) + steps * 0.5) * 2.0 else: value = value # clamp height if (value < sealevel): value = sealevel if (value > platlevel): value = platlevel return value
def sv_main(vol_region=32, sphere_radius=30): in_sockets = [['s', 'Volume region', vol_region], ['s', 'Sphere radius', sphere_radius]] #Create a 64x64x64 volume of integers volume = vol_region - 1 r = pv.Region(pv.Vector3Dint32_t(0, 0, 0), pv.Vector3Dint32_t(volume, volume, volume)) vol = pv.SimpleVolumeuint8(r) #Now fill the volume with our data (a sphere) v3dVolCenter = pv.Vector3Dint32_t(vol.getWidth() // 2, vol.getHeight() // 2, vol.getDepth() // 2) sphereRadius = sphere_radius #print(sphere_radius) #This three-level for loop iterates over every voxel in the volume for z in range(vol.getDepth()): for y in range(vol.getHeight()): for x in range(vol.getWidth()): #compute Noise so we add to the distance field plusFactor = noise.fractal(Vector( (x, y, z)), 0.25, 0.75, 3, 1) * 6.0 #print(plusFactor) #Compute how far the current position is from the center of the volume fDistToCenter = (pv.Vector3Dint32_t(x, y, z) - v3dVolCenter).length() #print(fDistToCenter) #If the current voxel is less than 'radius' units from the center then we make it solid. #if(fDistToCenter + plusFactor <= sphereRadius + (noise.random()*3)): if (fDistToCenter + plusFactor <= sphereRadius): #Our new voxel value uVoxelValue = 255 else: uVoxelValue = 0 #Write the voxel value into the volume #print(uVoxelValue) vol.setVoxelAt(x, y, z, uVoxelValue) #Create a mesh, pass it to the extractor and generate the mesh mesh = pv.SurfaceMeshPositionMaterialNormal() extractor = pv.CubicSurfaceExtractorWithNormalsSimpleVolumeuint8( vol, r, mesh) extractor.execute() #That's all of the PolyVox generation done, now to convert the output to something OpenGL can read efficiently vertices = [] verts_out = [] #Throw in the vertex indices into an array indices = mesh.getIndices() Nindx = mesh.getNoOfIndices() #uncomment the line above for testing pourpose only #print("Indices: " + str(indices)) #print("N. of Indices: " + str(Nindx)) for vertex in mesh.getVertices(): p = vertex.getPosition() vertices.append(tuple([p.getX(), p.getY(), p.getZ()])) verts_out.append(vertices) #uncomment the line above for testing pourpose only #print("Vertices: " + str(vertices)) #print("N. vert: " + str(mesh.getNoOfVertices())) Tris = [(indices[i:i + 3]) for i in range(0, len(indices) - 1, 3)] out_sockets = [ ['v', 'Verts', [verts_out]], ['s', 'Tris', [Tris]], ] #verts_out.append(vertices) return in_sockets, out_sockets