Mini-Ray Raytracer

miker1264 · 6677

miker1264

  • Legendary Member
  • *****
    • Posts: 1827
    • Karma: +84/-6
on: June 26, 2021, 01:01:23 PM
For the benefit of those, like myself, who are interested in raytracers for AROS this is for you.

A few years ago I looked at RayStorm as a basis for a Raytracer for use with AROS. Fast forward till the present day. I have a new conceptual approach. Hopefully, over the last five years my AROS C programming skills have improved. Also, knowing how I work best to develope new applications this is my proposed approach to the issue of providing a raytracer for use in AROS.

I will do all the research up front about raytracers and document everything. Then I will independently put together a Raytracer Application for rendering 3D scenes. I will use RayStorm as just one part of my research for a more comprehensive approach to raytracing. I will also study 3D Object files (scene files) from 3D Studio, 3D Studio Max, Maya,  Alladin, Cinema, and even Blender.

I have set up a test application called Mini-Ray to help study raytracing. It will be a modular approach to raytracing. I will set up an application with a simple GUI that allows to render a selection of built-in scenes or the ability to load external 3D Object files such as .3DS, .MAX, .SCN, etc. At first it will incorporate just one Raytracer Engine such as Mini-Ray. But eventually it may include other Raytracer Engines such as the Blender Engine. With a modular approach it would be easier to add Raytracers and 3D Object File Readers.

After I do my research and put together the Raytracer Application then the code will be available for anyone else interested in developing raytracers for use with AROS.

Happy coding  ;)



Amiwell

  • Legendary Member
  • *****
    • Posts: 2616
    • Karma: +35/-4
  • Peace
Reply #1 on: June 27, 2021, 05:41:50 AM
Thanks miker all seems very interesting, thanks for your support I think Aros users will be very happy with what you will do again :)



serk118uk

  • Member
  • ***
    • Posts: 187
    • Karma: +67/-0
Reply #2 on: June 27, 2021, 06:57:04 AM
Thanks miker1264..

Lets Build Not Destroy...


miker1264

  • Legendary Member
  • *****
    • Posts: 1827
    • Karma: +84/-6
Reply #3 on: June 27, 2021, 08:31:25 AM
Thanks miker1264..

Scratchapixel.com has an interesting article that describes Raytracing.

Raytracing is a method that is based on human perception. It is a series of algorithms (the raytracing engine) that uses principles of mathematics and physics to trace the rays of light from a light source to a series of objects (the scene). The raytracer calculates and predicts collisions of photons with surfaces. It also accounts for textures and materials to predict shadowing as well as reflection and refraction.

The degree of fine detail based on these things determine the quality of the raytracer itself. The 3D Objects stored in Scene Files are loaded into the raytracer application as 3D Vectors.

It's all derived from a complex set of mathematics that predict and calculate 3D Pixels ( voxels maybe) that are then converted to 2D Pixels forming a rendered image.



Amiwell

  • Legendary Member
  • *****
    • Posts: 2616
    • Karma: +35/-4
  • Peace
Reply #4 on: June 27, 2021, 10:50:50 AM
very well miker 8)



miker1264

  • Legendary Member
  • *****
    • Posts: 1827
    • Karma: +84/-6
Reply #5 on: June 27, 2021, 02:40:50 PM
I have a complete concept for the raytracer application. I'm satisfied with it.

As I mentioned, a few years ago I was doing research for a raytracer based in part on concepts from  RayStorm. I'd like to re-use much of that for the new project, especially the app icon and the artwork. In a tribute to RayStorm whose initials are R.S. I'd like to include them but in reverse and the word 'Ray' in a new application. So the name will be 'SunRay Raytracer'. The app icon is a gold ball with the word 'RAY'. The Logo is an image of Sun Rays spreading out towards the horizon like a Starburst Symbol on an Amiga Blue Background. In the middle of the rays will be a Star Symbol representing the Sun itself. That's it. SunRay Raytracer.  8)

Since it is basically a Complex Grahics Program that uses a Raytracer Engine to render 2D Images based on 3D Object Files it will in many ways resemble other AROS graphics programs.

It will use it's own screen and it will be modular in design based on MUI. When fist opened the 'Main Module' will appear which will be a Button Menu that is intended to resemble Lightwave ButtonBar Menus. There will be a few important modules including Project Module, Render Module, and Convert Module. Each module can be accessed from the Main Button Menu or from the System Menu. The Convert Module will use Picture Datatypes to convert images for use with the Rendered PPM.

Although the user may select the output image dimensions all rendered images will be temporarily saved as PPM and they will display in a Viewer Window with a separate Menu attached. The temp image must be saved or it will be deleted at render time.

The basic internal scene file format may use the IFF-based .SCN File which RayStorm uses to store 3D Scenes. Other 3D Object Files from 3D Modelers such as Lightwave or Blender can be Imported and saved as IFF-SCN Files. Also, SCN Files can in turn be Exported as 3D Object Files in various formats for 3D Modelers such as Lightwave or Blender to use for rendering.

