bild wurde dunkler bei erhoehung der rraysPerPixel. das wurde gefixxt.
This commit is contained in:
+9
-3
@@ -7,14 +7,16 @@
|
||||
|
||||
RGBA raytraceSphere(sphere **objectList, ray *lightray) {
|
||||
RGBA pixel = (RGBA){0,0,0,0};
|
||||
const int lightBounces = 5;
|
||||
const int lightBounces = 2;
|
||||
sphere **spheresHitList = (sphere **)calloc( (lightBounces + 1),sizeof(sphere*) );
|
||||
vec3 *spheresNormalList = (vec3 *)calloc( lightBounces + 1,sizeof(vec3) );
|
||||
int hitLightIndex = -1;
|
||||
vec3 sphereNormal;
|
||||
int raysPerPixel = 1;
|
||||
int raysPerPixel = 50;
|
||||
ray originalRay = *lightray;
|
||||
|
||||
for (int k = 0; k < raysPerPixel; k++) {
|
||||
*lightray = originalRay;
|
||||
RGBA tempPixel = (RGBA){1,1,1,1};
|
||||
sphere *nearestSphere = nullptr;
|
||||
vec3 nearestCollisionPoint = {10000,10000,10000};
|
||||
@@ -62,7 +64,11 @@ RGBA raytraceSphere(sphere **objectList, ray *lightray) {
|
||||
tempPixel = (RGBA){0,0,0,1};
|
||||
}
|
||||
else
|
||||
{ pixel = spheresHitList[firstLightHitIndex]->color;
|
||||
{
|
||||
pixel.r += spheresHitList[firstLightHitIndex]->color.r;
|
||||
pixel.g += spheresHitList[firstLightHitIndex]->color.g;
|
||||
pixel.b += spheresHitList[firstLightHitIndex]->color.b;
|
||||
pixel.a += spheresHitList[firstLightHitIndex]->color.a;
|
||||
for (int i = firstLightHitIndex - 1; i >= 0; i--) {
|
||||
tempPixel.r = tempPixel.r * spheresHitList[i]->color.r;
|
||||
tempPixel.g = tempPixel.g * spheresHitList[i]->color.g;
|
||||
|
||||
Reference in New Issue
Block a user