0

sampler usage example in glsl nodes

Hey all,

I was digging through the rv reference docs and noticed there is support for texture samplers, however no real usage example exists that I've been able to find. I'm struggling to come up with how I'm supposed to bind a texture and then sample it. The docs make it seem like I just define a huge array in the parameters section of the gto file but that seems odd.

I'm trying to load a .cube file and sample it in glsl to apply and addition color LUT on top of whatever is already in the node stack. There are other ways to do this for sure, but in this case doing it after all of our OCIO stuff is resolved is ideal.  

Can someone show a trivial example case of using sampler3D as a glsl input? 

Thanks!

2 comments

  • 0
    Avatar
    (Michael) Kessler

    Hi Andrew,

     

    Thanks for posting.  I've uploaded a sampler example package that I wrote as a bare-minimal example of how to store a sampler on a custom GLSL node, and then access that in a shader.


    The sampler is fed a floatProperty array, and it interprets the floatProperty array as a texture.  I've uploaded the example here: https://autodesk.box.com/s/51o2qene4oew6vo2soqfw8rhm9dzypjh

    In the GTO file you define the property to create the sampler, but you can modify the contents as you see fit.  I've added, to illustrate this a randomizer to the SamplerExample package.  To check out the example, install the package, then load the included .rv file.  The shader will fill the screen with a color defined in the testdata parameter.  At any point, you can randomize the contents of the testdata parameter to demonstrate how the sampler's content is linked to the property graph and can dynamically be updated.

    After checking out that package, please let me know if you have any questions!

    -Kessler

  • 0
    Avatar
    scott jones

    Hi,

    I am finding myself asking a similar question. The link where you posted the example is now dead. Would it be possible to re-upload to new location?

     

    thanks

    -scott-

Please sign in to leave a comment.