Required Changes To Plug-In Renderers

3DS Max Plug-In SDK

Required Changes To Renderer Plug-In

See Also: What's New in the MAX 3.0 SDK, Required Changes to MAX 2.0 Plug-Ins for MAX 3.0.

Render Change to Allow View-Oriented Lights

The 3ds max renderer has been modified so that if a DefaultLight is passed into Renderer::Open with a transformation matrix that is all zeros, the renderer will interpret this to mean that on each frame it should create a light located at the view point, pointing in the view direction. This allows the implementation of the new viewport 1-light option so that it tracks the camera during an animated camera move. See Class Renderer.

Class, Parameter and Data Member Changes Affecting Renderers

The ShadowBuffer and ShadowQuadTree classes have been removed. Shadows are a new plug-in type in release 3.0. See Class ShadowType.

The following parameters were moved from Class RendParams to Class FrameRendParams, so they can be varied frame to frame.

int regxmin,regxmax;

int regymin,regymax;

Added these data members to Class FrameRendParams:

Point2 blowupCenter;

Point2 blowupFactor;

Thus you can now control the horizontal and vertical blowup factors independently.

Added the following method to RenderInstace.

CastsShadowsFrom(ObjLightDesc &lt)

Added several new data members to RenderGlobalContext.

BOOL force2Side;

float wire_thick;

Color globalLightLevel;

Added a new data member to the ObjLightDesc class.

int renderNumber;

Added a parameter to the ObjLightDesc::Update() method:

RenderGlobalContext *rgc

Two methods from RenderInstance have been removed:

 virtual int NumShadLights()=0;

 virtual LightDesc *ShadLight(int n)=0;

These methods from RendContext have been removed.

 virtual ShadowBuffer* NewShadowBuffer() const=0;

 virtual ShadowQuadTree* NewShadowQuadTree() const=0;

Default Light Changes

The default lights passed to the renderer no longer have the global light level included. This must be multiplied in in the implementation of the ::Update() method of the default light in the renderer (using the RendContext::GlobalLightLevel() method passed in).

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.