Heres my scene with reflections, Im using "ILLUMINATION_MATERIAL_COLOR" as illumination, so its supposed to be really just the color, no illumination (for clarity of what the reflections are doing)
One problem is that I dont know how to let the clear/bg color with reflections on, because whenever a ray miss, it will add the clear color to the final color, making the scene too bright, so now Im returning black on ray miss...(any tips on that?)
And here is how Im applying the reflections:
// inside TraceCloserRayHitPlusReflection ... ray hit tests here if( !candidatehit.hit ) return Color3();// return returnColor adds too many times the bg color, it sucks returnColor = ((this->*m_illuminationMethodFunction)(itCandidateShape, candidatehit)); // reflect ray: // update global Kr, apply to color: globalKr_p *= m_shapes[itCandidateShape]->material.kr; if( globalKr_p < 0.001f ) return returnColor * globalKr_p; ray_p.direction = ReflectionVector(-ray_p.direction, candidatehit.normal ); ray_p.origin = candidatehit.point; // add reflection contribution, modulated by reflection coefficient returnColor += ( TraceCloserRayHitPlusReflection( ray_p, globalKr_p, returnColor ) * globalKr_p ); //returnColor*= globalKr_p; if( returnColor.r > 1.0f ) returnColor.r = 1.0f; if( returnColor.g > 1.0f ) returnColor.g = 1.0f; if( returnColor.b > 1.0f ) returnColor.b = 1.0f; return returnColor;
Do you think Im doing it the right way?
I was expecting more attenuation on the reflections (due distance maybe?), but the reflection is allways so mirror perfect..
Heres with phong:
I cant say if it is right, looks uglier then what I was expecting..
Edited by Icebone1000, 04 September 2012 - 06:21 AM.