3ds Max C++ API Reference
IPhysicalSunSky::IShaderGenerator Class Referenceabstract

Provides facilities to initialize the shading parameters of the Physical Sun & Sky plugin. More...

#include <IPhysicalSunSky.h>

+ Inheritance diagram for IPhysicalSunSky::IShaderGenerator:

Public Member Functions

virtual ShadingParameters CreateShadingParameters (const float global_intensity, const float haze, const bool sun_enabled, const float sun_disc_intensity, const float sun_glow_intensity, const float sun_disc_scale, const float sky_intensity, const Color night_color, const float night_intensity, const float horizon_height_deg, const float horizon_blur_deg, const Color ground_color, const float saturation, const Color tint, const Point3 sun_direction, const bool use_custom_perez_coefficients, const float custom_perez_A, const float custom_perez_B, const float custom_perez_C, const float custom_perez_D, const float custom_perez_E, const float custom_perez_diffuse_horizontal_illuminance, const float custom_perez_direct_normal_illuminance, const TimeValue t, Interval &validity) const =0
 Converts the given UI-level parameters into the parameters expected by the Physical Sun & Sky shader. More...
 
virtual std::unique_ptr< IShaderInstantiateShader (const ShadingParameters &shading_parameters) const =0
 Instantiates a shader from shading parameters obtained through CreateShadingParameters(). More...
 
- Public Member Functions inherited from FPInterfaceDesc
CoreExport FPInterfaceDesc ()
 
CoreExport FPInterfaceDesc (Interface_ID id, const MCHAR *int_name, StringResID descr, ClassDesc *cd, ULONG flag,...)
 
CoreExport ~FPInterfaceDesc ()
 
virtual void Init ()
 
LifetimeType LifetimeControl ()
 
virtual BaseInterfaceGetInterface (Interface_ID id)
 
CoreExport void LoadDescriptor (Interface_ID id, const MCHAR *int_name, StringResID descr, ClassDesc *pCD, ULONG flag,...)
 
CoreExport void AppendFunction (int id,...)
 Add a new function to this interface descriptor. More...
 
CoreExport void AppendProperty (int id,...)
 Add a new property to this interface descriptor. More...
 
CoreExport void AppendEnum (int id,...)
 Add a new enum to this interface descriptor. More...
 
CoreExport void SetClassDesc (ClassDesc *i_cd)
 
CoreExport va_list check_fn (va_list ap, int id)
 
CoreExport va_list scan_fn (va_list ap, int id, int index)
 
CoreExport va_list check_prop (va_list ap, int id)
 
CoreExport va_list scan_prop (va_list ap, int id, int index)
 
CoreExport va_list check_enum (va_list ap, EnumID id)
 
CoreExport va_list scan_enum (va_list ap, EnumID id, int index)
 
FPInterfaceDescGetDesc ()
 
Interface_ID GetID ()
 
CoreExport FPFunctionDefGetFnDef (FunctionID fid)
 
ActionTableGetActionTable ()
 
CoreExport void EnableActions (BOOL onOff)
 
virtual CoreExport HINSTANCE HInstance ()
 
virtual CoreExport const MCHARGetRsrcString (StringResID id)
 
- Public Member Functions inherited from FPInterface
virtual CoreExport FPStatus Invoke (FunctionID fid, TimeValue t=0, FPParams *params=NULL)
 
virtual FPStatus Invoke (FunctionID fid, FPParams *params)
 
virtual CoreExport FPStatus Invoke (FunctionID fid, TimeValue t, FPValue &result, FPParams *params=NULL)
 
virtual FPStatus Invoke (FunctionID fid, FPValue &result, FPParams *params=NULL)
 
virtual CoreExport FunctionID FindFn (const MCHAR *name)
 
virtual CoreExport BOOL IsEnabled (FunctionID actionID)
 
virtual CoreExport BOOL IsChecked (FunctionID actionID)
 
