Jump to content

How big is a point?


Macha

Recommended Posts

I want to set points to a minimum size so that they will never be smaller than a pixel.

What is the best way of doing this?

I assume I take the distance to the camera-plane (uv texture z) and then find out how big a pixel would be if moved at that distance?

Any objections? Better ways?

Like this?

http://en.wikipedia.org/wiki/Angular_diameter

Edited by Macha
Link to comment
Share on other sites

Real size doesn't matter so much because I can scale. As long as I have a consistent base-scale relative to pixelsize it's OK.

I am trying to avoid rendering artifacts when points get too small. I want them to have a minimum size that relates to the pixelsize.

Edited by Macha
Link to comment
Share on other sites

I think a transform to camera space and division by z in a vopsop would suffice.

If you want to get fancy, you could try and offset the extra area resulting from the clamping by decreasing alpha accordingly.

Link to comment
Share on other sites

I believe this works, trying to get the angular size of a pixel (circle enclosing the pixel) and then converting to real size.

-UV texture camera. 3rd component is distance to camera plane

-pscale = tan(((arctan((aperture*0.5)/focal)*2)/resx)*0.5)*distance*2

At least, when I render it gives a likely result, each sphere retaining a constant size.

Edit: Oh, missed that Eetu. I'll have a go and try it.

Edited by Macha
Link to comment
Share on other sites

awesome concept. this would net the best possible render.

would you also use this technique to maintain a visual density? for example a cloud of points has a visual density of 50% when rendered at 1000px x 1000px.

that same cloud when rendered at 100px x 100px would still try to render all points, but now the cloud is opaque.

for a truly procedural approach to maintain the 'feel' of the effect as you render at higher or lower dimensions you would have to ignore some of the points at rendertime.

this would also give the advantage to look development at low resolutions.

Link to comment
Share on other sites

I'll have a little twist to this: How could we get size of any object in the scene in terms of pixels?

Edit: Wait...that should be this then..in inline vex...right, if pscale is the object bounding sphere size?

float pixeldiameter,
      objectdiameter;

$pixeldiameter = (2*atan($aperture/(2*$focal)))/$resx;

$objectdiameter = 2*asin(0.5*$pscale/$distance);

$out = $objectdiameter / $pixeldiameter ;


I"m not sure...it doesn't look obviously wrong when I try it. I'm trying to compare the angular size of a pixel with that of the object (bounding sphere). If $out falls below 1 then it's smaller than a pixel. Maybe.

and to just get relative pixelsize at distance from camera:

float pixeldiameter,
      pixeldiameterFar;

$pixeldiameter = (2*atan($aperture/(2*$focal)))/$resx;

$pixeldiameterFar = 2*$distance*sin($pixeldiameter/2);

$out = $pixeldiameterFar;

Edited by Macha
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...