This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SDK = xcrun -sdk macosx | |
all: compute.metallib compute | |
compute.metallib: Compute.metal | |
# Metal intermediate representation (.air) | |
$(SDK) metal -c -Wall -Wextra -std=osx-metal2.0 -o /tmp/Compute.air $^ | |
# Metal library (.metallib) | |
$(SDK) metallib -o $@ /tmp/Compute.air |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import colour | |
import numpy as np | |
import matplotlib | |
import matplotlib.pyplot as plt | |
color = np.array((1.00, 0.95, 0.90)) | |
_WGM_EPSILON = 0.0001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#this outputs 4 horizontal gradients in this order: | |
#spectral weighted geometric mean | |
#spectral arithmetic mean (normal) | |
#RGB weighted geometric mean | |
#RGB normal | |
#The illuminant is not weighted properly so these are incredibly bright | |
#also Meng does not constrain to <=1.0 so many RGB values will violate energy conservation | |
#Curiously the results are better without adapting samples to E before Meng recovery, and using D65 illuminant | |
#I think Meng would be better if we could intentionally bake the illuminant into the reflectance; choose D65, etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Draw cairo in a pyglet window - without an intermediate image file. | |
import ctypes | |
#import cairocffi as cairo # example will work with cairocffi instead too | |
import cairo | |
import time | |
from pyglet import app, clock, font, gl, image, window | |
WIDTH, HEIGHT = 400, 400 |