Pixel COP: modifying individual pixel positions

   3825   2   0
User Avatar
Member
27 posts
Joined: July 2005
Offline
Hi all,

I'm trying to make a center filter for my real world camera to correct for cos^4 light falloff. My first thought was to do it in C, but I wanted to give Houdini a try first. I piped a 400x500 white tiff into a Pixel COP with the expression: 1.77-pow(cos(sqrt(pow(($X+20*(rand(1)-.5)-$W/2),2)+pow(($Y+20*(rand(2)-.5)-$H/2),2))/15),4). The noise on the X, Y coordinates is to reduce the appearance of concentric rings in 8-bit mode. The problem is, the noise is being pre-added to the entire set of coordinates, shifting the filter around and doing nothing to reduce the appearance of rings. What I want is more like:

for (each pixel) {
randomly shift X, Y;
this pixel color = function(shiftedX, shiftedY);
}

I suspect this is an SIMD issue, so I'm not sure if it would be easily fixed in VEX. Any suggestions?
User Avatar
Staff
2591 posts
Joined: July 2005
Offline
mikela
Hi all,

I1.77-pow(cos(sqrt(pow(($X+20*(rand(1)-.5)-$W/2),2)+pow(($Y+20*(rand(2)-.5)-$H/2),2))/15),4).


I suspect this is an SIMD issue, so I'm not sure if it would be easily fixed in VEX. Any suggestions?

The argument to the rand() function is the seed (which can be floating point), thus, the same random value is being chosen for each pixel in the image. You can probably fix this by changing the rand to be “rand($X + $Y*1000)” or something like that…

VEX would probably process this a whole lot faster than the pixel COP.
User Avatar
Member
27 posts
Joined: July 2005
Offline
a belated thank you for that. Problem fixed! I guess I just needed a second set of eyes on that one.

Mike
  • Quick Links