PDA

View Full Version : apply Lens Shader (Mental Ray)


loran
11-06-2009, 11:12 AM
hey, I want to set a Distortion shader in the Camera lens shader.
for unknowed reason I enable it but can't apply a shader in the channel.
Any help?


mr =mental_ray_Renderer()
renderers.current = mr
mr.Enable_Camera_Lens_Shader = true
distor = Distortion ()
mr.Camera_Lens_Shader = distor

distor.Barrel = true
distor.Pin_Cushion = false
distor.amount = 1.5

jonlauf
11-06-2009, 07:48 PM
I believe your constructor is incorrect. Try this:

mr = mental_ray_renderer()
renderers.current = mr
mr.Enable_Camera_Lens_Shader = true
distor = Distortion__lume()
mr.Camera_Lens_Shader = distor

distor.Barrel = true
distor.Pin_Cushion = true
distor.amount = 1.5

Also, I noticed I had to shut down the render dialog after running the script and reopen it for the lens button to show the appropriate shader, but it is getting set.

Hope this Helps,
Jon

PiXeL_MoNKeY
11-06-2009, 08:06 PM
Or you could update the render dialog usingrenderscenedialog.update()This will update the dialog while it is still open.

-Eric

loran
11-09-2009, 01:29 PM
I believe your constructor is incorrect. Try this:

you can either use "Distortion__lume" or "Distortion()" (cf help files)

renderscenedialog.update()

Cool! Thank you it works!

mmm... Lens is OK now but I have an error on trying to apply Output_Shader :/

mr =mental_ray_Renderer()
renderers.current = mr

mr.Enable_Camera_Lens_Shader = true
distor = Distortion ()
distor.Barrel = true
distor.Pin_Cushion = false
distor.amount = 1.5
mr.Camera_Lens_Shader = distor

mr.Enable_Camera_Output_Shader= true
glar0 = Glare ()
glar0.Streaks =true
glar0.Quality =4
glar0.Spread =2

mr.Camera_Output_Shader = glar0

renderscenedialog.update()

jonlauf
11-09-2009, 02:44 PM
According to the help:

Glare__lume: class instances not creatable by MAXScript

I don't think there is a way around it, but I may be wrong.

PiXeL_MoNKeY
11-09-2009, 04:42 PM
Glare() is not creatable by maxscript, but GlaretextureMap() is:glare()
-- Runtime error: Not creatable: Glare__lume
glaretexturemap()
GlaretextureMap:GlareThe other option for dealing with non-creatable maps is to store a version in a .mat library and then load from there whenever you need it.

-Eric

dunkelzahn
11-09-2009, 04:57 PM
...The other option for dealing with non-creatable maps is to store a version in a .mat library and then load from there whenever you need it.

Amen to that ;)

loran
11-10-2009, 08:32 AM
thank you gyus

CGTalk Moderation
11-10-2009, 08:32 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.