Notifications
Clear all
[Closed] Create Skylight in Max SDK?
Feb 16, 2015 8:33 pm
Does anyone know how to create a Skylight in 3DS Max SDK?
I’ve been all over the sdk docs and can only find methods for creating basic lights(spot, omni, directional)
4 Replies
1 Reply
I did find a CreateInstance method which I assume will do that, but how do I get the class ID?
I spent hours searching the docs and examples with no success.
I did find some code which enumerates all material names, which I needed to create an Oren Nayar Blinn material… is there something similar that will enumerate all class names and their IDs?
Thanks
Feb 16, 2015 8:33 pm
I don’t know which file contains lights ClassID, but you can obtain it even through maxscript, just create this light, select it and type
$.classid
Feb 16, 2015 8:33 pm
this should work for you…
enum { ksl_Color, ksl_Sky_Color_Map_Amt,ksl_Sky_Color_Map, ksl_Sky_Color_Map_On, ksl_Rays_Per_Sample,
ksl_Skylight_Mode = 7, ksl_Multiplier = 10,ksl_Ray_Bias,ksl_Cast_Shadows, ksl_On};
Object* skylightobj = (Object*)GetCOREInterface()->CreateInstance(LIGHT_CLASS_ID, Class_ID(0x7BF61478,0x522E4705));
INode* skylightnode = GetCOREInterface()->CreateObjectNode(skylightobj);
TimeValue t = GetCOREInterface()->GetTime();
for(int i=0; i < skylightobj->NumRefs();++i)
{
ReferenceTarget* ref = skylightobj->GetReference(i);
if ( ref && ref->SuperClassID() == PARAMETER_BLOCK2_CLASS_ID )
{
IParamBlock2* pb = dynamic_cast<IParamBlock2*>( ref );
if(pb)
{
pb->SetValue(ksl_Color,t,Color(0.5f,0.5f,0.5f));
pb->SetValue(ksl_Sky_Color_Map_Amt,t,50.0f);
pb->SetValue(ksl_Sky_Color_Map,t,(Texmap*)CreateInstance(TEXMAP_CLASS_ID, Class_ID(MARBLE_CLASS_ID,0)));
pb->SetValue(ksl_Sky_Color_Map_On,t,0);
// etc...
}
break;
}
}