Understanding texture mapping onto jit.gl.gridshape circle


    Aug 13 2006 | 5:22 pm
    Hi folks,
    I've looked through the help files, tutorials, and even Andrew B.'s
    great online Jitter articles and I'm having no luck figuring this out.
    I'm trying to map a texture onto a jit.gl.gridshape circle, and it's
    being mapped differently than I want it to be mapped: instead of being
    wrapped around the circumference of the circle, I'd like it to be mapped
    from left to right, top to bottom (with the squared corners rounded off,
    essentially). I guess this is a polar to cartesian transformation I'm
    looking for, is that right? But I can't figure out how or where to
    apply that transformation.
    I'm unsure if I'm even asking the question well enough, let me know if
    not. But if anyone could give me some pointers, I'd greatly appreciate it.
    Thanks!
    Dave

    • Aug 13 2006 | 5:53 pm
      The easiest thing to do is to create a circle mask for your texture's
      alpha channel and set @blend_enable 1 for the gridshape. That should
      be straightforward enough since you don't have to try and to the
      poltocar thing. To create a circle mask in Jitter, use jit.expr like
      this: jit.expr @expr "hypot(snorm[0], snorm[1])" and threshold it at
      some value to create the maks.
      best,
      wes
      On 8/13/06, Dave Della Costa wrote:
      > Hi folks,
      >
      > I've looked through the help files, tutorials, and even Andrew B.'s
      > great online Jitter articles and I'm having no luck figuring this out.
      >
      > I'm trying to map a texture onto a jit.gl.gridshape circle, and it's
      > being mapped differently than I want it to be mapped: instead of being
      > wrapped around the circumference of the circle, I'd like it to be mapped
      > from left to right, top to bottom (with the squared corners rounded off,
      > essentially). I guess this is a polar to cartesian transformation I'm
      > looking for, is that right? But I can't figure out how or where to
      > apply that transformation.
      >
      > I'm unsure if I'm even asking the question well enough, let me know if
      > not. But if anyone could give me some pointers, I'd greatly appreciate it.
      >
      > Thanks!
      >
      > Dave
      >
    • Aug 13 2006 | 8:07 pm
      You can use the tex_map attribute to apply a texture to any GL Group
      object using the object's vertex coordinates. In this case the
      incantation "tex_map 1, tex_plane_s 0.5 0 0 0.5, tex_plane_t 0 0.5 0
      0.5" should map a plane texture to the circle. Look at the HTML
      reference to find out what all the tex_map modes do.
      HTH,
      Randy
      On Aug 13, 2006, at 10:22 AM, Dave Della Costa wrote:
      > Hi folks,
      >
      > I've looked through the help files, tutorials, and even Andrew B.'s
      > great online Jitter articles and I'm having no luck figuring this out.
      >
      > I'm trying to map a texture onto a jit.gl.gridshape circle, and it's
      > being mapped differently than I want it to be mapped: instead of being
      > wrapped around the circumference of the circle, I'd like it to be
      > mapped
      > from left to right, top to bottom (with the squared corners rounded
      > off,
      > essentially). I guess this is a polar to cartesian transformation I'm
      > looking for, is that right? But I can't figure out how or where to
      > apply that transformation.
      >
      > I'm unsure if I'm even asking the question well enough, let me know if
      > not. But if anyone could give me some pointers, I'd greatly
      > appreciate it.
      >
      > Thanks!
      >
      > Dave
      >
    • Aug 13 2006 | 9:24 pm
      Nice! I always forget about those tex_plane_* attrs.
      wes
      On 8/13/06, Randy Jones wrote:
      >
      > You can use the tex_map attribute to apply a texture to any GL Group
      > object using the object's vertex coordinates. In this case the
      > incantation "tex_map 1, tex_plane_s 0.5 0 0 0.5, tex_plane_t 0 0.5 0
      > 0.5" should map a plane texture to the circle. Look at the HTML
      > reference to find out what all the tex_map modes do.
      >
      > HTH,
      > Randy
      >
      > On Aug 13, 2006, at 10:22 AM, Dave Della Costa wrote:
      >
      > > Hi folks,
      > >
      > > I've looked through the help files, tutorials, and even Andrew B.'s
      > > great online Jitter articles and I'm having no luck figuring this out.
      > >
      > > I'm trying to map a texture onto a jit.gl.gridshape circle, and it's
      > > being mapped differently than I want it to be mapped: instead of being
      > > wrapped around the circumference of the circle, I'd like it to be
      > > mapped
      > > from left to right, top to bottom (with the squared corners rounded
      > > off,
      > > essentially). I guess this is a polar to cartesian transformation I'm
      > > looking for, is that right? But I can't figure out how or where to
      > > apply that transformation.
      > >
      > > I'm unsure if I'm even asking the question well enough, let me know if
      > > not. But if anyone could give me some pointers, I'd greatly
      > > appreciate it.
      > >
      > > Thanks!
      > >
      > > Dave
      > >
      >
      >
    • Aug 15 2006 | 3:34 am
      Thank you Wesley and Randy--I ended up using Randy's suggestion, and
      this worked beautifully.
      Much appreciated--
      Dave D.
      Wesley Smith wrote:
      > Nice! I always forget about those tex_plane_* attrs.
      >
      > wes
      >
      > On 8/13/06, Randy Jones wrote:
      >>
      >> You can use the tex_map attribute to apply a texture to any GL Group
      >> object using the object's vertex coordinates. In this case the
      >> incantation "tex_map 1, tex_plane_s 0.5 0 0 0.5, tex_plane_t 0 0.5 0
      >> 0.5" should map a plane texture to the circle. Look at the HTML
      >> reference to find out what all the tex_map modes do.
      >>
      >> HTH,
      >> Randy
      >>
      >> On Aug 13, 2006, at 10:22 AM, Dave Della Costa wrote:
      >>
      >> > Hi folks,
      >> >
      >> > I've looked through the help files, tutorials, and even Andrew B.'s
      >> > great online Jitter articles and I'm having no luck figuring this out.
      >> >
      >> > I'm trying to map a texture onto a jit.gl.gridshape circle, and it's
      >> > being mapped differently than I want it to be mapped: instead of being
      >> > wrapped around the circumference of the circle, I'd like it to be
      >> > mapped
      >> > from left to right, top to bottom (with the squared corners rounded
      >> > off,
      >> > essentially). I guess this is a polar to cartesian transformation I'm
      >> > looking for, is that right? But I can't figure out how or where to
      >> > apply that transformation.
      >> >
      >> > I'm unsure if I'm even asking the question well enough, let me know if
      >> > not. But if anyone could give me some pointers, I'd greatly
      >> > appreciate it.
      >> >
      >> > Thanks!
      >> >
      >> > Dave
      >> >
      >>
      >>