Varying float WtDisplacment (How 2 do vary)?

  • ggaliens

    ggaliens - 2007-11-16

    Varying float WtDisplacment  (How 2 do vary)?

    For 3Delight

    I make the parameter varying float WtDisplacement in both the declaration (.rib) and the definition of ths shader (.sl)

    Somehow PIXIE does not seem to behave same way. There must be a key syntactical difference I'm missing when it comes to vertex varying values.

    Can someone outline the most basic issues with making a vertex varying shader variable called WtDisplacement ???

    • George Harker

      George Harker - 2007-11-16

      Hi there,

      I'm not sure I understand.  Do you have a rib / shader which is causing issues?

      For vertex varying to work, you need to either declare it in the rib, or use the full type inline in the primitive's parameter list like:

      "P" [....]
      "vertex color vval"
      [ 0 1 0
        1 0 0
        1 1 1
        0 1 1
        1 1 0
        1 0 1
        0 0 0
        0 0 1

      Note that the inline type and the declaration are _vertex_ not varying, whereas in the shader there are two types only.  Varying and uniform.  In order to use a value that differs across the object, make your shader parameter varying, like

      surface foo(....; varying color vval=0; ) { //...

      Does that help?



    • ggaliens

      ggaliens - 2007-11-16

                float  mult     = 1,
                   Nzscale = 1,
                   Km      = .2,
                   bubsize = 0.1;
              varying float WtDisplacement = 1.0;
        normal Nn = normalize(N);
        float a,b,c,bub;
        float dist, shortest=10000;
        point Po = transform("object",P)*mult;

        /*true cell center, surrounding cell centers, noised cell center*/
        point trucell, surrcell, nzcell;
        vector offset;
        /*what is the shortest distance to a noised cell center?*/
        for(a = -1; a<= 1; a+=1){
          for(b = -1; b<=1; b += 1){
            for(c = -1; c<=1; c += 1){
          offset = vector(a,b,c);
          surrcell = trucell+offset;
          nzcell = surrcell + ((vector cellnoise(surrcell)-.5)*Nzscale);
          dist = distance(Po,nzcell);
          if(dist<shortest) shortest = dist;
        bub = clamp(shortest,0,bubsize)/bubsize;

        P+= Nn*(pow(bub,2)-1)*Km*WtDisplacement ;

        N = calculatenormal(P);

    • ggaliens

      ggaliens - 2007-11-16

      Above is the shader code.

      In the RIB I'm using the directive you indicated ... but still not a happy result.

      What about facevarying ????  That's a 3Delight directive ... I need to know the corresponding PIXIE directive ... or better yet ... maybe I just need to read some manual.

    • ggaliens

      ggaliens - 2007-11-17

      I made a ZIP file

      This behaves very differently between 3Delight (gets it right, correct) ... PIXIE (seems not to honor my varying WtDisplacement).

      Can you tell me what I'm doing wrong ???? How to solve the problem ???

      ml_dented is a simple variation on the popular

      • George Harker

        George Harker - 2007-11-17

        Thanks for that.

        In my render, I see dendted / bumpy at the bottom and almost smooth at the top.  Is this not correct?

        Which Pixie version are you using?



    • ggaliens

      ggaliens - 2007-11-18

      This is how my two renderers behave.

      PIXIE seems like it is not obeying the vextex WtDisplacement variable.

      (I think the color issues is separate but related, if we solve one ... we might get a handle on the the other).


    • ggaliens

      ggaliens - 2007-11-18

      I'm using PIXIE version   v1.7.5

      according to rndr tool.

      Now we just need to find out why you get one result and I get another.

    • ggaliens

      ggaliens - 2007-11-18

      Also ...

      I checked the SHADER variables in my control panel environment variable GUI.

      It looked to be pointing the the proper c:/Program Files/Pixie/Shaders

      I also looked at how many copies of ml_dented.sdr I had laying around and deleted all but the problematic one that came from the source I provided to you. Still same problem.

      I wonder if somehow we are compiling the shader differently. Perhaps  you will tell me we have different versions. My expectation was that v1.7.5 would be the latest.

    • ggaliens

      ggaliens - 2007-11-18

      OK ... seems like an old VERSION !

      I had not downloaded since maybe last year. Something about 1 year old.

      Newer version does fix the problem with WtDisplacement.


      • George Harker

        George Harker - 2007-11-18

        Glad you got it working.

        I thought it was rather odd that I was seeing the varying displacement whilst you were not.  Also odd given that I thought we fixed support for primitive variables for shader params some time ago.

        Have fun




Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks