shader artifacts



  • 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



  • 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



  • 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.



  • 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?



  • 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 :D

    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



  • 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 :D

    ;) 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



  • 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



  • 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.



  • 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



  • 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)  
          {  
    ...  
    


  • 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.



  • 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


Log in to reply