This is something I learned at dreamworks awhile back to do pscale to pixel calulations from camera.
it creates a uv on the particles coming in on the second input then used the cameras info to calculate the pscale at a pixel level.
“`//get camera details float aperture = chf(“aperture”); // ch(chsop(“../camera”) + “/aperture”) float focal = chf(“focal”);’ // ch(chsop(“../camera”) + “/focal”) float resolution = chf(“resolution”); // ch(chsop(“../camera”) + “/resx”)+1 / 1 float pixel_width = chf(“pixel_width”); // ch(“../paticle_pixel_size”) // this gets used to increase or decrease based on a pixel default of 1 is set to 1 pixel
//get uv camera vector camUV = point(1,”uv”,@ptnum);
float uvZ = camUV.z;
//calculate camera scale
float cameraScale = (aperture/focal/resolution) ;
//set new pscale if(ch(“../pscale_operation”)==0) f@pscale = uvZ * cameraScale * (pixel_width*.5);
//multiply pscale
if(ch(“../pscale_operation”)==1) f@pscale *= uvZ * cameraScale * (pixel_width*.5); “`
Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20265902/20/26/nxplayer.bin_96rUEVP4Kb.png
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20265902/20/26/nxplayer.bin_naczKWgDws.png