Loading bitmaps from object data through a shader?



  • On 03/01/2018 at 08:44, xxxxxxxx wrote:

    Hi,

    I'm currently trying to write a ShaderData plugin that, at render time, retrieves a string from an object's user data (or alternatively, a custom TagData), and uses that string (appended to a filepath) to return a bitmap specific to the object. I'm envisioning this working similarly to the MoGraph Color Shader, where the data used during rendering comes from the object, and the data reference is relative, meaning the same shader can be used on multiple objects with different results. Is this possible with PYTHON? Is a ShaderData plugin the best way to go about this and, if so, how do I access the object's data from the shader?

    Thanks,
    Ben



  • On 04/01/2018 at 07:51, xxxxxxxx wrote:

    Hi Ben, thanks for writing us.

    First of all welcome to our discussion forum as an active participant.

    With regard to your request, I confirm that your assumption is correct and ShaderData would definitively be the easier and most effective way to go if it would be in C++. Unfortunately current Python API comes with a limited set of exposed classes with regard to VolumeData and more specifically it lacks the RayObject class as well as the VolumeData::GetObj() method.
    These twos are vital to retrieve the object (or its instances) currently using the ShaderData instance being under evaluation at render time (i.e. during the ShaderData::Output() execution).

    So far there's no workaround in Python that could make the trick.

    Best, Riccardo



  • On 04/01/2018 at 10:25, xxxxxxxx wrote:

    Thanks so much for the warm welcome, and for getting back to me so quickly!

    While I may not be able to do it in Python, I'm glad to hear that it is at least theoretically possible using C++. Coming from a Java background, picking up C++ shouldn't be too difficult, and I should be able to repurpose my knowledge of C4D's Python API.

    Cheers,
    Ben


Log in to reply