Lazarus

Programming => Graphics => Graphics and Multimedia => BGRABitmap and LazPaint => Topic started by: bigeno on March 19, 2019, 07:51:12 pm

Title: 3D cube/phong
Post by: bigeno on March 19, 2019, 07:51:12 pm
I know how to paint phong, all good, but can you give me hint how to paint phong cube ? rounded edges like on second image
Title: Re: 3D cube/phong
Post by: circular on March 19, 2019, 11:39:56 pm
I would suggest to do it using a 3D scene.
http://wiki.freepascal.org/BGRABitmap_tutorial_15

Though not sure about the exact shape in 3D. It is kind of round rectangle that has a certain height, and at the top there is yet another rounding.

Note that you don't need to have a lot of polygons to have a nice rounded phong lighting. See for example in bgrabitmap/test/bgratutorial3d the cylinder (example 3). By setting scene.DefaultLightingNormal to lnVertex you get a rounded effect even with low polygon count.
https://github.com/bgrabitmap/bgrabitmap/tree/master/test/bgratutorial3d