Menu

problems with (foo == bar) ? foo : bar ;

rconstruct
2008-06-08
2013-04-25
  • rconstruct

    rconstruct - 2008-06-08

    Hi

    I'm working in a glass shader, and i'm getting some strange errors. Since raytracing is expensive, i'm restricting the shading (and samples) to apropriate raylevels, and i'm using lots of binary evaluations ( (foo == bar) ? foo : bar; ) instead of if/else's. Can anyone confirm if this is the case, pixie not supporting these expressions? And if so, is there a timetable to implement this ?
    Thanks.

    Best regards

     
    • Moritz Moeller

      Moritz Moeller - 2008-06-10

      Implicit if's are not part of the RenderMan standard. Some renderers (e.g. PRMan & 3Delight) support them but this is not RenderMan-compliant any more.
      And honestly, this is just syntactical sugar for explicit if's. So just write an explicit if like so:

      float baz;
      if( foo == bar ) baz = foo; else baz = bar;
      // use baz

      :-)

      .mm

       
      • rconstruct

        rconstruct - 2008-06-11

        Hi

        Will do, i just asked about this because i'm working on a couple of heavy shaders (glass, and coated glass & coated metals), particularly the glass one is quite heavy, and i noticed that at least 3delight (and the air demo) are faster when using binary conditionals than if/else, but no problem, i can just as well use if/else, overall the difference altough exists, at least in those 2 renderers, is negligible compared to other things.
        Thanks for the swift reply anyway.

        Best regards

         

Log in to post a comment.