Mini-Ray Raytracer

miker1264 · 6692

Amiwell

  • Legendary Member
  • *****
    • Posts: 2616
    • Karma: +35/-4
  • Peace
Reply #15 on: June 29, 2021, 10:13:15 AM
thank you miker :)



miker1264

  • Legendary Member
  • *****
    • Posts: 1827
    • Karma: +84/-6
Reply #16 on: June 29, 2021, 11:37:14 PM
Raytracer Test Program in action. It compiles in C code for x86_64.



paolone

  • Legendary Member
  • *****
    • Posts: 569
    • Karma: +90/-0
Reply #17 on: June 30, 2021, 02:12:03 AM
@Miker


Great work as usual! Thank you for keeping us updated about this.


Argo

  • Junior Member
  • **
    • Posts: 75
    • Karma: +46/-0
  • Argo
    • Find me on the Fediverse
Reply #18 on: June 30, 2021, 02:55:13 AM
Nice, This will be great to have on AROS



AMIGASYSTEM

  • Global Moderator
  • Legendary Member
  • *****
    • Posts: 3755
    • Karma: +69/-2
  • AROS One
    • AROS One
Reply #19 on: June 30, 2021, 03:12:53 AM
miker great tool, AROS One will be happy to host it   :)

For Mini-Ray Raytracer I made a News on Amiganews.it, i will make it on EAB later, hope you like it. ;)


Amiwell

  • Legendary Member
  • *****
    • Posts: 2616
    • Karma: +35/-4
  • Peace
Reply #20 on: June 30, 2021, 07:31:33 AM
I'm happy miker having fun while you apply to the development of the program :)



miker1264

  • Legendary Member
  • *****
    • Posts: 1827
    • Karma: +84/-6
Reply #21 on: June 30, 2021, 08:59:14 PM
You may think that over the last few days I have miraculously written a complete raytracer that actually works. But in reality that isn't the case. I was prepared to write it from scratch but raytracers are by nature complicated pieces of software. It seems there are many samples of raytracers available, though. However, they are nearly all written in C++ which doesn't fit my needs for a working raytracer for AROS.

Mini-Ray was one such simplistic C++ version of raytracer that contained everything in one module - "raytracer.cpp". I've been looking at that code wondering first how to convert it to C code, then how to expand it to actually render polygon meshes with lots of triangles. Yesterday I discovered a simple raytracer written in C code that seemed to have all the qualities needed.

But there is still plenty of hard work to do to make it into a nice AROS-friendly graphics application. It needs to run from Workbench and it needs a menu system and much more.
« Last Edit: July 01, 2021, 12:35:55 AM by miker1264 »



Amiwell

  • Legendary Member
  • *****
    • Posts: 2616
    • Karma: +35/-4
  • Peace
Reply #22 on: July 01, 2021, 05:16:28 AM
i understand miker



miker1264

  • Legendary Member
  • *****
    • Posts: 1827
    • Karma: +84/-6
Reply #23 on: July 02, 2021, 04:41:39 PM
i understand miker

The raytracer being worked on now I ported from Mac OS (x-code) for use on AROS. Not everything was compatible.

It took about 5 hours to make it work correctly. I must have tried to compile it about two dozen times. It was setup to use Png Library or "cmfts" or something like that for display purposes.

But it wasn't as much "display" as it was "saveToFile. So I re-wrote all of that. Now it uses "ppm_render" which saves directly to ppm which AROS pnm datatype can read. Next I will work on a menu system and try to get the polygon mesh to render.
« Last Edit: July 02, 2021, 04:45:25 PM by miker1264 »



Amiwell

  • Legendary Member
  • *****
    • Posts: 2616
    • Karma: +35/-4
  • Peace
Reply #24 on: July 03, 2021, 05:46:38 AM
ok miker well, i'm happy :)



Amiwell

  • Legendary Member
  • *****
    • Posts: 2616
    • Karma: +35/-4
  • Peace
Reply #25 on: July 04, 2021, 07:49:16 AM
Miker are working on an module Raytracer open source?



miker1264

  • Legendary Member
  • *****
    • Posts: 1827
    • Karma: +84/-6
Reply #26 on: July 04, 2021, 09:14:14 AM
Miker are working on an module Raytracer open source?

Yes. Salvo.

The Raytracer sources will be available as open source. I'm currently fixing the rendering process for polygon meshes. It seems to be seriously broken! I may need to re-write much of the rendering code to make it work. It's not an easy task.



Amiwell

  • Legendary Member
  • *****
    • Posts: 2616
    • Karma: +35/-4
  • Peace
Reply #27 on: July 04, 2021, 11:47:15 AM
Excuse me but you are working on Raystorm sources or something else



miker1264

  • Legendary Member
  • *****
    • Posts: 1827
    • Karma: +84/-6
Reply #28 on: July 04, 2021, 02:46:21 PM
Excuse me but you are working on Raystorm sources or something else

I will likely refer to RayStorm sources as a guide for reading and writing SCN Project Files and for Import and Export of 3DS Files.
For the rest of the raytracer I am using other raytracer sources that are written in C code. That makes things easier.

There is still a problem with rendering 3D Polygon Mesh. It now loads the vertices and triangles from the txt file correctly, though I had
to double the buffer size for each. It was hard-coded at 1500 each which was much too small causing an error. I will need to automate
the buffer size allocation by counting lines in the text file. That will alleviate the size allocation problem in the future for polygon meshes.

Since it fails to render the polygon mesh correctly and only returns colors very similar to the background color I suspect that the problem
may be an error in the Triangle Intersection Algorithm. It fails to detect an intersection with the polygon surface so it returns the background.

https://www.scratchapixel.com/lessons/3d-basic-rendering/ray-tracing-rendering-a-triangle/ray-triangle-intersection-geometric-solution
« Last Edit: July 04, 2021, 06:37:18 PM by miker1264 »



Amiwell

  • Legendary Member
  • *****
    • Posts: 2616
    • Karma: +35/-4
  • Peace
Reply #29 on: July 05, 2021, 05:23:23 AM
I understand miker, you're doing an excellent job, you're definitely developing everything from the beginning, if you want on aminet there is a source of a program that makes use of wazp3d I don't know if it is written in c however it is a complete rendering program, of course it's not blender but her work is very well :)

https://aminet.net/gfx/3d/Skulpt_doc.lha
https://aminet.net/gfx/3d/Skulpt_src.lha