Shader Recipes: Diffraction Grating in Maya

In this Maya tutorial we will learn how to simulate the light-scattering appearance of a diffraction grating, which can be seen when looking at the surface of a CD or a DVD. Software required: Maya.
Course info
Level
Intermediate
Updated
Jun 1, 2010
Duration
29m
Table of contents
Description
Course info
Level
Intermediate
Updated
Jun 1, 2010
Duration
29m
Description

In this Maya tutorial we will learn how to simulate the light-scattering appearance of a diffraction grating, which can be seen when looking at the surface of a CD or a DVD. While Maya may not have the capability to simulate a true diffraction grating, we can create a shading network that can very closely mimic the effect. We will learn how to use ramps, layered shaders, anisotropic materials, texture placement nodes, and specular lights to create a realistic rendered CD. Software required: Maya.

About the author
About the author

Kyle was one of the first authors for Digital-Tutors (now a Pluralsight company) and has been a part of the team for over 10 years. Kyle began his career in computer graphics education as a college instructor and worked as a Digital-Tutors rendering tutor and curriculum manager since 2002.

More from the author
Maya 2018 Fundamentals
Beginner
11h 21m
Feb 7, 2018
3ds Max 2018 Fundamentals
Beginner
8h 48m
Sep 27, 2017
Introduction to 3ds Max 2015
Beginner
12h 35m
Jun 4, 2014
More courses by Kyle Green
Section Introduction Transcripts
Section Introduction Transcripts

Introduction and Project Overview
[Autogenerated] in the series of lessons will learn how to create a shading network within Maya that can simulate the prism effects that we would get whatever looking at something like a CD or a DVD. All right, so these prism and rainbow effect that we would get on a disc like this is actually kind of an interesting phenomenon. The rainbow effect that we get are actually caused by the tiny little microscopic grooves and imperfections that are found on the surface of a CD. Now what happens is that normal white light is reflected off the surface in these tiny little grooves actually cause disturbances and irregularities in the different wavelengths that are in that white light. And basically the light is reflected and scattered were defused into its individual wave wings. Right now, in the world of optics, we call this a diffraction grating. Now, unfortunately, within Maya, we don't have the ability to simulate a true diffraction grating surface. So we'll have to use some shading network tips and tricks to get sort of the simulation of this effect. But what we'll see is that the simulation we can get is actually really, really nice and very close to realistic. All right, so bank in mind, this is the scene that we're gonna start with and you can see this is really just a simple shape that's been created by just a series of lofted nerves. Curves. So this is just a simple nervous surface. No. When ever trying to create some kind of an effect like this some kind of a diffraction grating. There obviously are lots and lots of different ways that we could go about this. But the method that I'm gonna share with you is really just the method that I've always found works pretty well and should get you some pretty decent results without just a whole lot of effort. Right? So the first thing that we have to do is decide which type of a shader or which type of material we want to use for the surface. Now, in my case, I've found that an anise, a tropic shader, is actually a pretty good one to start with, because by default it actually does allow for some of these highlights that are kind of created by an Anisette tropic surface. In other words, some kind of a surface that has irregularities and is not perfectly round and smooth like something like a blender or a phone would be. It's already got some of those highlights and things like that built into it. So this is a good surface were material to start with. So let's take this and just a Sinus to our object. We'll start by just taking a really quick render at what we have, all right. And you can see, in my case, I've already got some decent answer tropic highlights that we can get just by simply dropping this material on here now, depending on your particular scenes. If you're trying to recreate this from scratch, you may actually get a slightly different pattern, depending on the actual re intonation of your nerves surface. So, in my case, if we were to go in and turn on the display options, go down in herbs and turn on surface origins we can do is actually look at the U and V directions of the surface. Now, in my case, you can see that the V direction is actually this green line that sort of coming out where don't we have the you direction that is reading this way. Uh, depending on the orientation of your nerves surface, you may actually wind up with a surface that has the you direction or the red line running in this direction in the V direction. Running this way either way is really just fine. It will just require a little bit of adjustment in the shooter itself. But if you do have a surface that you want to be oriented like this and maybe it's upward into the opposite way, you could just go up to edit nerves and reverse service direction, go to the options and told us to swamp the U. N V directions. And what you'll see is, once I apply this, it'll swap those around, right. So in my case, I think just leaving this as it is, should work just fine. It's We can just turn the surface origins back off once I'm done with that now, Like I said, we have the actual highlights that are built into this and you can see to start with they actually look pretty decent, but they really don't have that rainbow prismatic effect that we would really expect to see. So let's come in and start to build that don't like I said. We unfortunately can't do any kind of real diffraction grating results. So we'll have to use some kind of fakery and little bit of trickery to get this looking right. So let's come in and use something like a ramp. You can see it's already got some nice rainbow type colors built into it. Now what we could do is just take this ramp and actually clinic this into thes speculate color of our Anisotropy shader Delicious middle click. Drop this in here and we'll see what that does for us and you can see really without a lot of effort that we do now start to get sort of this rainbow prismatic effect. Now this really isn't quite what we would expect with any kind of a riel diffraction grating surface, especially if the greetings or the diffraction greetings were reading sort of along this direction. It should actually be scattering this instead of where we see the different wavelengths in a band going along the length, we should actually see the different wavelengths, actually worried it the opposite way. So we should see green, like in the middle here, and then we should see the blue and the red on either side of it. They should be radiating out from this direction. So again, this is something that would be a little bit different, depending on the U. N V orientation of your nerves service. If it's warranted like mine, well, you'll have to do is actually go into the ramp itself. Take a look inside the police duty texture node, and we could just come in and rotate the frame. Something like 90 degrees. Here we are, and you can see now that gives us a little bit different result where, instead of, uh, they're being the different bands that run along this length this way, it's actually sort of one continuous greedy in't that runs all the way around. So we're seeing a little bit of green here, uh, probably spilling off into a little bit of blew up in this direction and starting and come down into the red by the time he reaches opposite side. All right, so we're starting to get close, but overall, there's still quite a bit of work that needs to be done on this. So what will start to do what our next lesson is begin coming in and making adjustments to this ramp in order to start to give us some better diffraction grating results.