Attached here is the App Icon.
« Last Edit: June 27, 2021, 07:53:21 PM by miker1264 »



miker1264

  • Legendary Member
  • *****
    • Posts: 1827
    • Karma: +84/-6
Reply #6 on: June 27, 2021, 07:54:16 PM
Here is the artwork for new Sun-Ray Logo.  8)



miker1264

  • Legendary Member
  • *****
    • Posts: 1827
    • Karma: +84/-6
Reply #7 on: June 27, 2021, 08:23:54 PM
Here is the first rendered PPM Image from MiniRay Test Program. It is based on 3D Vector Data.

The MiniRay Program will be used to develope and test all the working code for the raytracer.

At the moment MiniRay is only compiled for use with x86. But soon I will compile it for x86_64.

The very fist component to be developed and tested will be the Viewer Window with its own menu. Picture Datatypes can be used to convert the temp PPM file to any supported picture type.

Once the MiniRay Program is sufficiently advanced the functons and components will be moved to the MUI based Sun-Ray Raytracer Application.
« Last Edit: June 27, 2021, 08:39:35 PM by miker1264 »



miker1264

  • Legendary Member
  • *****
    • Posts: 1827
    • Karma: +84/-6
Reply #8 on: June 27, 2021, 08:35:53 PM
The Sun-Ray Raytracer Logo.



Amiwell

  • Legendary Member
  • *****
    • Posts: 2616
    • Karma: +35/-4
  • Peace
Reply #9 on: June 28, 2021, 06:03:45 AM
I'm happy how work is proceeding, surely there are many users who are appreciating your work :)



miker1264

  • Legendary Member
  • *****
    • Posts: 1827
    • Karma: +84/-6
Reply #10 on: June 28, 2021, 05:43:33 PM
I'm happy how work is proceeding, surely there are many users who are appreciating your work :)

Clearly taking on the task of writing a 3D Rendering Program for AROS seems like it could become such a daunting experience, especially when looking at all the 3D Vectors and strange mathematical equations.

I thought I had left algebra, trigonometry and physics back in my school days! Nope. Here it is again. But my philosophy is to start out small with something that works and gradually add complexity and functionality.

Maybe I will learn some valuable lessons as well. Never too old to learn new things!  ;)

As an inspiration to get the raytracer to the point of loading 3DS and PRJ files and rendering the scenes I was looking for my old zip disk archives for my old projects. I had two 3D Studio projects that I remember most. One was KEROLAMP.3DS which was a kerosene lamp with transparent glass. The other was MARBVASE.3DS which was a green marble vase with black legs sitting on a wooden table. I didn't find the rendered Targa images for them. But I found the 3DS Object Files. They are begging me to finish the raytracer so I can save new Targa images!  :) :) :)
« Last Edit: June 28, 2021, 07:20:12 PM by miker1264 »



miker1264

  • Legendary Member
  • *****
    • Posts: 1827
    • Karma: +84/-6
Reply #11 on: June 28, 2021, 11:48:10 PM
That's what I have to reproduce in the Raytracer in AROS.



Amiwell

  • Legendary Member
  • *****
    • Posts: 2616
    • Karma: +35/-4
  • Peace
Reply #12 on: June 29, 2021, 04:09:20 AM
well miker :)



Amiwell

  • Legendary Member
  • *****
    • Posts: 2616
    • Karma: +35/-4
  • Peace
Reply #13 on: June 29, 2021, 04:18:20 AM
Congratulations Miker you are doing an excellent job, you never end up learning if you are inclined towards certain attitudes, it becomes a whole game and you have fun, to me Aros puts a smile and I thank those who contributed and those who contribute like you all now both for the development of the system and for third-party programs, we have a considerable music park at musical level for example, we hope to increase it with time, meanwhile thanks ;)



miker1264

  • Legendary Member
  • *****
    • Posts: 1827
    • Karma: +84/-6
Reply #14 on: June 29, 2021, 09:44:52 AM
Congratulations Miker you are doing an excellent job, you never end up learning if you are inclined towards certain attitudes, it becomes a whole game and you have fun, to me Aros puts a smile and I thank those who contributed and those who contribute like you all now both for the development of the system and for third-party programs, we have a considerable music park at musical level for example, we hope to increase it with time, meanwhile thanks ;)

Having a clearly stated goal provides great motivation. I installed 3D Studio R4 in DOSBox to render this Targa Image. It works great and the renders are super fast compared to the original. When I used 3DS R4 in school in 1994 I remember the renders took up to 30 minutes. Now in DOSBox in emulation it takes 14s so I expect a similar increase in the render speed for Sun-Ray compared to Amiga RayStorm or even Lightwave.

Working on datatypes and the like is what I do to help improve AROS. But working on the Raytracer is what I will do for fun!  ;)
« Last Edit: June 29, 2021, 09:52:15 AM by miker1264 »