Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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
    • Recent
    • Tags
    • Users
    • Login

    shader artifacts

    Scheduled Pinned Locked Moved SDK Help
    12 Posts 0 Posters 826 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

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

      On 14/06/2010 at 13:49, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   r11 
      Platform:      
      Language(s) :     C++  ;

      ---------
      Hi there,

      i am facing a strange problem. a channel shader plugin creates different outputs on different computers. see the screenshot.
      the upper shows how it is intented to look like (thats how it looks on my notebool windows xp 32bit) the other shows how it looks on other computers (my vista64bit pc and also a xp32 bit pc of a tester).

      problem has to do with such a line of code, if that line isn't there, the problem isn't there, too: result += dist*mixDist*distCol; where result is the Vector returned by the shader, dist and mixDist are Real values and distCol is a Vector (taken from a COLOR description element)

      i have no idea what could be responsible for such behaviour... so any input is welcome.

      it reminds me of something i have seen on this forum some time back, but i dont remember what it was except that it has to do with perfect sphere and here it happens no matter what objects are shaded.

      thanks,
      ello

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

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

        On 15/06/2010 at 00:25, xxxxxxxx wrote:

        Looks like dist or mixDist are not always identical for each call of Output() which can happen in a multithreaded rendering depending how you obtained the values. It would be interesting to know how you obtain dist and mixDist and how the rendering looks like if you render with only one single thread.

        cheers,
        Matthias

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

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

          On 15/06/2010 at 06:43, xxxxxxxx wrote:

          I had EXACTLY the same artifacts in a shader of mine, when I tried to sample values from another material. I never found out what it was. But one thing was sure: It only happened when rendering with more than 1 thread.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

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

            On 15/06/2010 at 07:55, xxxxxxxx wrote:

            ah, there the dog has been burried.. if i use only one thread it works. but what does this tell me??

            this is how i get the parameters.. in the init part:

            mixDist = data->GetReal(MIXDIST);
              distCol = data->GetVector(DISTCOL);

            and

            in the output part:
            dist = ht->GetData().GetReal(DIST);

            where ht is a helper tag i created by another plugin and where the values are filled.

            jack, did the problem just went away or how did you solve it?

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

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

              On 15/06/2010 at 08:38, xxxxxxxx wrote:

              Originally posted by xxxxxxxx

              ah, there the dog has been burried..

              lol, German sayings in direct translation always remind me of Heinrich Lübke 😄

              Originally posted by xxxxxxxx

              if i use only one thread it works.

              Aha! So we actually suffer from the same problem.

              Originally posted by xxxxxxxx

              jack, did the problem just went away or how did you solve it?

              I never solved it. That's why the shader plugin I was referring to has never been released 🙂 Renato had the same problem with his Fast&Fur; shader and AFAIK he also never got it solved.

              I would greatly appreciate any information on this from other developers and/or the Maxon support 🙂

              Cheers,
              Jack

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

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

                On 15/06/2010 at 09:02, xxxxxxxx wrote:

                Originally posted by xxxxxxxx

                lol, German sayings in direct translation always remind me of Heinrich Lübke 😄

                😉 i knew that it would sound strange, but i just couldnt resist...

                Originally posted by xxxxxxxx

                Aha! So we actually suffer from the same problem.
                ...
                I never solved it. That's why the shader plugin I was referring to has never been released 🙂 Renato had the same problem with his Fast&Fur shader and AFAIK he also never got it solved.

                I would greatly appreciate any information on this from other developers and/or the Maxon support 🙂

                Cheers,
                Jack

                ugh, that is not the best solution... so i hope too that there will follow some input which will help solving this task

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

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

                  On 15/06/2010 at 09:06, xxxxxxxx wrote:

                  Originally posted by xxxxxxxx

                  in the output part:
                  dist = ht->GetData().GetReal(DIST);

                  where ht is a helper tag i created by another plugin and where the values are filled.

                  How do you obtain the pointer to ht ?

                  cheers,
                  Matthias

                  1 Reply Last reply Reply Quote 0
                  • H Offline
                    Helper
                    last edited by

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

                    On 15/06/2010 at 09:06, xxxxxxxx wrote:

                    I will make a guess ...

                    one of these variables "result" or "dist" is defined as member variable of the shader class.

                    Remember, you must not write data into member variables of the shader class from within the Output function. That is because Output is executed in multiple threads which all reference the same class instance. So you might end up manipulating the same data at the same time by multiple threads.

                    It is however possible to allocate dedicated storage space for each possible thread within the class instance. Normally most of the data can be read-only, or allocated on the function call stack.

                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      Helper
                      last edited by

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

                      On 15/06/2010 at 09:33, xxxxxxxx wrote:

                      thank you very much, michael! that did the job! now i define the Real dist in the output function and it works fine!

                      btw, while i did the test with 1 thread it rendered much faster than when i use 4 threads..  what could be the cause for such slowdown?? must be something related to the threading?? to which i never spent attention to be honest.

                      cheers,
                      ello

                      1 Reply Last reply Reply Quote 0
                      • H Offline
                        Helper
                        last edited by

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

                        On 15/06/2010 at 11:38, xxxxxxxx wrote:

                        Matthias, this is how i get the tag:

                          
                          if (cd->vd)  
                          {  
                              RayObject *robj = NULL;  
                              robj = cd->vd->op;  
                              if (!robj) return 0.0;  
                              if (robj->link)  
                              {  
                              BaseTag *ht = robj->link->GetTag(HELPERTAG);  
                              if (ht)  
                              {  
                        ...  
                        
                        1 Reply Last reply Reply Quote 0
                        • H Offline
                          Helper
                          last edited by

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

                          On 16/06/2010 at 02:29, xxxxxxxx wrote:

                          You're welcome.

                          Concerning this slowdown, i can tell you that running many rendering threads on a single CPU (actually i mean CPU *core* , but i just say CPU for convencience) is less efficient than running 1 thread per CPU.

                          It's because there is some overhead for synchronizing access to shared resources. There is also a tiny overhead for switching between execution of various threads.

                          Your slowdown can of course also have different reasons.

                          1 Reply Last reply Reply Quote 0
                          • H Offline
                            Helper
                            last edited by

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

                            On 16/06/2010 at 02:57, xxxxxxxx wrote:

                            Originally posted by xxxxxxxx

                            Matthias, this is how i get the tag:

                             
                              if (cd->vd)  
                              {  
                                  RayObject *robj = NULL;  
                                  robj = cd->vd->op;  
                                  if (!robj) return 0.0;  
                                  if (robj->link)  
                                  {  
                                  BaseTag *ht = robj->link->GetTag(HELPERTAG);  
                                  if (ht)  
                                  {  
                            ...  
                            

                            Looks like this has nothing to do with your original problem. I was wondering if the pointer to the tag was a member variable and you somehow modified it from within Output().

                            cheers,
                            Matthias

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post