Notifications
Clear all

[Closed] Changing Shadow type

Hello maxscripters, I have a small question to ask. I’m trying to create a script that changes the shadow type of a light to something other then ” Raytraced Shadows” or “Shadow Map”.
More specifically a plugin shadow generator.
Unfortunantly there is not one script that I have found to disect that performs this function, nor have I been able to locate any info from the producers of the plugin.

Any assistance would be most appriciated, thanks,

Kiril

3 Replies
1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

Shadow Generators are plugins as everything else.
You can get an array of all installed shadow generators by saying simply

theShadowGensArray = Shadow.classes

For example, on my machine I get

print Shadow.classes

shadowMap
raytraceShadow
Area_Shadows
VRayShadow
Adv__Ray_Traced
Brazil_Ray_Shadows
Ox_Raytraced_Shadows
Ox_Hair_Shadow
mental_ray_Shadow_Map
Hair_Shadows
AB_Ray_Trace_Shadow
AB_Shadow_Map
Composite_Shadow
Ox_Deep_Shadow_Maps
Missing_Shadow_Type

To assign a new shadow generator, just create an instance of it and assign to the .shadowGenerator property of the light:

aLight = OmniLight()
aLight.shadowGenerator = Area_Shadows()

Here is an example:


 rollout assignShadows "Assign Shadows"
 (
 	listbox lbx_shadowTypes items:(for i in shadow.classes where not matchPattern (i as string) pattern:"Missing*" collect i as string)
 	on lbx_shadowTypes selected itm do
 		for o in selection where superclassof o == Light do
 		    try(o.shadowGenerator = execute (lbx_shadowTypes.selected + "()"))catch()
 )
 createDialog assignShadows 
 

Select any number of lights (and other objects) and select a shadow type from the list – all selected lights will be switched to that shadow class…

Thankyou for your time Bobo, I’ve recently tested your solution and it works just as I had hoped.

The objective of the script is to create an ambient occlusion pass for ornatrix hair using ox deep shadows and a skydome, since I find the native selfshadowing effect inadequate – thanks for making it possible.

Kiril