PDA

View Full Version : Convert XSI MentalRay shader to Max?


ExP
11-03-2005, 08:57 PM
Hi everybody,
I'm currently working on some effects for a film and I'm having some problems with lens distortion.
The person responsible for the 3D tracking of the BG plates used a program called 3D Equalizer and exported the trcaking data to 3dsMax (the app I'm using for the 3D effects).
Now in order to handle lens distortion I need to render my elements using the appropriate lens parameters that will match the BG plates.

I did some quick research and I found a MRay shader that computes accurate lens distortion, but it's compiled for XSI MentalRay and not Max.
The shader comes with a .dll file of the actual code and a .spdl for the XSI UI declaration.

I know the .dll should work in MRay for Max, but is there an easy way to convert the .spdl to a .mi declaration for max?

Here's a link to the XSI shader:
http://www.alamaison.fr/3d/lmWarpDistort/lmWarpDistort.htm


I've already post this in the XSI forum as well.
Any help is deeply appreciated.

Thanks!!

-Vormav-
11-03-2005, 11:55 PM
I don't know of a quick and easy way to do the conversion. However, I took a look at the .spdl file, and managed to put this mi file together. It worked fine when I tested it. Just be sure to DISABLE the MR scanline option from the rendering tab (this only works with pure raytracing), or else you'll get artifacting instead of distortion.

declare shader
"lmWarpDistort" (
scalar "distortion",
scalar "anamorphicSqeeze",
scalar "xCurvature",
scalar "yCurvature",
scalar "quarticTerm",
boolean "enabled"
)
version 1
apply lens

gui "gui_lmWarpDistort" {
control "Global" "Global" (
"uiName" "Lens Distortion",
"category" "Texture",
)
control "distortion" "scalar" (
"uiName" "Distortion",
"value" 0.0,
"range" -1000.0 1000.0
)
control "anamorphicSqeeze" "scalar" (
"uiName" "Anamorphic Sqeeze",
"value" 1.0,
"range" -1000.0 1000.0
)
control "xCurvature" "scalar" (
"uiName" "X Curvature",
"value" 0.0,
"range" -1000.0 1000.0
)
control "yCurvature" "scalar" (
"uiName" "Y Curvature",
"value" 0.0,
"range" -1000.0 1000.0
)
control "quarticTerm" "scalar" (
"uiName" "Quartic Term",
"value" 0.0,
"range" -1000.0 1000.0
)
control "enabled" "boolean" (
"uiName" "Enable Lens Shader",
"value" 1.0
)
}
end declare

ExP
11-04-2005, 07:09 PM
Hey Vormav,
Thank you so much for your help!! This is a really nice shader, and it's going to solve a lot of problems for me.

BTW I've gone around the scanline option (so that I would not forget to turn it off), by adding


scanline off
trace on


after the "apply lens" line.

Thanks again,
Cheers

CGTalk Moderation
11-04-2005, 07:09 PM
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.