Sampling surface texture



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

    On 01/09/2011 at 08:30, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R12 
    Platform:   Windows  ; Mac  ;  
    Language(s) :     C++  ;

    ---------
    I've read numerous threads here about this, and lots of things in the SDK docs, and now I'm thoroughly confused.

    Say I have an object with a grayscale texture (bitmap or procedural) applied to it. The texture has UVW projection. I can get the polygons making up the object, and from that any point on the surface of that polygon. What I want to do is sample the texture at that point. Not at render time, but during a GetVirtualObjects call.

    It seems clear that I need to use BaseChannel::Sample for this. I am assuming that in this case the *VolumeData parameter be NULL. My first question is, is that correct?

    Secondly, I can get/calculate all the other parameters *except* for the UVW coordinate of that point. What I'm looking for is how I can calculate/get the UVW coordinate for the surface point I already have. I just can't figure out how to do that, but it looks as if it ought to be easy! Any help or pointers on how to do this would be much appreciated.

    Many thanks,

    Steve



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

    On 01/09/2011 at 09:52, xxxxxxxx wrote:

    Hy Steve,

    I created a plugin which controls TP particles by a projected Material. There I had to do the same trick, figuring out what the color value is at the current particles position (ie. mapped to my object).

    What you can use is the barycentric coordinates from the GeRayCollider. It is just a weighted sum to get to the original UV coords. Then you need to check for tiling and offset of the texture and apply those values to retrieve the final UV coords for the Shader/Bitmap.

    I just worked with a bitmap, but I don't know how you would retrieve the values for the shader, given the UV coords ... If you figure it out, let me know ;)

    Cheers,
    maxx



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

    On 01/09/2011 at 13:51, xxxxxxxx wrote:

    Hi maxx,

    That's basically exactly what I'm doing (not with TP, though), so this is a great help, thank you.

    I'll look at the GeRayCollider right now.

    Many thanks for the quick response.

    Steve



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

    On 21/11/2011 at 12:28, xxxxxxxx wrote:

    Sorry to bump this old thread. But I thought it would be better than asking the same question again in a new thread.

    Did you guys ever figure out how to read the texture colors per object vertex?

    -ScottA



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

    On 22/11/2011 at 01:55, xxxxxxxx wrote:

    I never got this to work. I know it's possible - I've seen it done - but I don't know how. I would still like to know, though.


Log in to reply