Skip to content

Commit

Permalink
Initial upload
Browse files Browse the repository at this point in the history
  • Loading branch information
unaigonzalezz authored Feb 21, 2023
1 parent 15c070c commit df80e6c
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions IMG2PBR.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
from PIL import Image;
from colorama import Fore, Back, Style

# RED Channel = AOA
# Green Channgel = Rougness
# Blue Channel = Metallic

print(Fore.CYAN+ '''
___ __ __ _______ _______ _______ _______ ______
| | | |_| || || || || _ || _ |
| | | || ___||____ || _ || |_| || | ||
| | | || | __ ____| || |_| || || |_||_
| | | || || || ______|| ___|| _ | | __ |
| | | ||_|| || |_| || |_____ | | | |_| || | | |
|___| |_| |_||_______||_______||___| |_______||___| |_|
''' + Fore.RESET)

heart = (Fore.RED + "<3" + Fore.RESET)
print("Create PBR images for Microsoft Flight Simulator by merging AOA,Roughness and Metallic into a single image! ;) \n")
print("Made with " + heart + " by Unai González (@unaiitxuu) \n")
images = input('''Insert the images in this order separated by a space:
Example: "Concrete01_AO.png Concrete01_RG.png Concrete01_MT.png"
''' + Fore.RED + '''1. Red Channel = AOA \n'''
+ Fore.GREEN + '''2. Green Channgel = Rougness\n''' +
Fore.BLUE + '''3. Blue Channel = Metallic : ''' + Fore.RESET)

print("")

images_splitted = images.split()

red_image = images_splitted[0]
green_image = images_splitted[1]
blue_image = images_splitted[2]

def IMG2PBR(red_image1, green_image1, blue_image1):
red_channel = Image.open(red_image1);
filename = red_channel.filename;
red_channel = Image.open(red_image1).convert('L');
green_channel = Image.open(green_image1).convert('L');
blue_channel = Image.open(blue_image1).convert('L');
rgb = Image.merge("RGB",(red_channel,green_channel,blue_channel));
rgb.save(filename[:-4] + "_PBR.png")
print("Done! Your PBR image is saved as: " + filename[:-4] + "_PBR.png");

IMG2PBR(red_image,green_image,blue_image)





0 comments on commit df80e6c

Please sign in to comment.