Not logged in, Join Here! or Log In Below:  
News Articles Search    

Submitted by Thomas Mathys, posted on August 24, 2000

Image Description, by Thomas Mathys

this is some project for school. we can code almost anything in any language, so i decided to code a raytracer in c++. it is the first version that is able to display something nice, but there's still a lot to do (more shapes, 3d textures, boolean objects, maybe some speed omtimizations...)

thomas mathys

Image of the Day Gallery


Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

August 24, 2000, 09:19 AM

Really nice :o)

Especially the reflection work...

It's very difficult to achieve such effects with any engine.
(I know raytracing are the easiest to do this efficiently, but even then, you've done a good job)

Good luck for further improvement...

Here's a link to the OutCast engine, it may help you :

-* So many things to do, so little time to spend *-


August 24, 2000, 09:30 AM

Looks good. You might want to try metaballs. It wasn't too hard to get working and made for neat animations.



August 24, 2000, 09:36 AM

I agree, I can almost see myself in those reflections, the blue one almost looks like it has metal flake (yes I know it doesn't, really)

J-S Perrier

August 24, 2000, 09:45 AM

> (I know raytracing are the easiest to do this efficiently, but even > then, you've done a good job)

There is nothing efficient about how raytracing handles reflections!! For each pixels of the image, a ray is casted out and bounce off everything in the scene a couple of times until it is lost in the background... At the highest quality settings for anti-aliasing (256 random rays per pixels) it took 8 hours to my own raytracer to render a 1024x768 image (that too was for a school projet of advanced computer graphic). Ok, that's the equivalent of 256 images, but hey, the final image was amazing...


August 24, 2000, 10:19 AM

Well, efficiency shouldn't be measured so linearly Perrier. Consider the alternatives to ray tracing for realistic images. Are there any that are more efficient? Is 8 hours a long time to create a photorealistic image of an object that doesn't exist? I dont think so.
Measure efficiency relatively.

Anyway, beautiful work Thomas. You should post your source code on flipcode for everyone to see.


August 24, 2000, 10:34 AM

Are the reflections/shadows on/around the red ball correct? Do you intend for the red ball to have alpha trans?

The Wolf

August 24, 2000, 11:16 AM

looks great, how long did it take to render?

PS I heard that Intel is working on a microprocessor that somehow enhances the speed of raytracing engines
(not just a faster processor). Any truth to that?


August 24, 2000, 11:37 AM

If you wanna do something really impressive, work in a material/shader thing. Even very simple shaders can increase the look of a scene a great deal.

I know it sounds too much like current hardware, but I found a triangle based ray tracer very good. Mainly because I could tesselate lots of shapes/share things with my engine code. I used a gaussian antialiasing method, with some random jitter etc for antialiasing. I found it looked very good.

The other advantage about tracing triangles are - They are fast, They are easy to work with, various cool methods for speed up can be easily achieved.

By the way, 8 hours sounds a little long for a good highly optimised ray tracer :)

Michael Edey

August 24, 2000, 07:41 PM

say looks great :)

also, I don't think the red ball is alpha trans, it could just bee that the white surface under it is infinitly larger in both directions, including _behind_ the camera so we're actually seeing a relction of something a great ways behind us

Keep up the good work!


"Sprint 'fly rocks.", M.E.

"Sanity is not statistical", George Orwell - "1984"


August 25, 2000, 03:34 AM

Ehm, Dirtypunk, that's not a reply to the image of the day, it's a blatant blurp about your own presumed radical skills. Why don't you post an image of the day yourself? After all, one image says more than a thousand high-tech, beginner-discouraging words from a wanna-be 3D god.

- Phantom
- I agree, Jaap (and that's not because I know the Phantom in person but just because I actually like this screenshots better then your never before shown screenshots.) Sorry, couldn't resist.


August 25, 2000, 05:51 AM

Wow, Jacco & Jaap to the rescue again - and a bit hostile this time :)
No offense guys, but I have to remind you you're *not* the Dukes of Hazard ;)

Have to agree with dirtypunk though.
And yeah, maybe he's showing of what he's done with raytracing - but on the other hand, he gives some useful hints on what he found out to be cool/useful/fast things with *his* raytracer - which might inspire other people to try it for themselves.

The image looks cool by the way, only thing you need to do from now on is add more features and optimize..!

Problemo : 8 hours too long ..?
Depends on what kind of scene you're tracing ofcourse;
try the famous '10.000 perfectly reflecting spheres'-scene from pov-ray at a high-resolution with antialiasing, you might find 8 hours isn't really that much :)

Although preprocessing can ease the burden of raytracing a lot, the tracing-time's still dependant of the scene-complexity.

Optimizing it with caching, object-scanline-rejection etc. can make a lot of difference; you can try the Graphics Gems books amongst other to find info about improving your tracer-efficiency.

Led / LBG


"Computers are useless. They can only give you answers." - Pablo Picasso


August 25, 2000, 06:45 AM

hrm.. i think i agree with phantom and jaap. i don't think anyone has ever seen anything come out of dirtypunk other than plugs for work that he's supposedly done at some point somewhere for someone that he can't show us due to an NDA, a dead harddrive or the matrix people doing their best to prevent the world from seeing the wonder that is conor's mad 3d coding skill. feel free to prove me wrong, but until someone does, dp's "advice" (read: blatant self-serving verbal masturbation) holds little to no meaning for me.


"I think, therefore I'm right."

"Float like a butterfly, bite like a crocodile."


August 25, 2000, 06:59 AM

open source???
why would you want to do that?
there are *much better* ray tracers' which are available.
a few guys that work at autodesk and other commercial companies *used* to implement some extensions/features to pov ray.
i hear the code is *very* easy to read through and well commented.

images that small should *NOT* take that long, let alone with geometry of that size.

open up max and see how long it takes you to do that scene.
moller has some good triangle-ray intersection code which will speed up your times if it is taking that long.
i have seen so many people write ray tracers with such slow code where if they took the time to look on the net they would find some *fast* code.


August 25, 2000, 07:29 AM

Why the flame about DirtyPunk ..?

Only 'cause he said '8 hours sounds a little long for a good highly optimised ray tracer' ?

The rest of wat he wrote wasn't showing off, it was just giving advice / telling what he has done.
He has made no negative remarks about the IOTD or it's coder in any way, so I think it's all a bit overreacted.

And so what if you haven't seen any of his code/work..?
Lots of people here that you didn't see any code/work of.
Does it mean they can't give input of any value ..?
Don't think so.




"Computers are useless. They can only give you answers." - Pablo Picasso

zed zeek

August 25, 2000, 07:46 AM

( i dont think dirty puck was critising? baddly) but it brings me to someit i believe in
put up or shut up do we need these cunts critasing? others when they wont lay themselves on the line

Jan Niestadt

August 25, 2000, 08:24 AM

My unsoliticed advice to all posters of negative comments: please post only constructive and helpful messages.

The point of the comments system (as I see it) is to help the IOTD poster by giving constructive feedback and to discuss the image/techniques in the flipcode community.

No-one is helped by simply criticising others; if you see a message that you think is inappropriate, just ignore it or, if you absolutely must, post a non-hostile reply explaining why you find it inappropriate (like I'm doing now). Remember that because we can't see or hear each other, we often get each other's intentions wrong when communicating on messageboards. When it doubt, tone it down.

Excuse me if this sounds self-righteous, this is just the way I feel about it. It's probably been said before, but obviously some people haven't gotten the message.


August 25, 2000, 08:50 AM

About criticizing :
If anyone understood that, could you please explain me what he means..?



"Computers are useless. They can only give you answers." - Pablo Picasso


August 25, 2000, 09:21 AM

i'm with Led on that one :)

"I think, therefore I'm right."

"Float like a butterfly, bite like a crocodile."


August 25, 2000, 09:24 AM

The white ball is reflecting a shadow behind the red ball that does not appear on the unreflected (this gets confusing) actual surface. Can you see it?

J-S Perrier

August 25, 2000, 09:52 AM

I see it. The actual shadow is hiden from the camera by the red ball itself.


August 25, 2000, 10:08 AM

as I see it there are 2 lights in the scene, and the camera is even with the reflected horizon in the red ball so that it appears that the red ball might be transparent but if you look, the white ball cannot be seen through the red ball

as to criticism and nasty comments, if you give it best be prepared to take it... The image is very nice, whatever method was used.

there are some things we don't know about the scene and his code yet to be able to say "fast" or "Slow"

and BTW I've never posted anything other than comments


August 25, 2000, 02:30 PM

oh well, 21 comments for this tiny pic :)

i think the reflection on the red ball is correct, although it looks strange. it looks so because the the horizon (where the infinite floor seems to have an end), the border of the reflection on the red sphere and the camera's viewing direction lie in one line. THE RED BALL IS _NOT_ TRANSPARENT.

and, as someone said, there are two light sources, but you can only see one shadow of the red ball on the floor. the other shadow is behind the red ball. but you can see BOTH shadows on the white ball.

and yes, of course this is a very simple scene (2 light sources, 4 objects) and it takes only a few seconds to calculate the picture at a resolution 640x480 on my PIII/600. (the rendering time will of course be much longer when i have implemented antialising:)

and no, 8 hours for a picture isn't very much. i remember the time
when i was playing with povray on a 486...



August 25, 2000, 04:36 PM

i'm sorry if anyone took it offsencivly.

all i was saying is that there is some *very* *solid* and *robust* code on the net for you to download.

fredo has some good links on his site too.
he's more into radiosity research though.
look under the ray-tracing section


August 25, 2000, 05:34 PM

I'd say that's really nice if you just did it for fun. Of course, you need to optimize your tracer probably... I don't know where DP got 8 hours from, but anyway...

That red ball thing is a cubic surface map in my opinion, reflecting the infinite plane under it... you can see the plane extend all teh way forward, why not backwards? :-)

It would be cool to code a triangle mapping tracer... I don't know why you guys have reacted so much to DP's post... although I do sometimes wish he'd produce something other than glorious bumpmapped Text for us ;-)


"What direction you should go in depends very much on where you want to end up." - a famous cat :)

This thread contains 24 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.