Glassware

To create the material for all of my glassware, i went a bit crazy with the shader, but it was really rewarding when i got it to work. What it does is, uses reflection and refraction to sell the glass material, which is very tweakable.Then using vertex painting you can choose whther the glass is empty or is filled with drink. Then you have a choice of red wine or champagne. So each glass can have 3 states, empty, red wine or champers, and the same material could be applied to several differnt glass assets by making the shader a parent material. The difference in the material instances is a very small normal map, very small, with a mask in the blue channel, which dictates the position of the liquid. 
The initial part of the shader, the reflection and refraction, is from a tutorial
You create two small cubemaps, and with the second one, change the coordinates of each face of the cube so that the whole thing is inverted

The meshes themselves were cyllindraclly unwrapped, which is very important for the normal map to do its magic. For the normal, I made some bevels in and out with ndo, and moved them about and blurred them to get the right shape for whichever glass asset it was going on. In this case, whe wine glass, there are soft curves to define the top and bottom of the glass, to kill any hard edges, and an indent at the top of the neck of the glass. In the blue channel, the mask is applied, where white dictates where the liquid will be. Because thsi tiles horizontally, i could afford to make this texture 128x2 pixels, which is ridiculously small filewise. This then wraps around the glass.
The normal map works as usual, powered up a bit, and inserted as a param2d texture sample to allow for material instances. The first question that the shader asks is whether anything is in the glass. By vertex painting the blend weights of the alpha channel in the first vertex colour, you can decide this. If it is full, it goes to the next stage..
The area named mask control takes the normal map mask into account. I never really understood why i had to invert the mask with a one minus but it worked so i didn't change it. The default full glass was wine, so by painting any full glass in the scene with the red channel in vertex painting, i could turn wine into champagne. Much thanks to Kris for helping me get the wine right, still don't know why it has to be green when the champagne works okay as it is.


To make champagne flutes, i just rescaled my wine glass x and y. Also to make my plates and cutlery pop a bit more, they're elevated to cast a little shadow on the table below

No comments:

Post a Comment