Getting the rendered object for a shader plugin



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 07/11/2012 at 13:26, xxxxxxxx wrote:

    Hi, I'm currently tinkering with the ShaderData Plugin class. One thing I couldn't figure out yet is how I can evaluate which object is beeing rendered at a given time.
    I understand that the ChannelData and Volume Data is passed to the Output method of the plugin and I can obtain the UV position and normal direction from that (amongst other things), but there is no connection to the object being rendered.
    I honestly have no idea how the raytracer works internally, but I'd think that in order to evaluate a surface normal there would have to be some kind off connection to the polygon object, in order to compute that value in the first place.
    In any case, some info on the subject would be awesome.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 08/11/2012 at 00:37, xxxxxxxx wrote:

    Hehe, if you're looking at shaders, better get used to long frustrating hours poring over the SDK and wondering what it all means.

    In this case though, in the Output function you are passed a ChannelData structure, in that there is a pointer to a VolumeData structure, if you look at the BaseVolumeData from which that is derived you see a pointer (named 'op') to a RayObject, which is the object being rendered.

    Intuitive, it isn't.

    Steve



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 08/11/2012 at 01:15, xxxxxxxx wrote:

    Yeah, that is the same impression that I got. I was studying the C++ SDK like crazy, to find some hidden Python function that does what I want. :)
    As you suggested I got the RayObject from the VolumeData (passed by the ChannelData), but I couldn't find any link to the currently rendered object in this class. The 'link' property that is listed in the C++ SDK doesn't seem to be present in Python. Could you please be a bit more specific on what to do?

    Thanks for helping me out!

    Best,
    Johannes



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 08/11/2012 at 03:44, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    As you suggested I got the RayObject from the VolumeData (passed by the ChannelData), but I couldn't find any link to the currently rendered object in this class. The 'link' property that is listed in the C++ SDK doesn't seem to be present in Python. Could you please be a bit more specific on what to do?

    How did you got the RayObject from the VolumeData? RayObject's op isn't available in Python.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 08/11/2012 at 03:49, xxxxxxxx wrote:

    Unfortunately it seems as if RayObject isn't currently implemented in Python, so there's no pointer to one in the BaseVolumeData. In which case, TBH I think you are at a dead end.

    Maybe there's another way to get the object, I don't know. Or perhaps it'll be implemented in a later version. If all else fails you'll have to use C++ instead (which if you're writing a shader is probably the way to go anyway).

    Steve



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 08/11/2012 at 04:44, xxxxxxxx wrote:

    Yeah, I think I misread the console output. It actually said 'Ray object...' and not 'RayObject object...'. I guess it was some wishful thinking on my part. :) Too bad, that this incredibly useful bit was left out in the Python implementation.
    On the other hand I think Steve is right, in that serious Shader programming is best done in C++. Even the simplest Python Shaders perform sluggish to say the least.
    If only it wasn't so insanely hard to switch over to C++... :)


Log in to reply