AyaKoshigaya
11-03-2009, 04:36 PM
Hey,
I'm writing a little plugin for 3ds Max and am encountering a problem...
I need to sample the color of a material at a given world coordinate, including all the shadows, reflections etc that I'd see when I look trough the camera and hit the render button for that one pixel.
So, I thought what I need is the Mtl->Shade() function. At least it sound's a lot like it :)
But, this function needs a "ShadeContext" as parameter.. and after reading the help and looking at all the examples I managed to create the ShadeContext and fill it up with all the data..
So the data I have is the Point I'd like to sample (in WorldSpace coords), the UVW coordinates for the Point and the Material of course..
But what ever I do, the output of the Shade() function (sc.out.c) is always black.. I have no idea what I am doing wrong (I also added the lights like in one of the examples)
I can't believe I have to write ~1000 lines of code (the ShadeContext) just to sample a value of a material.. In Maya (and most other SDKs) this is one single line of code ;/
So... if there's anyone who can help me, please help..
Best regards,
Aya
PS: If I am using "Mtl->EvalColorStdChannel(sc, ID_DI, out)" instead of "Mtl->Shade()" I get the correct color.. but without shadows etc..
I'm writing a little plugin for 3ds Max and am encountering a problem...
I need to sample the color of a material at a given world coordinate, including all the shadows, reflections etc that I'd see when I look trough the camera and hit the render button for that one pixel.
So, I thought what I need is the Mtl->Shade() function. At least it sound's a lot like it :)
But, this function needs a "ShadeContext" as parameter.. and after reading the help and looking at all the examples I managed to create the ShadeContext and fill it up with all the data..
So the data I have is the Point I'd like to sample (in WorldSpace coords), the UVW coordinates for the Point and the Material of course..
But what ever I do, the output of the Shade() function (sc.out.c) is always black.. I have no idea what I am doing wrong (I also added the lights like in one of the examples)
I can't believe I have to write ~1000 lines of code (the ShadeContext) just to sample a value of a material.. In Maya (and most other SDKs) this is one single line of code ;/
So... if there's anyone who can help me, please help..
Best regards,
Aya
PS: If I am using "Mtl->EvalColorStdChannel(sc, ID_DI, out)" instead of "Mtl->Shade()" I get the correct color.. but without shadows etc..
