#Rendering plane

2 messages · Page 1 of 1 (latest)

tough pier
#

Hi! Does anyone know what is wrong with this rendering? The sphere is rendered fine but the floor is like a horizontal strip.

vec3 marchRay(vec3 origin, vec3 direction) {
    float stepSize = 0.01;

    vec3 p = origin;

    vec3 accel = vec3(0.0);

    for (int i = 0; i < MAX_STEPS; i++) {
        p += stepSize * direction;
        vec3 p_cart = sphericalToCartesian(p);

        if (p.x < 1) {
            return vec3(1.0, 0.0, 0.0);
        }
        if (p.y < camera.floor_height) {
            return vec3(0.0, 1.0, 0.0);
        }

        mat3 christoffelSymbols_alpha_r = calculateChristoffelSymbolsAlphaR(p);
        mat3 christoffelSymbols_alpha_theta = calculateChristoffelSymbolsAlphaTheta(p);
        mat3 christoffelSymbols_alpha_phi = calculateChristoffelSymbolsAlphaPhi(p);

        // Calculate the accelerations using the geodesic equation
        accel.x = -dot(direction, christoffelSymbols_alpha_r * direction);
        accel.y = -dot(direction, christoffelSymbols_alpha_theta * direction);
        accel.z = -dot(direction, christoffelSymbols_alpha_phi * direction);

        direction += accel * stepSize;
    }

    return vec3(0.115, 0.133, 0.173);
}```
plucky isleBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.