virtual CoreExport BOOL IsVisible (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsEnabled (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsChecked (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsVisible (FunctionID actionID)
 
- Public Member Functions inherited from BaseInterface
virtual UtilExport ~BaseInterface ()
 Destructor. More...
 
virtual bool RegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual void UnRegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual BaseInterfaceAcquireInterface ()
 
virtual void ReleaseInterface ()
 
virtual void DeleteInterface ()
 
virtual BaseInterfaceCloneInterface (void *remapDir=NULL)
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor. More...
 
template<class InterfaceType >
InterfaceType * GetTypedInterface ()
 

Static Public Member Functions

static Interface_ID GetInterfaceID ()
 Returns the ID of this interface. More...
 
static IShaderGeneratorGetInterface ()
 Returns a pointer to this interface. More...
 
- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Additional Inherited Members

- Public Types inherited from BaseInterface
enum  LifetimeType { noRelease , immediateRelease , wantsRelease , serverControlled }
 
- Public Attributes inherited from FPInterfaceDesc
Interface_ID ID
 
MSTR internal_name
 
StringResID description
 
ClassDesccd
 
USHORT flags
 
Tab< FPFunctionDef * > functions
 
Tab< FPPropDef * > props
 
Tab< FPEnum * > enumerations
 
MSPluginClasspc
 
Rolloutrollout
 
ActionTableaction_table
 
- Static Public Attributes inherited from FPInterface
static CoreExport FPInterfaceDesc nullInterface
 
- Protected Member Functions inherited from FPInterfaceDesc
CoreExport void load_descriptor (Interface_ID id, const MCHAR *int_name, StringResID descr, ClassDesc *cd, USHORT flag, va_list ap)
 
- Protected Member Functions inherited from FPInterface
virtual FPStatus _dispatch_fn (FunctionID fid, TimeValue t, FPValue &result, FPParams *p)
 

Detailed Description

Provides facilities to initialize the shading parameters of the Physical Sun & Sky plugin.

This class encapsulates the logic for initializing the shading parameters of the Physical Sun & Sky plugin. Its intent is to enabled arbitrary (third party) plugins to use the shading facilities of the Physical Sun & Sky plugin. This is achieved by converting the UI-level parameters to those of the Physical Sun & Sky plugin (which should be somewhat simple), and letting this class massage those parameters to the internal ones used by the shader. For example, the ART renderer uses this interface to convert the mental ray Sun & Sky into a Physical Sun & Sky shader.

Member Function Documentation

◆ GetInterfaceID()

Interface_ID GetInterfaceID ( )
inlinestatic

Returns the ID of this interface.

63 {
64  return Interface_ID(0x21797946, 0x8f003b3);
65 }
Definition: maxtypes.h:215

◆ GetInterface()

IPhysicalSunSky::IShaderGenerator * GetInterface ( )
inlinestatic

Returns a pointer to this interface.

68 {
69  return dynamic_cast<IPhysicalSunSky::IShaderGenerator*>(GetCOREInterface(GetInterfaceID()));
70 }
static Interface_ID GetInterfaceID()
Returns the ID of this interface.
Definition: IPhysicalSunSky.inline.h:62
CoreExport Interface * GetCOREInterface()

◆ CreateShadingParameters()

virtual ShadingParameters CreateShadingParameters ( const float  global_intensity,
const float  haze,
const bool  sun_enabled,
const float  sun_disc_intensity,
const float  sun_glow_intensity,
const float  sun_disc_scale,
const float  sky_intensity,
const Color  night_color,
const float  night_intensity,
const float  horizon_height_deg,
const float  horizon_blur_deg,
const Color  ground_color,
const float  saturation,
const Color  tint,
const Point3  sun_direction,
const bool  use_custom_perez_coefficients,
const float  custom_perez_A,
const float  custom_perez_B,
const float  custom_perez_C,
const float  custom_perez_D,
const float  custom_perez_E,
const float  custom_perez_diffuse_horizontal_illuminance,
const float  custom_perez_direct_normal_illuminance,
const TimeValue  t,
Interval validity 
) const
pure virtual

Converts the given UI-level parameters into the parameters expected by the Physical Sun & Sky shader.

Parameters
global_intensityA global multiplier for the entire environment map.
hazeThe haze value, in range [0,1].
sun_enabledWhether the sun should be rendered.
sun_disc_intensityThe intensity multiplier of the sun overall (both sun and sky).
sun_glow_intensityThe intensity multiplier for the glow that surrounds the sun.
sun_disc_scaleThe scale for the size of the sun (1.0 == physical size).
sky_intensityThe intensity multiplier for the sky only (doesn't affect the sun).
night_colorThe color of the night sky.
night_intensityThe intensity of the night sky (a multiplier for the night color).
horizon_height_degThe horizon height in degrees.
horizon_blur_degThe size of the horizon blurred area, in degrees.
ground_colorThe color of the fake ground plane.
saturationThe saturation of the environment map result.
tintA color multiplier for the environment map result.
sun_directionA unit vector pointing towards the sun.
use_custom_perez_coefficientsSet to true if and only if custom Perez coefficients are provided. These coefficients are used to calculate the luminance of the sky; the Preetham coefficients are still used to compute the chromacity.
custom_perez_AThe custom value for the A coefficient of the Perez equation, to be supplied if use_custom_perez_coefficients is true.
custom_perez_BThe custom value for the B coefficient of the Perez equation, to be supplied if use_custom_perez_coefficients is true.
custom_perez_CThe custom value for the C coefficient of the Perez equation, to be supplied if use_custom_perez_coefficients is true.
custom_perez_DThe custom value for the D coefficient of the Perez equation, to be supplied if use_custom_perez_coefficients is true.
custom_perez_EThe custom value for the E coefficient of the Perez equation, to be supplied if use_custom_perez_coefficients is true.
custom_perez_diffuse_horizontal_illuminanceThe custom diffuse horizontal illuminance to be used with the custom Perez coefficients. The sky illuminance will be normalized to match this. A value of 0.0 may be passed to disable the normalization.
custom_perez_direct_normal_illuminanceThe custom direct normal illuminance to be used with the custom Perez coefficients. The sun illuminance will be normalized to match this. A value of 0.0 may be passed to disable the normalization.
tThe time at which certain parameters (such as exposure control) are to be evaluated.
validityThe interval into which the validity of the evaluated parameters is intersected.
Returns
The set of parameters which may be used directly with the Physical Sun & Sky shader.

◆ InstantiateShader()

virtual std::unique_ptr<IShader> InstantiateShader ( const ShadingParameters shading_parameters) const
pure virtual

Instantiates a shader from shading parameters obtained through CreateShadingParameters().

See IPhysicalSunSky::InstantiateShader() for more details.