-- Materials under the linear pipeline: two rows of spheres, roughness 0 to 1 left to right, the -- front row dielectric and the back row metal, on a plain under a sun and a bulb, in front of a -- brick wall carrying a normal map (bricks in relief), an emissive map (glowing mortar) and a -- metallic-roughness map (rough bricks, mirror mortar). Each camera stop changes the exposure and -- the tone curve so the sheet shows what sceneSetExposure and sceneSetTonemap do to the same light. local font = fontLoad("Singe/FreeSansBold.ttf", 28) local frames = 0 local labels = { "neutral, 0 EV", "ACES, 0 EV", "no curve, 0 EV", "neutral, +1.5 EV" } fontSelect(font) sceneEnable(true) sceneSetBackground(70, 90, 120, 255) sceneSetAmbient(40, 44, 52) sceneSetShadowSize(2048) local ground = materialNew() materialSetColor(ground, 120, 120, 115) materialSetRoughness(ground, 0.9) local plain = nodeNew() nodeSetMesh(plain, meshPlane(30, 30), ground) local red = materialNew() materialSetColor(red, 180, 40, 30) local gold = materialNew() materialSetColor(gold, 255, 200, 90) materialSetMetallic(gold, 1) local steps = 6 for i = 0, steps - 1 do local roughness = i / (steps - 1) local x = (i - (steps - 1) / 2) * 1.6 local front = materialNew() materialSetColor(front, 180, 40, 30) materialSetRoughness(front, roughness) local back = materialNew() materialSetColor(back, 255, 200, 90) materialSetMetallic(back, 1) materialSetRoughness(back, roughness) local a = nodeNew() nodeSetMesh(a, meshSphere(0.6, 32), front) nodeSetPosition(a, x, 0.6, 1) local b = nodeNew() nodeSetMesh(b, meshSphere(0.6, 32), back) nodeSetPosition(b, x, 0.6, -1) end -- The wall: a plane stood up behind the spheres, its maps from generated brick images. local brick = materialNew() materialSetTexture(brick, spriteLoad("testScripts/brick.png")) materialSetNormalMap(brick, spriteLoad("testScripts/brickNormal.png"), 1.5) materialSetEmissiveMap(brick, spriteLoad("testScripts/brickEmissive.png")) materialSetEmissive(brick, 180, 100, 40) materialSetMetallicRoughnessMap(brick, spriteLoad("testScripts/brickMetalRough.png")) materialSetMetallic(brick, 1) materialSetRoughness(brick, 1) local wall = nodeNew() nodeSetMesh(wall, meshPlane(12, 4), brick) nodeSetPosition(wall, 0, 2, -3) nodeSetRotation(wall, 90, 0, 0) -- A glowing bar so something reaches above white for the curves to compress. local glow = materialNew() materialSetColor(glow, 255, 255, 255) materialSetEmissive(glow, 255, 255, 255) materialSetUnlit(glow, true) local bar = nodeNew() nodeSetMesh(bar, meshBox(9, 0.2, 0.2), glow) nodeSetPosition(bar, 0, 1.8, -2.4) local sun = lightNew(LIGHT_DIRECTIONAL) nodeSetPosition(sun, 6, 10, 4) nodeLookAt(sun, 0, 0, 0) lightSetIntensity(sun, 3) lightSetColor(sun, 255, 240, 220) lightSetShadow(sun, true) local bulb = lightNew(LIGHT_POINT) nodeSetPosition(bulb, -3, 2.5, 3) lightSetColor(bulb, 255, 180, 120) lightSetIntensity(bulb, 8) lightSetRange(bulb, 12) local camera = nodeNew() cameraSet(camera) cameraSetPerspective(45, 0.1, 100) nodeSetPosition(camera, 0, 3.0, 7) nodeLookAt(camera, 0, 1.0, 0) function onOverlayUpdate() local stop = math.min(4, math.floor(frames / 45) + 1) frames = frames + 1 if stop == 1 then sceneSetTonemap(TONEMAP_NEUTRAL) sceneSetExposure(0) elseif stop == 2 then sceneSetTonemap(TONEMAP_ACES) sceneSetExposure(0) elseif stop == 3 then sceneSetTonemap(TONEMAP_NONE) sceneSetExposure(0) else sceneSetTonemap(TONEMAP_NEUTRAL) sceneSetExposure(1.5) end overlayClear() fontPrint(20, 20, "Materials, " .. labels[stop] .. ", frame " .. frames) if frames == 40 or frames == 85 or frames == 130 or frames == 175 then singeScreenshot() end if frames == 180 then singeQuit() end end