{"id":831,"date":"2015-01-19T00:41:33","date_gmt":"2015-01-19T00:41:33","guid":{"rendered":"http:\/\/www.migenius.com\/?p=831"},"modified":"2020-11-02T21:31:30","modified_gmt":"2020-11-02T21:31:30","slug":"procedurally-retro-with-mdl","status":"publish","type":"post","link":"https:\/\/www.migenius.com\/articles\/procedurally-retro-with-mdl","title":{"rendered":"Procedurally Retro with MDL"},"content":{"rendered":"
NVIDIA Iray 2015<\/a>\u00a0will introduce some great new features, including the ability to write your own procedural functions for use in materials. This is fantastic for creating resolution independent effects which can cover large areas without noticeable tiling artifacts (unless you want them of course).\u00a0Iray is built into our RealityServer<\/a> product so I\u00a0love to test out its latest features. To put procedural functions through their paces I decided to try to emulate something procedural from my childhood, the now famous 10 PRINT<\/a> program. This little one liner, originally designed to demonstrate the capabilities of the Commodore 64<\/a> prints a maze by randomly alternating between two diagonal characters. Iray uses the NVIDIA Material Definition Language<\/a> (MDL) both to define materials as well as custom functions, if you haven’t tried it out this little tutorial is a great way to get started.<\/p>\n 10 PRINT appears extremely simple on the surface but hides considerable complexity. In fact an entire book<\/a> has been written exploring this single line of code from every angle. I highly recommend picking up a print copy<\/a> and supporting the authors who have intricately documented this little piece of computing history. Here is the program<\/em> in its full glory:<\/p>\n When you run this program it will character by character fill your screen and very soon a maze like pattern will emerge. If you are not lucky enough to have a C64 laying around there are some great emulators<\/a>.\u00a0What a perfect candidate for testing procedural pattern generation in Iray!<\/p>\n<\/div><\/div>\n\r\n10 PRINT CHR$(205.5+RND(1)); : GOTO 10\r\n<\/pre>\n