shader animation with Maya and osl
Objective: to develop an animated scene with the use of OSL custom shaders and PxrSeExpr nodes almost entirely within the Maya Hypershade editor.
|
/OSL
|
"encounter on titan "
Orbiting Saturn, Titan is the solar system's second largest moon. Larger than Mercury, and almost the same size as Mars, Titan is the only moon with both a dense atmosphere and large bodies of liquids on its surface. With rain, rivers, lakes and vast quantities of organics, it is very much like Earth. However, with an average temperature of -290 F, its seas are made of liquid methane rather than water. Titan is believed to have a vast liquid water ocean below its crust, which may be suitable for life. Further, scientists have recently discovered methane-based chemical structures that mimic cellular membranes.
This scene simulates an alien encounter with an exploratory drone.
This scene simulates an alien encounter with an exploratory drone.
Single Frame Render: Titan environment with possible unknown life forms below the surface of a liquid methane lake.
Rendered Animation
inspiration
My research produced a wide range of artistic impressions of the surface of Titan, from highly diffused and very hazy, to more beautiful looking environments. The reality seems to be that it is much darker than depicted in images below and a lot more diffuse. The few pictures from the 2006 lander support this.
Artistic impressions based on science
Actual images of the surface are less dramatic, with very little color variation. I chose to balance the reality with some artistic liberties.
Scene set up and breakdown
Terrain Generation: Experimentation with a sine wave OSL script combined with a PxrFractal pattern yielded some interesting early results.
Hypershade Network
Houdini Ocean Modifier: Initially I was going to attempt to generate an ocean surface with OSL noise displacement animation, and did find some resources on how to achieve this in 2D such as: https://www.funprogramming.org/38-Animate-the-ocean-surface-using-noise.html. In the end, due to the time constraints I elected to use the Houdini Ocean Modifier for Maya, which worked well for what I wanted to achieve. I also discovered that liquid methane has an index of refraction of 1.27 as opposed to water which is 1.33, so I adjusted the parameters on the shader to reflect that.
alien entity effects
Producing this effect was the most challenging aspect of the project. I wanted to create alien "light entities" that appeared as if through a dimensional portal. I elected to combine two OSL scripts: dist2float to establish a distance from a custom coordinate system, and a Result mask to output areas of glass material based on rules defined in the OSL script. The first entity was fairly straight forward, but the addition of subsequent entities required a little more thought. The solution was to create more customer OSL shaders to combine the results before feeding into the Bxdf, which needed to be done for the ResultMask as well as the PxrInvert.
OSL Script: distance2float for Alien #1 combines the original dist2float script, and uses a result mask to output a zero or one to be fed directly into refraction color R,G,B components individually to produce the transparent "glass" with IOR = 1.27. I had to create a second set up for Alien #2. Both scripts are modified by animated PxrFractal nodes to give some movement to the noise. Each alien had to have its own local CoordSys added to it. The size and location of the aliens were scaled and transformed by animating the parameters on each Coordsys node.
shader dist2float2 ( float s = 0 [[ int lockgeom = 0, string widget = "null", ]], float t = 0 [[ int lockgeom = 0, string widget = "null", ]], float radius = 5, float blur = 1, string coordname = "world", output float resultF = 0, output float resultMask = 0,) { point p = transform(coordname, P); float dist = distance( point(0,0,0), p); resultF = 1 - smoothstep(radius - blur, radius, dist); if(dist <= radius) { resultMask = 1; } else { resultMask = 0; }
OSL Script: ResultMaskAdd: Before being fed into refraction RGB they values had to be added since there is only one input for each channel on the Bxdf material to be affected. The exact same method was used to add the PxrInvert results being fed into the diffuse gain. This OSL node is called ResultAdd. I added two additional inputs in case I wanted to add more aliens in the future.
shader ResultMaskAdd( float s = 0 [[ int lockgeom = 0, string widget = "null", ]], float t = 0 [[ int lockgeom = 0, string widget = "null", ]], float input1 = 0, float input2 = 0, float input3 = 0, float input4 = 0, output float resultMask = 0) { resultMask = input1 + input2 + input3 + input4; }
OSL and Hypershade Network
textures
Research regarding the surface uncovered that there is very little "rock" as we normally think of it. Instead, it is made of mostly water ice that has the properties of rock under such extreme cold. The mountains and rigid features are more like hard, dirty ice with a lot of hydrocarbons mixed in. Even in dry areas the sand dunes are made of frozen hydocarbons instead of silicon. I used the following texture because it seemed to match the mixture of ice and other impurities. I created a more complex set up with PxrLayerMixer, hoping to get some translucent areas mixed in using a Fractal shape mask to denote water ice but in the end the border between the masked areas did not look realistic enough so I abandoned that path due to time constraints. The following texture map was used for the ground and ocean floor, using a simple PxrManifold2D for adjustments.
Lighting
In addition to using a basic 3 point lighting rig, I purchased the following high resolution hdr map for use with the PxrDome light. It was difficult to find something that matched the color and haziness of Titan's atmosphere, so I found something that looked other worldly and scaled it to a size that would match the look I wanted while hiding the areas I didn't want shown. I also made a lot of color adjustments. For atmospheric haze I used the PxrVolume node, which can be seen in the initial image at the top. It created some really nice scattering for the alien entity lights and added to the feeling of depth. The rendering time increased substantially for this effect and therefore I elected to turn it off for the animation render, since I was not certain that denoise was working correctly. I included a depth AOV so I could add haze in post instead.
SUMMARY AND CONCLUSIONS
I found this exercise, like the ones before, to be extremely rewarding and challenging. I continue to be amazed at what can be done with mostly scripts and custom shaders. As an FX Artist, most of my previous experience has been setting up and tweaking tools that have been made by other people. These series of exercises have opened my eyes to many more possibilities giving me a much greater understanding of how things really work under the hood, and the motivation to actually create my own systems and tools.
Self Critique:
I feel that without the additional time constraints I would have been able to add much more realism, and dynamics to the shot. In particular I would like to have added some fluid interaction with the ground or at least create an edge where the liquid and ground meet. In the single frame shot I attempted to soften some of the hard CG looking edges but there is much more that could have been done. I would also have liked to export the texture map to photoshop and paint in some beach areas, as well as scatter some rocks and debris along the ground. With regard to the aliens, I had a version where there was more of a story line involved where they are moving around in the environment ( over the land and through the ground too) and interacting with each other. I animated and started rendering such a version but the outcome did not look correct and would have taken more adjustments to sell the effect. In addition, some artifacts appeared when the aliens interacted with the dry land, but only in combination with the PxrVolume. At 15 minutes per frame and 320 frames I decided to keep it simple to prevent any unforeseen show stoppers.