Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. Paul Everett
    3. Best
    • Profile
    • Following 0
    • Followers 0
    • Topics 0
    • Posts 6
    • Best 1
    • Controversial 0
    • Groups 0

    Best posts made by Paul Everett

    • RE: Sample a shader in 3D space
      1. you can sample a channel. it works perfectly for things like the layer shader.
      2. if you really have to sample a shader specifically, what I do is make a clone of the shader per each context.

      i.e. you have 16 cores, you make 16 clones, and insert them on the material and initing them, (being sure to clean up after)
      Layer shader will then work as expected, off the bat, as long as you use the thread index to reference from your list of shader clones.
      clones.shader_list[context.GetLocalThreadIndex()]

      you also have to make sure you project your coordinate according to the texture tag. it wont do that for you.
      p is always assumed to be a UV coordinate projected, as per the tex tag. you send p as a world coordinate with vd and if the shader needs that, that is where it would look. think of it from the perspective of a shader. where will it get a world position from? if you write a shader, and you need a world position for a hit, you look in vd for that. if vd is null, or the info has not been filled, how would it know where p is?

      I found in most cases sampling a channel from a material rather than a specific shader, works best, and is less problematic.

      best
      Paul

      posted in Cinema 4D SDK
      Paul EverettP
      Paul Everett