How can I reproduce material inside a clam/pearl shell?

This used to be done with specular color, but since it’s now physically based rendering, how can I make a material that is a pearl white color, but reflects the green/purple/blue/pink colors of the inside of a pearl shell one that also has color shifts as the player moves (like a real shell)?

Thanks

The particular phenomena which you’re referring to is called “iridescence.” This is pretty easy to fake by changing the specular color based on view angle. After you get that working, it’s a matter of getting the ridges to look correct.

As for picking colors based on view angle, you might try taking the dot product of the opposite of the surface normal and the camera angle. That should give you a number between 0 and 1 (if it’s less than 0 then the fragments obviously wouldn’t be on screen.) Use that value to rapidly shift through a color spectrum (either create your own 1-pixel tall color wheel, or use an HSV-to-RGB color converter in your material.)

Here’s a quick dirty setup I threw together to see how this’d work. Assuming you had a proper mesh, and correct normal map matching the striations in the shell, this ought to work fine: