Thank you for this, I've been studying it for a bit... I have a coupla questions... First, why does it only display a center cut rectangle of the full image. Why when I put it in a Render in Image node does it sort of work, but then comes off its wheels and starts displaying random noise? (It does show the full image when I feed the Render In Image node into a Billboard).
Last but not least... How does it work? I've looked at the code and it seems so simple. The Fragment code just feeds all pixels out to the Vertex code and it does some tiny magic, and then boom, there it is. Thank you very much, Patrick On Jan 20, 2011, at 2:11 PM, Achim Breidenbach wrote: > Hello Patrick, > > find attached my version of your CI Kernel as GLSL shader. There are only 4 > pixel reads per "size" square. Anyways the performance increase is not as big > as I would have expected. > > best, > > Achim Breidenbach > Boinx Software > > <triangles1 (Achim).qtz> > > > On 20.01.2011, at 00:04, Patrick Sheffield wrote: > >> Sorry, I meant to change the Subject: line... >> >> Here's an example, I just tossed an image into the image input. And I'm not >> entirely sure I got my coordinates and interpolations correct, but it's sort >> of like this. >> >> Thank you for your help... >> >> Patrick >> >> <triangles1.zip> >> >> On Jan 19, 2011, at 1:12 PM, Achim Breidenbach wrote: >> >>> Hi Patrick, >>> >>> you can use a "GLSL Grid"- patch to generate the a vertices grid. In the >>> vertex code you can read in the pixel color from your image and put them >>> into a varying vec4 variable. that gets interpolated by hardware for each >>> pixel calculated by the fragment shader. Do you have an example composition >>> where we can see what the result should look like? >>> >>> best, >>> >>> Achim Breidenbach >>> Boinx Software >>> >>> On 19.01.2011, at 21:14, Patrick Sheffield wrote: >>> >>>> >>>> Is there a way in Quartz Composer to draw a (right) triangle of size X >>>> that is Gouraud or Smooth shaded between the 3 specified corner values. >>>> Actually, I will want to draw an entire "sheet" of them, but I'll start >>>> with just one. >>>> >>>> I can do so with a CI Kernel program, but it involves a silly amount of >>>> math interpolating the coloration between the vertices, especially when I >>>> am sure this can be done in hardware... >>>> >>>> As an FYI, here's the CI Kernel code - feeding it an image with the RGB >>>> values pre-plugged at size intervals. It's not efficient to be doing 4 >>>> texture reads for each pixel, then interpolating to determine the color... >>>> >>>> Any thoughts? thanks, >>>> >>>> Patrick >>>> >>>> kernel vec4 triangle(sampler image, float size) >>>> { >>>> vec2 uv = samplerCoord(image); >>>> vec2 auv = floor(uv/size) * size; >>>> vec2 duv = auv + size; >>>> vec2 buv = vec2(duv.x,auv.y); >>>> vec2 cuv = vec2(auv.x,duv.y); >>>> >>>> vec2 s = mod(uv, size); >>>> >>>> vec3 a = sample(image, auv).rgb; >>>> vec3 b = sample(image, buv).rgb; >>>> vec3 c = sample(image, cuv).rgb; >>>> vec3 d = sample(image, duv).rgb; >>>> >>>> vec3 pix = (s.x + s.y) < size ? >>>> mix(mix(a, b, s.x/(size-s.y)), c, s.y/size) >>>> : >>>> mix(b, mix(c, d, (s.x-(size-s.y))/(size-(size-s.y))), s.y/size); >>>> >>>> return vec4(pix,1.0); >>>> >>>> } >>>> >>>> _______________________________________________ >>>> Do not post admin requests to the list. They will be ignored. >>>> Quartzcomposer-dev mailing list (Quartzcomposer-dev@lists.apple.com) >>>> Help/Unsubscribe/Update your Subscription: >>>> http://lists.apple.com/mailman/options/quartzcomposer-dev/achim%40boinx.com >>>> >>>> This email sent to ac...@boinx.com >>> >> > _______________________________________________ Do not post admin requests to the list. They will be ignored. Quartzcomposer-dev mailing list (Quartzcomposer-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com