Hello!
I came across this picture of spheres on the ground the color of a pepita already 30 years ago.
It is interesting that this was an 'image generating' program. It took a long time (even several minutes) to render the image.
What was interesting about the picture was that it followed the path of the light back. What we can see. He did not project an object onto the screen, but the display through which we see the image, he examined pixel by pixel by light reflection to see if he could find a light-emitting object. In this case, the light-emitting object is the ground and the sky. The Sphere we see is a reflective phenomenon. This entire graphical approach is called raytracing.
Many years ago, on the QB64 forum, someone rewrote this very old code, and the program painted a picture for us. I looked for the parts in the code that could be used to change the point of view and make the spheres move. I've simplified and combined everything I could find so that there is as little calculation as possible. The program worked on QB64.
An old image generation code that comes to life on the screen with the development of computer technology. After getting to know b4X, I rewrote the code so that it can also be run on a phone. Lots of calculations! A lot! I was curious.
Based on my experience, I feel that the phone performs math calculations quickly. What hinders the task is the 'engine' I use.
The display is done in such a way that a timer starts a 'sub' (three) at a specific interval. when drawing is finished, redraw. if not, skip it. Thus, the UI and movements are constant. The timer is constant, 60 FPS. And there will either be time to draw (if you have finished the previous one) or not (then skip it).
Rendering (threed) draws on a bitmapcreator. When you're done, you put it on the activity.
This is how it works. However, I noticed that a lot of time is spent not with mathematical calculations, but with drawing a pixel.
Only the 'three' library needs to be attached to the program, I have included it!
I would like to ask what is the fastest pixel drawing solution. Canvas is slow. Bitmaprecreator is functional but takes a lot of time. What trick could I use to load a bitmap with new pixels as quickly as possible. Draw a pixel directly on the screen?
I came across this picture of spheres on the ground the color of a pepita already 30 years ago.
It is interesting that this was an 'image generating' program. It took a long time (even several minutes) to render the image.
What was interesting about the picture was that it followed the path of the light back. What we can see. He did not project an object onto the screen, but the display through which we see the image, he examined pixel by pixel by light reflection to see if he could find a light-emitting object. In this case, the light-emitting object is the ground and the sky. The Sphere we see is a reflective phenomenon. This entire graphical approach is called raytracing.
Many years ago, on the QB64 forum, someone rewrote this very old code, and the program painted a picture for us. I looked for the parts in the code that could be used to change the point of view and make the spheres move. I've simplified and combined everything I could find so that there is as little calculation as possible. The program worked on QB64.
An old image generation code that comes to life on the screen with the development of computer technology. After getting to know b4X, I rewrote the code so that it can also be run on a phone. Lots of calculations! A lot! I was curious.
Based on my experience, I feel that the phone performs math calculations quickly. What hinders the task is the 'engine' I use.
The display is done in such a way that a timer starts a 'sub' (three) at a specific interval. when drawing is finished, redraw. if not, skip it. Thus, the UI and movements are constant. The timer is constant, 60 FPS. And there will either be time to draw (if you have finished the previous one) or not (then skip it).
Rendering (threed) draws on a bitmapcreator. When you're done, you put it on the activity.
This is how it works. However, I noticed that a lot of time is spent not with mathematical calculations, but with drawing a pixel.
Only the 'three' library needs to be attached to the program, I have included it!
I would like to ask what is the fastest pixel drawing solution. Canvas is slow. Bitmaprecreator is functional but takes a lot of time. What trick could I use to load a bitmap with new pixels as quickly as possible. Draw a pixel directly on the screen?