Jump to content

Pixel size SOP


kleer001

Recommended Posts

if you render points, each point have PSCALE attribute (if attribute doesn't exist, default value is 0.01) which define how large "sphere" or circle will be.at render time.

 

Mathematical point have no size so it would be invisible. So your question is incomplete.  Better question would be How large area is covered by single rendered pixel at some distance from camera in camera projection space?

 

U can visualize that. Create some noise pattern in photoshop that each pixel have noticeable different color, save it, and use it as projection texture from your camera.on grid which is parented to that camera and oriented to be perpendicular to it. In quick shading mode with constant shading option you will see that patern on the grid in viewport.  Now if you move that grid along Z axis away from cam and look it from user view (not from projecting camera)  you will see pixels increases when you muve it away from cam. Thats the size of pixel at that specific distance. Also notice if you are looking through projected cam doesnt matter how grid is away from it you can not see pixels change it's size because you are looking through camera projected space.

Link to comment
Share on other sites


string cam = "/obj/cam1";

vector res = chv(cam + "/res");

float aperture =  chf(cam + "/aperture");

float focal =  chf(cam + "/focal");

vector pos = ptransform(cam,@P);

float pxwidth = length(pos)*aperture/focal/res.x;

f@pscale = pxwidth / 2.0; // use half of pixel width if pscale is radius otherwise use just pxwidth

  • Like 5
Link to comment
Share on other sites

  • 2 weeks later...

That is a simple cam projection (like viewport) calculation and it doesn't take into account lens parameters like focus distance, f-stop, circle of confusion, lens distortion which rendered pixel size at some distance depends on them too. It will give you results at SOP level related to viewport cam (that is probably only you want)  but If you are writing your custom DOF shader or COP VOP node and you need rendered pixel real size at some distance you will have to include math with those parameters too.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...