Added HDR output file format

This commit is contained in:
Chirag Singh
2024-09-01 14:07:52 +05:30
parent 284ade69b4
commit 3613c4e059
2 changed files with 17 additions and 14 deletions
+14 -12
View File
@@ -468,21 +468,23 @@ class RadianceRender(bpy.types.Operator):
end_time = time.time() end_time = time.time()
print(f"Render completed in {end_time - start_time:.2f} seconds") print(f"Render completed in {end_time - start_time:.2f} seconds")
output_hdr_path = os.path.join(output_dir, f"{output_file_name}.{output_file_format.lower()}") output_hdr_path = os.path.join(output_dir, f"{output_file_name}.hdr")
print(f"Saving HDR output to: {output_hdr_path}") print(f"Saving HDR output to: {output_hdr_path}")
if output_file_format == "HDR": with open(output_hdr_path, "wb") as wtr:
with open(output_hdr_path, "wb") as wtr: wtr.write(image)
wtr.write(image)
else: if output_file_format == "HDR_TIFF":
pass print("Applying tone mapping...")
print("Applying tone mapping...") pcond_image = pr.pcond(hdr=output_hdr_path, human=True)
pcond_image = pr.pcond(hdr=output_hdr_path, human=True)
tiff_path = os.path.join(output_dir, f"{output_file_name}.tiff")
print(f"Saving TIFF output to: {tiff_path}")
pr.ra_tiff(inp=pcond_image, out=tiff_path, lzw=True)
tiff_path = os.path.join(output_dir, f"{output_file_name}.tiff")
print(f"Saving TIFF output to: {tiff_path}")
pr.ra_tiff(inp=pcond_image, out=tiff_path, lzw=True)
print("Radiance rendering process completed successfully.") print("Radiance rendering process completed successfully.")
self.report({"INFO"}, "Radiance rendering completed. Output: {}".format(tiff_path)) self.report({"INFO"}, f"Radiance rendering completed. HDR Output: {output_hdr_path}")
if output_file_format == "HDR_TIFF":
self.report({"INFO"}, f"TIFF Output: {tiff_path}")
return {"FINISHED"} return {"FINISHED"}
# def get_active_camera(self, context): # def get_active_camera(self, context):
+3 -2
View File
@@ -342,9 +342,10 @@ class RadianceExporterProperties(PropertyGroup):
name="Output File Format", name="Output File Format",
description="Format of the output image file", description="Format of the output image file",
items=[ items=[
("HDR", "HDR + Tiff", "High Dynamic Range"), ("HDR", "HDR", "High Dynamic Range (HDR) file only"),
("HDR_TIFF", "HDR + Tiff", "High Dynamic Range (HDR) and Tiff files"),
], ],
default="HDR", default="HDR_TIFF",
) )
use_hdr: BoolProperty( use_hdr: BoolProperty(