rendering castshadows

Hi there,

I'm trying to import a series of files and render them, with castshadows on. I'm currently having problems switching on cast shadows, and also selecting which renderer I want to use (would be nice to try a few different ones to see the differences)

My script is as follows:

for i = 1 to 4 do
(
importFile ("$scenes/Untitled"+(i as String)+".wrl") #noPrompt
render camera:($bencam01) outputFile: ("$scenes/Untitled"+(i as String)+".jpg") vfb:false #noPrompt
saveMaxFile ("$scenes/Untitled"+(i as String))
)

I have one light in the scene, named Light01. Would really appreciate it if somebody could help me switch on castshadows for Light01, and then select the renderer.

ben.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
benno's picture

Hi Br0t, Many thanks again

Hi Br0t,

Many thanks again for your help. About rendering with the previous .wrl still in the scene - the method described above does seem to do what i want - by saving the maxfile, and then importing a new .wrl in the next iteration, this seems to remove the previous .wrl...which is what I want.

Having said that the method you mentioned about deleting the old .wrl explicitly would be a nicer way to do things.

br0t's picture

Hi, one thing I did not

Hi,
one thing I did not notice in the last thread: You are now importing on .wrl file, rendering it, saving the output, saving the scene. Then you import the next .wrl and do the same, with the last .wrl still in the scene - Is that the kind of result what you wanted? Or do you want to import one file, render and save it, then delete everything and import the next file into the clean scene?

Anyway, switching on the shadows for a light is fairly simple, you just type

 Light01.baseObject.castShadows = true

If you want to do this for any light in your scene you could write

myLights = lights as Array
for i=1 to myLights.count do
	(
		if (classof myLights[i] != Targetobject) do
			(myLights[i].baseObject.castShadows = true)
	)

The "if classof..." is only here to prevent errors that occur when max would try to cast the shadows of a targetobject (e.g. the target of a target-directional-light) .

You can switch the renderer like this:

renderers.current = mental_ray_renderer()
or
renderers.current = default_scanline_renderer()

Greetings

Never get low & slow & out of ideas

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.