Oh I see. I thought dst() was a float, and that the blink would run once for each channel. That's why I was extracting a single float value as r. Will try again, thanks.
On Dec 30, 2016 4:02 AM, "Mads Lund" <madshl...@gmail.com> wrote: > Looks like you are trying to put your float3 into dst() (which is a > float4). > Maybe you should break it up like this: > dst() = float4(r.x,r.y,r.z,1.0f) > > On Fri, Dec 30, 2016 at 3:17 AM, Erwan Leroy <er...@erwanleroy.com> wrote: > >> Hey Guys, >> I ran into this problem with blinkscript, I know this mail list is for >> python but you guys may have some insights. >> >> Basically the following script runs just fine (sorry about the stripped >> indentation) >> >> // Sample Data >> inline float4 sample( int index ) >> { >> >> float4 sampleData[3] = { >> >> {0.1f, 0.2f, 0.3f, 0.0f}, >> >> {0.4f, 0.5f, 0.6f, 0.0f}, >> >> {0.7f, 0.8f, 0.9f, 0.0f} >> >> }; >> >> return (float4)(sampleData[index]); >> >> }; >> >> kernel testTable : ImageComputationKernel<ePixelWise> >> { >> >> Image<eRead, eAccessPoint, eEdgeClamped> src; >> >> Image<eWrite> dst; >> >> //The kernel function is run at every pixel to produce the output. >> >> void process() { >> >> float r; >> >> r = sample(2)[0]; >> >> >> // Output the color >> >> dst() = r; >> >> } >> >> }; >> >> >> >> >> However my real data sample is float 3 (x,y,z coordinates) but the code >> with float3 errors when I try to compile: >> >> >> // Sample Data >> inline float3 sample( int index ) >> { >> >> float3 sampleData[3] = { >> >> {0.1f, 0.2f, 0.3f}, >> >> {0.4f, 0.5f, 0.6f}, >> >> {0.7f, 0.8f, 0.9f} >> >> }; >> >> return (float3)(sampleData[index]); >> >> }; >> >> kernel testTable : ImageComputationKernel<ePixelWise> >> { >> >> Image<eRead, eAccessPoint, eEdgeClamped> src; >> >> Image<eWrite> dst; >> >> //The kernel function is run at every pixel to produce the output. >> >> void process() { >> >> float r; >> >> r = sample(2)[0]; >> >> // Output the color >> >> dst() = r; >> >> } >> >> }; >> >> >> >> I tried many different syntaxes, but always run into the same problem, >> and I can't seem to find the proper documentation for the language, I'm >> looking at C++ and OpenCL docs but some stuff is different. >> >> >> Any pointers? >> >> Thanks >> >> >> >> *Erwan* LEROY >> www.erwanleroy.com >> >> _______________________________________________ >> Nuke-python mailing list >> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ >> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python >> >> > > _______________________________________________ > Nuke-python mailing list > Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > >
_______________________________________________ Nuke-python mailing list Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python