Skip to Content

After years of contemplating about my first blog entry, I finally came up with something which I believe is worth writing about, but of cause, you the audience, will decide that.

 

Here it goes …

I am going to write a “Ray Tracer” with ABAP and during this ride I gonna let you sit right next to me.
You might ask yourself what a ray tracer is, but before I gonna answer that, I tell you …

 

A little bit about my myself

I popped into the whole SAP show back in the beginning of 2013.
Before that, I was happily coding away in the computer animation industry (often called CGI), mainly creating tooling and pipeline stuff for film production studios.
At that time, the term “consultant” was as vague as it gets to me and the word ABAP sounded more like a baby noise.

Here I am now, earning my bread and butter with writing ABAP in the retail world.

I fancy clean, beautiful, structured code. I am a big believer in unit tests, continuous integration, and the whole Robert C. Martin prayers.

 

So what is a ray tracer?

A ray tracer is a piece of software which converts a mathematical abstraction into pixel information.
Wow, that sounds … abstract.

I gonna give it another shot, more focused on my use-case.
A ray tracer is a piece of software which calculates (renders) a 3D mathematical representation of lights, surfaces, textures into a 3D looking image.

Good old Wiki says:

In computer graphics, ray tracing is a technique for generating an image by tracing the path of light as pixels in an image plane and simulating the effects of its encounters with virtual objects.

The technique is capable of producing a very high degree of visual realism, usually higher than that of typical scanline rendering methods, but at a greater computational cost. 

This makes ray tracing best suited for applications where the image can be rendered slowly ahead of time, such as in still images and film and television visual effects, and more poorly suited for real-time applications like video games where speed is critical.

Ray tracing is capable of simulating a wide variety of optical effects, such as reflection and refraction, scattering, and dispersion phenomena (such as chromatic aberration).

Now we are talking!

And thats what these things can spit out:

Source: Wikipedia

But to lower your expectations, you gonna wait a long time until my ray tracer is able to pick up that game.

 

Why do I write a ray tracer?

This dates back to the beginning of 2011. I moved for eight month to Sydney and managed to catch a development job at a film studio doing CGI.

A group of my team worked their way through a book. Each week they presented in turns to each other the next chapter.
Pretty cool – my employer was giving them a fixed amount of time per week to follow this project during working hours.
The book they took on was “Ray Tracing from the Ground Up” by Kevin Suffern.
That guy turned out to be a professor at the university of Sydney and a fair amount of my colleagues studied under him.

Source: Amazon

I was fascinated by the prospect of writing my own renderer that time, and the idea stuck with me, but also went onto my long long list of books and “techy” things to do… until recently.

I figured I am ready for the challenge. I wanna get my hands dirty and understand the design, the math, the magic behind a ray tracer.

 

Why do I write it with ABAP?

Why not 🙂 Cause ABAP is slow/unsuited for that kind of work! That’s certainly true, but I am not gonna break any performance benchmarks anyway.
I believe, it is an excellent opportunity to improve my ABAP skills, especially in the performance domain.
Ray tracing is CPU and memory intensiv, and I am eagerly waiting for the moment to measure, analyse and refactor my code and learn a thing or two from that.
Also the code conversion from C++ to ABAP will bring me some insights, as that book uses C++ for writing the ray tracer.

 

What’s in it for you?

  • You can gain a deeper understanding of how a ray tracer works, also you might brush up your math on the way.
  • You will learn about differences between C++ and ABAP, similar as Jerry Wang did that in a couple of his articles regarding Java, JavaScript and ABAP differences.
  • You will get to see some “nice” images. And I am not talking about SAP GUI screenshots, so relax, I mean rendered ones.
  • Well, and if all fails, then hopefully you have at least a fun read.

 

So how do we go from here?

Development-vice, I am actually a bit ahead compared to this blog.
I needed to see if I get that thing pulled off before I get someone, including myself, excited. 🙂

I totally discourage you to take a sneak-peak, but if you have to, the first code/renders are here:
https://github.com/pixelbaker/ABAP-RayTracer

Next blog will be about:

  • the project infrastructure
  • some C++ language features which ABAP is missing
  • some math
  • and the first rendered images

 

Until then.

Cheers,
André

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply