def FakeRectAO(gc, clr, strength, dist, grad, su = U, sv = V): # gc - True if you want a Gamma Correcting version # clr - the color of the surface # strength - the maximum darkening at the edge # dist - the distance (in UV coordinates) where the darkening stops # grad - darkening gradient applied bottom of v coordinate # su - scaled U coordinate # sv - scaled V coordinate # If your object is significantly non-square adjust su and sv. # For example if your rectangle is 2x wide, pass su = 2 * U. # Ceilings and floors should not use grad. u = 1 - Clamp(1.0/dist * Min(su, 1-su)) v = 1 - Clamp(1.0/dist * Min(sv, 1-sv)) d = Blend(u, 1, v) s = 1 - strength ed = Blend(1, s, Bias(d, .2)) gd = Blend((WHITE-grad) * ed, ed, V) dv = gd if not gc: return Surface(clr, dv, 1, 0) gamma = Add(2.2).labelled("Gamma") clr = clr ** gamma diff = Diffuse(clr, dv) output = (diff) ** (1/gamma) return Surface(0, 0, 0, 0, Alternate_Diffuse = output) WallClr = IColor(230, 210, 190) CeilingClr = WHITE outputs += [ "Wall", FakeRectAO(False, WallClr, .1, .15, .4), "Ceiling", FakeRectAO(False, CeilingClr, .07, .2, 0), "WallGC", FakeRectAO(True, WallClr, .2, .15, .4), "CeilingGC", FakeRectAO(True, CeilingClr, .14, .2, 0), ]