At first, the opacity of the material needs to be determined to calculate the refractions and internal reflections. After all that happens however, the opacity needs to be set back to 1. This way when the renderer gathers all the Ci's and Oi's from the materials the glass won't look oddly transparent after being refractive (left sphere) rather than simply being refractive as glass is meant to look (right sphere).
The ball on the left has a "surface()" function for the primary diffuse calculations while the right ball has the "diffuselighting()" function.
I initially used "surface()" instead of "diffuselighting()" so that when the shader compiled it would compile as a surface shader and not a co-shader or displacement shader. If it did not compile as a surface shader Houdini would not read the color information properly and do either just the displacement or nothing at all. Rather annoying.
I continued using the "surface()" function in testing because I did not have to have the lights extraordinarily bright. Once I got into more complicated shaders, I had to start using the "diffuselighting()" function so that the renderer would recognize the specularlighting() function.
The basic displacement function is:
public void displacement(output point P; output normal N)
//initialize m_shadingCtx variable just in case it had been used before
//assign m_hump variable based on wavelet noise
exampleVariable = something_To_Make_It_Change_Like_A_Map
//displace based on m_hump
Which creates the sphere on the right. If the last "m_shadingCtx->init();" is omitted, the shader turns into a toon shader like the one on the left! Hooray for experimentation!