Required Changes To Plug-In Materials
See Also: What's New in the MAX 3.0 SDK, Required Changes to MAX 2.0 Plug-Ins for MAX 3.0.
Change to BuildMaps
The method MtlBase::BuildMaps() has had its return value behaviour altered. If this method now returns zero the render is cancelled (previously rendering would continue).
Maximum Pixel Size
The maximum pixel size preference has been removed from the UI and thus the following methods were removed from the Interface class.
virtual float GetRendMaxPixelSize()=0;
virtual void SetRendMaxPixelSize(float s)=0;
There are new methods in Class RenderGlobalContext to retrieve the filter and the filter size. These are GetAAFilterKernel() and GetAAFilterSize().
New Return Value from MapSlotType
There is a new value to be returned by the method MtlBase::MapSlotType() to identify slots that hold displacement maps. This is MAPSLOT_DISPLACEMENT. Developers should modify their MapSlotType() method to return this new value for the displacement channel.
API Modifications to Handle 3D Bump Maps
The following changes are needed to correct a problem with 3D bump maps when objects in the scene are scaled. This scaling results in a very noticeable inappropriate change in the bumping effect.
The problem is occurring when the bump perturbation vectors must be transformed from object space to camera space, so they are oriented correctly as the object rotates. If the object has been scaled, this transformation causes the perturbation vectors to be scale also, which amplifies the bump effect. What is needed is a way to rotate the perturbation vectors so they are correctly oriented in space, without scaling them. To do a new method has been added to Class ShadeContext.
ShadeContext::VectorFromNoScale(const Point3& p, RefFrame ifrom);
There is also a complimentary new method VectorToNoScale() added for completeness.
ShadeContext::VectorToNoScale(const Point3& p, RefFrame ito);
The coding ramifications of this are as follows:
- Any plug-in that creates a shade context in which materials are evaluated needs to implement these two new functions (VectorFromNoScale() and VectorToNoScale()). This applies to plug-in renderers and materials.
- A change is required related to loading old files by plug-in materials which support bump maps. This change is required since if nothing is done to modify old files, bump maps on scaled objects will not render as they did previously (the bump amount for scaled-up objects will become much less). When loading old files, the Standard material uses a post-load callback that looks to see if the node that references the material is scaled up, and if so, multiplies the bump amount by a similar factor. Note that if the material is used by more than one node, there’s nothing that can be done to make them all render the same if they have different scales. The same is true if a node is scaled non-uniformly. A postload callback similar to the one the Standard material uses will have to be used by plug-in materials which support the use of bump maps.