Shades for LW7.5 (and LW8)

(Beta version)

Please be aware that this is a beta version of these shaders. If you find any bugs that are not listed below, please send me e-mail (marvinl AT email.arizona.edu) describing the problem. Currently, the bugs that I am aware of are beyond my control (variant parameter, texture editor and interface issues), however they are not severe enough to prevent the plugin from working.

The shaders in this version of Shades have been re-written to eliminate the need for the LW5 legacy plugins (currently only some of the shaders have been converted and are included in this beta release). This version introduces a non-modal panel/xpanel interface, which provides immediate feedback from the Surface Editor's sphere/cube preview and VIPER when modifying the shader parameters. In addition, the requesters now use variant parameters, which is the standard LW7 method of providing envelope and texture buttons for floating point requesters. Envelopes are now specified using the Graph Editor, which also allows control of the shader parameters using expressions. And rather than just supporting gradients, this version supports image, gradient, and procedural texture layers to control parameters through the use of Lightwave's Texture Editor. All of the shader parameters have both E and T buttons, even if it seems a little crazy to have those buttons on a particular parameter (for example, who would ever need envelope and texture support for a wood plank's Width parameter?) But who am I to deny all of you the fun and excitement of experimenting with those options. It was definitely more work doing the conversion from legacy plugin support for envelopes and gradients to variant parameters and xpanel controls than I had originally thought it would be, but I hope the support for the new features and immediate preview feedback make it worth the effort.


Miscellaneous comments about the new version

There is no real documentation for these shaders, and I don't know if there ever will be. Because of the interactive preview capabilities available in Lightwave, experimentation with the parameters is now a fairly good way of learning what they do. But here are a few comments about some of the new features in these shaders, and some of the decisions that were made during the conversion from the older version of the plugin.

I know it's not great design philosophy, but the shader interfaces are fairly large. But I actually prefer having a large single panel rather than having tabs or multiple panels. I like having one panel with all the parameters readily available for changing when I am adjusting the shader's values. I figured having separate panels for envelopes and textures was enough.

The Presets and Settings buttons at the bottom of each interface are essentially redundant, as both sets of buttons just provide 2 different ways to save and load the same shader parameters. I like the preset window sometimes, but at other times I just want to save and load settings without having VIPER or the preset window open.

When you click on a parameter's T button and create a gradient layer, all of Newtek's standard gradient input parameters are supported. But I also added 2 new input parameters based on the slope of the surface. Newtek's original "Slope" input parameter uses the tangent to the surface to determine the gradient's output value. It's input range is from 0 to 1 and negative slopes always use the value specified by the End value in the gradient. In the picture below, notice the entire bottom half of the sphere is colored red.

The new "Surface Tangent Slope" is almost the same as the original "Slope" parameter, except it supports negative slopes by mirroring the positive slope values (it calculates its output using the absolute value of the slope of the surface tangent). Its input range is also 0 to 1, but as you can see in the image below, the bottom half of the sphere is a mirror image of the top half.

And finally, "Surface Normal Slope" uses the slope of the surface normal vector rather than the surface's tangent. It also supports negative slopes, but using the normal's slope gives a continuous gradient for an input range of -1 to 1. In the image below, although it can't be seen, the purple color is at the bottom of the sphere and the color gradient is continous from bottom to top.

Support has been added for Cubic and UV mapping in the 2D shaders. The 2D mapping types also support Front Projection mapping (although it is different from Newtek's implementation, this one is really a perspective front projection).

If a Reference Object is chosen from the appropriate pull-down menu, the Center, Scale and Rotation parameters are ignored. Since the interface is a panel with multiple xpanel controls, it wasn't possible to ghost those parameters based on the value in the Reference Object xpanel control.

I've removed the Falloff requester completely, because the same results (and more) can be achieved by using gradients in the T button of the Opacity parameter.


Bugs and limitations

There are still a few bugs associated with vparms and the interface. But as far as I can tell, these are bugs that Newtek will have to fix in the SDK. They aren't severe enough to prevent the plugin from working, so I made the decision to release this beta version despite the problems. You should definitely read carefully about the first 2 bugs listed, as they are the ones that you will most likely encounter while you are using these shaders.

The major interface problem that exists is when the user presses the E button of a shader parameter. When an E button is pressed, the variant parameter's label is ghosted, which causes adjoining parameters to its left to be partially erased from the interface (this is most evident if you press on the E button of the Size, and Rotation fields). I have code in the plugins to redraw the controls when a New Envelope event occurs, but no such event is ever generated. And even if the event was generated, the E and T buttons get redrawn, but the numeric portion of the variant parameter is not redrawn. But it's not a huge problem, because if the user moves the mouse over the erased portion of the variant parameters, they are redrawn automatically.

This one is also a major problem when you are trying to preview newly loaded settings or presets. If a shader's variant parameter is assigned a texture during a surface "Paste" or loading a setting or preset, previews are not updated correctly. The T button becomes shaded as it should, but the previews will not reflect that a texture is actually assigned to that parameter. You must open the Texture Editor and play with at least one of its settings to make it update (I usually just tweak the texture's "Layer Opacity" parameter or click the "Invert Layer" button twice). Another option is to do a render of the scene or object (F9 or F11), which will update all the texture settings and subsequent previews will be drawn correctly.

In the Evaluate() function of a shader, the SDK's bumpHeight value is always 0 when doing a cube/sphere preview or a VIPER render. Because of this, using a gradient input parameter of "Bump" does not show up at all in the previews, but will render correctly.

The shader's variant parameter textures do not support cubic mapping of an image (even though that option appears in the "Projection" pull-down menu).

Using Linear or Area lights within the "Light Incidence" gradient input causes the shader's preview to render out wrong, but the scene renders fine.

If you move a light in the scene and the "Light Incidence" gradient is using it, the shader's preview won't update until you go into the Texture Editor for the gradient.


Downloading the plugins and some presets

Instead of releasing all the plugins in a single .p file, I have separated them into 2 files. One file contains all the 2D shaders (currently Bricks, Fire, Hextile, Planks, and Parquet) and the other contains the 3D shaders (currently Coriolis, Cyclone, Dented, PuffyClouds, and Strata).

Windows 2D shaders - shades2d_intel.zip

Windows 3D shaders - shades3d_intel.zip

Windows 2D and 3D shaders for LW8 - newshades8_intel.zip

Presets - shades_presets.zip
The shades_presets.zip file should be unzipped into your Lightwave's Programs/Presets/ShaderHandler directory.

Settings - shades_settings.zip
These settings contain the exact same parameter values found in the Presets file above, so if you prefer to only use presets there is no need to download this file. It should not matter where you unzip this Settings directory (mine is located in the Lightwave directory).