I'm having trouble converting. For some reason, everything is not as it seems to me, it should be, but, frankly, all the transformations back and forth make me pretty dizzy.
As I read everywhere (although explicit explanations are rare, imho), the basic transformation algorithm is as follows:
- converts Ray (Origin and Direction) with the inverse of the transformation matrix
- converts the resulting intersection point with the transformation matrix
- converts the normal object to the point of intersection with the transposed inverse
From what I understood, this was supposed to do the trick. I am pretty sure that my problem is that I am trying to calculate the lighting, since both the initial intersection and the lighting algorithm use the same function ( obj.getIntersection() ). But then again, I have no idea .:(
Here you can read parts of my code:
main.cpp , scene.cpp , sphere.cpp , sdf-loader.cpp
Please let me know if you need more information to help me - and please help me!;)
EDIT:
I made some results, maybe someone βseesβ (from the results) where I can be wrong:
untransformed scene:

sphere scaled (2,4,2):

box translation (0, -200,0):

scope translated (-300,0,0):

ball x-rotated (45 Β°):

source share