Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Projecting a 3d sphere into a 2d circle on the screen

What are some rasterization algorithms that can just project a 3d sphere into a pixel grid? I want to avoid ray casting. Essentially, given a 3d coordinate and a radius, is there a quick way to just create a 2d circle/ellipse on a pixel grid?

For example: circle at (2,2,2) with radius 4 gets projected to five pixels: p1(2,0)p2(0,1) p3(1,1) p4(2,1)p5(1,2)

I have come across techniques such as pixel splatting for particle systems but I haven't found a clear answer on how to do this.

Thanks


1 Answers

What projection do you have?

I'm quite sure the projection isn't a circle in the most interesting ones. Hm. I guess the way I would do it would be to find the circumference circle in 3d whose axis* is aligned to the camera point. Pick whatever points needed from the circle and then transform them to screen space. Most simply, that would give you a polygon, but interpolated splines should probably also give you nice results.

*: axis of rotational symmetry

like image 155
Anders Eurenius Avatar answered Oct 27 '25 06:10

Anders Eurenius



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!