[node] Adding a density factor to the render node

Added a numeral scale to the node to make the density rendering of the cloud of point more customisable...
This commit is contained in:
Solal Depardieu 2021-05-07 13:24:11 +02:00 committed by Fabien Castan
parent 8299cabf28
commit 9b3f7fa127
2 changed files with 22 additions and 2 deletions

View file

@ -39,6 +39,14 @@ class RenderAnimatedCamera(desc.CommandLineNode):
value='', value='',
uid=[0], uid=[0],
), ),
desc.FloatParam(
name='cloudPointDensity',
label='Cloud Point Density',
description='''Number of point from the cloud rendered''',
value=0.50,
range=(0.01, 0.75, 0.01),
uid=[0],
),
desc.File( desc.File(
name='undistortedImages', name='undistortedImages',
label='Images Folder', label='Images Folder',

View file

@ -32,7 +32,12 @@ def main():
"--sfMCameraPath", dest="SFM_cam_path", metavar='FILE', required=True, "--sfMCameraPath", dest="SFM_cam_path", metavar='FILE', required=True,
help="This text will be used to render an image", help="This text will be used to render an image",
) )
parser.add_argument(
"--cloudPointDensity", dest="Cloud_Point_Density", type=float, required=True,
help="Number of point from the cloud rendered",
)
parser.add_argument( parser.add_argument(
"--undistortedImages", dest="undisto_images", metavar='FILE', required=True, "--undistortedImages", dest="undisto_images", metavar='FILE', required=True,
help="Save the generated file to the specified path", help="Save the generated file to the specified path",
@ -58,6 +63,11 @@ def main():
print("Error: --undisto_images argument not given, aborting.") print("Error: --undisto_images argument not given, aborting.")
parser.print_help() parser.print_help()
return return
if not args.Cloud_Point_Density:
print("Error: --Cloud_Point_Density argument not given, aborting.")
parser.print_help()
return
if not args.output_path: if not args.output_path:
print("Error: --output_path argument not given, aborting.") print("Error: --output_path argument not given, aborting.")
@ -106,6 +116,7 @@ def main():
bpy.context.view_layer.objects.active = obj bpy.context.view_layer.objects.active = obj
bpy.context.scene.camera = obj bpy.context.scene.camera = obj
#bpy.ops.image.open(directory=args.undisto_images, files=undis_imgs, show_multiview=False) #bpy.ops.image.open(directory=args.undisto_images, files=undis_imgs, show_multiview=False)
bpy.ops.image.open(filepath=args.undisto_images + "985078214_RJB05565.exr", directory=args.undisto_images, files=undis_imgs, relative_path=True, show_multiview=False)
obj.data.show_background_images = True obj.data.show_background_images = True
@ -126,9 +137,10 @@ def main():
obj.modifiers.new("ParticleSystem", "PARTICLE_SYSTEM") obj.modifiers.new("ParticleSystem", "PARTICLE_SYSTEM")
particle_system = bpy.data.particles["ParticleSystem"] particle_system = bpy.data.particles["ParticleSystem"]
particle_system.render_type = 'OBJECT' particle_system.render_type = 'OBJECT'
particle_system.instance_object = bpy.data.objects["Cube"] particle_system.instance_object = bpy.data.objects["Cube"]
particle_system.emit_from = 'VERT' particle_system.emit_from = 'VERT'
particle_system.count = 4000 #Modulation of numbers in the node particle_system.count = 4000#args.Cloud_Point_Density * len(obj.vertices.values())
particle_system.frame_end = 1.0 particle_system.frame_end = 1.0
particle_system.use_emit_random = False particle_system.use_emit_random = False
particle_system.particle_size = 0.02 particle_system.particle_size = 0.02