Hello,
I’m trying to import a landscape HDRI, or access it in Render in some way, and it seems Rhino has it’s own format. Probably an elementary question, but how do I do it?
After downloading https://hdrihaven.com/hdri/?c=sunrise-sunset&h=tears_of_steel_bridge (4k version):
Open environments panel
Add Basic Environment
Click to assign texture for Background Image, and select your downloaded HDRI
Ensure Original Projection is Equirectangular, Output projection Same as input
Set your new environment as 360°, or even Global environment
Done (maybe give environment a good name)
Thank you!
Hello, I’m trying to bunch process a list of HDRIs into new Rhino Environments and save them to a new folder. My goal is to:
- Create a new blank environment in Rhino,
- Set an HDRI from the folder as High Dynamic Range Texture in the environment,
- Set the saturation to 0,
- Save that new Rhino environment with embedded textures in a new/different folder (File name = HDRI file name).
As I do not want to do every step for every file individually I tried Python scripting with chat.gpt, but did not come up with a working script. I ran the script(s) in Tools → Python Script → Edit. What is not working?
The script is as follows:
>
> import rhinoscriptsyntax as rs
> import os
>
> # Path to the folder containing the HDRI images
> hdri_folder = r"C:\Users\xxxxxxxxx\HDRI-Images"
>
> # Folder to save the Rhino environment files
> output_folder = r"C:\Users\xxxxxxxxx\HDRI Processed"
>
> # Get a list of all HDR files in the folder
> hdri_files = [file for file in os.listdir(hdri_folder) if file.lower().endswith(".hdr") or file.lower().endswith(".exr")]
>
> # Process each HDR file
> for hdri_file in hdri_files:
> try:
> full_hdri_path = os.path.join(hdri_folder, hdri_file)
>
> # Create a new environment in Rhino
> environment_name = os.path.splitext(hdri_file)[0] # Use HDRI file name as environment name
> rs.Command("_-Environment _New {}".format(environment_name))
>
> # Verify the new environment was created
> if rs.LastCommandResult() != 0:
> print("An error occurred while creating the environment: {}".format(environment_name))
> continue
>
> # Set the HDR image as the environment background
> rs.Command("_-EnvironmentTexture _File {}".format(full_hdri_path))
>
> # Verify the texture was set
> if rs.LastCommandResult() != 0:
> print("An error occurred while setting the texture: {}".format(full_hdri_path))
> rs.Command("_-Environment _Close")
> continue
>
> # Set the saturation to 0
> rs.Command("_-EnvironmentTexture _Saturation 0")
>
> # Verify the saturation was set
> if rs.LastCommandResult() != 0:
> print("An error occurred while setting the saturation.")
> rs.Command("_-Environment _Close")
> continue
>
> # Save the environment file
> output_path = os.path.join(output_folder, "{}.renv".format(environment_name))
> rs.Command("_-Environment _SaveAs {}".format(output_path))
>
> # Verify the environment was saved
> if rs.LastCommandResult() != 0:
> print("An error occurred while saving the environment: {}".format(output_path))
>
> # Close the environment dialog
> rs.Command("_-Environment _Close")
>
> except Exception as e:
> print("An error occurred while processing {}: {}".format(hdri_file, e))
>
> print("Task completed. Rhino environments created and saved.")
Thanks very much!
You may want to check my tutorial on creating an HDRi environment with Python: https://jesterking.github.io/rhipy/create_hdri_environment.html