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

11 November 2010, 11:12 AM
Hey guys

The following function in MRenderUtils needs a raySampler to function properly:

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 :)


edit: I found a similar topic on creativecrash, but no solution there:

11 November 2010, 04: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 November 2010, 04: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.