PDA

View Full Version : Get a raySampler in a non-rendering context.


nuttynut
11-08-2010, 10:12 AM
Hey guys

The following function in MRenderUtils needs a raySampler to function properly:
http://download.autodesk.com/us/maya/2011help/API/class_m_render_util.html#c61ddf53fc7286fc1d0ea2cb312facc5


MStatus MRenderUtil::raytrace(
const MFloatVector & rayOrigin,
const MFloatVector & rayDirection,
const void * notUsed,
const void * raySampler,
const short rayDepth,
MFloatVector & resultColor,
MFloatVector & resultTransparency,
const bool isReflectedRays = true
)


How do I aquire one in a non-rendering context: in the compute of a node connected to the mesh. From some initial googling I found out the only way to sample a texture at a given UV is either use MRenderUtil::sampleShadingNetwork or MRenderUtil::raytrace.

If there IS a way to sample a texture color at a given uv without having to render, please tell me :)

Thanks
Waldo

edit: I found a similar topic on creativecrash, but no solution there: https://www.creativecrash.com/forums/api/topics/raytrace-function-from-mpxcommand

nuttynut
11-08-2010, 03:54 PM
I was able to workaround not having a raySampler now. But it would still be handy to know for the future.

I used the MFnMesh intersection methods in combination with MRenderUtil::sampleShadingNetwork()

CGTalk Moderation
11-08-2010, 03:54 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.