PDA

View Full Version : Raytracer reflection/shadow problem


CapBBeard
03-15-2007, 10:28 AM
Hi everyone,

As part of my effort to learn as much as I can about 3d programming, I've set out to write my own raytracer. It's written from C++, and I started from scratch (except for adding in lua so I can script scenes :) )

The other day I started to add affine transformations to it, and began with scaling. Everything seemed to be going well, but I've struck a problem that's totally stumped me.

Firstly, and image showing the problem can be seen here:
http://capbbeard.evadosoft.com/raytrace/raytrace.15.png

Notice the 'arc' like curve that sweeps around the bottom half of the object? It doesn't really look like a bug but I'm pretty sure it shouldn't be there. I just can't work out what could be causing it.

It does not appear if I disable just reflections, and it does not appear if I disable just shadows. It's not there if the object isn't scaled.

The tell-tale sign to me, that it shouldn't be there, is that it seems to maintain it's illumination even at the bottom, where it should be in shadow.

I'm not really sure what other information to provide, I'm just wondering if anyone has any hints as to what it may be. I can provide more information about how my scaling works if need be.. I'd post it now but unfortunately I'm not at home so I don't have access to my source code.


Any help or pointers would be greatly appreciated!

Thanks!

billrobertson42
03-18-2007, 02:35 AM
Without others seeing your code it seems unlikely that you'll get a sensible answer.

My suggestion is to try to create the simplest scene that you can that has the problem, and then start debugging. It sounds like you have a theory about scaling, so why not start looking there?

Good luck.

CapBBeard
03-26-2007, 08:58 AM
Thanks for your response.

I realise it's difficult to get a response from the information given, I was just hoping that, on the off chance, someone would pick up that it's showing a tell tale sign of some common issue :P But again, thanks for the response.

I'm heavily snowed under with Uni course work at the moment so haven't had a chance to look much further into the issue yet. When I get a chance I'll go back and triple check all my reflection/shadow code is in fact correct..

bradfordjloos
03-28-2007, 05:19 PM
Hi,

If you look closely it almost looks like the egg shape is fuzzily reflecting the inside corners of a box. If you haven't implemented fuzzy reflections or the egg isn't actually inside a box then this probably isn't the case, but perhaps it'll give you a little bit of insight into what's going on.

Good luck,

Brad

CapBBeard
04-06-2007, 02:34 PM
Ah ha, fixed!!

I hadn't had much of a chance to have a decent look at it until today, Uni's been snowing me under with work.

The problem was with the normals. I rendered out a shot displaying the normals, and found they were a little weird. I managed to trace it back to my scaling code, it turns out that I wasn't correctly scaling my intersection distance after converting from object space back into world space.

Corrected shot:
http://capbbeard.evadosoft.com/raytrace/raytrace.16.png (http://capbbeard.evadosoft.com/raytrace/raytrace.15.png)

Hooray! Thanks everyone :)

CGTalk Moderation
04-06-2007, 02:34 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.