Light Refraction, Glass, and Marbles

I am building a project that needs marbles, the kind children play with. Colorful round pretty marbles that are not rendering the way i want them to. The marbles aren’t important. It’s the glass that concerns me. If you look at the glass shader in blender it has an IOR (Index of Refraction) value that essentially determines how distorted things are when you look at them through the glass. Anyone who knows blender well should know what I’m talking about. I would like to reproduce this effect using the shaders in unity, the problem is I’m not sure how to go about it. I poked around the internet and there are things about writing your own shaders and there is shader code that i don’t quite understand. From what i do understand this is something you need unity pro for? To be honest i don’t really understand.

What would be absolutely wonderful is if somebody could point me in the right direction here. Do i need to write my own shader because I’m willing to learn how, assuming there’s something i can learn from. Is light refraction something i can do with the shaders I have in the free version of unity or do I need unity pro? If so is there a way around this? All I want is glass the refracts light. I’m open to suggestions. any help is appreciated

  • No, you don’t need Unity Pro (since Unity 5.x, there are no differences between the engine features in Pro and Personal).
  • Yes you need a shader that accounts for refraction.
  • Fortunately, Unity comes with one. Assets → Import Package → Effects → Glass Refraction and try the material there.

Is this something more along the lines of what you’re looking for?

https://en.wikibooks.org/wiki/Cg_Programming/Unity/Curved_Glass

That shader should be able to be used as-is, so you should be able to create a material and apply that shader. Then, ideally, it should do what you’re hoping for.