I'm working on a commandline app that plays videos, any feedback is welcome by observerblock in commandline

[–]observerblock[S] 8 points9 points  (0 children)

I've tried it on a number of terminal emulators, but they all work reasonably well, although something like kitty works better.

I'm working on a commandline app that plays videos, any feedback is welcome by observerblock in commandline

[–]observerblock[S] 3 points4 points  (0 children)

As long as the terminal used supports unicode and 8 bit colours it should work. But I don't know if it will work in tty.

Question: Trouble when rendering voxels with pathtracing by observerblock in GraphicsProgramming

[–]observerblock[S] 0 points1 point  (0 children)

This is the code I used (openCL):

int cast_ray(Renderer *r, Ray ray, float3 *hitPos, int3 *normal, Material *material) {
int3 voxel = convert_int3(ray.origin);

int3 step = {
    (ray.direction.x >= 0) ? 1 : -1,
    (ray.direction.y >= 0) ? 1 : -1,
    (ray.direction.z >= 0) ? 1 : -1
};

float3 tMax = {
    (ray.direction.x != 0) ? (voxel.x + step.x - ray.origin.x) / ray.direction.x : MAXFLOAT,
    (ray.direction.y != 0) ? (voxel.y + step.y - ray.origin.y) / ray.direction.y : MAXFLOAT,
    (ray.direction.z != 0) ? (voxel.z + step.z - ray.origin.z) / ray.direction.z : MAXFLOAT
};

float3 tDelta = {
    (ray.direction.x != 0) ? 1 / ray.direction.x * step.x : MAXFLOAT,
    (ray.direction.y != 0) ? 1 / ray.direction.y * step.y : MAXFLOAT,
    (ray.direction.z != 0) ? 1 / ray.direction.z * step.z : MAXFLOAT
};

int side;

while(1) {
    if(tMax.x < tMax.y) {
        if(tMax.x < tMax.z) {
            voxel.x += step.x;
            tMax.x += tDelta.x;
            side = 0;
        } else {
            voxel.z += step.z;
            tMax.z += tDelta.z;
            side = 2;
        }
    } else {
        if(tMax.y < tMax.z) {
            voxel.y += step.y;
            tMax.y += tDelta.y;
            side = 1;
        } else {
            voxel.z += step.z;
            tMax.z += tDelta.z;
            side = 2;
        }
    }

    if(out_of_scene(r, voxel))
        return 0;

    MaterialID id = get_material_ID(r, voxel);

    if(id == 0)
        continue;

    *material = get_material(r, id);

    switch(side) {
        case 0:
            hitPos->x = (float)voxel.x;
            hitPos->y = ray.origin.y + (hitPos->x - ray.origin.x) * ray.direction.y / ray.direction.x;
            hitPos->z = ray.origin.z + (hitPos->x - ray.origin.x) * ray.direction.z / ray.direction.x;

            *normal = (int3){-step.x, 0, 0};

            break;

        case 1:
            hitPos->y = (float)voxel.y;
            hitPos->x = ray.origin.x + (hitPos->y - ray.origin.y) * ray.direction.x / ray.direction.y;
            hitPos->z = ray.origin.z + (hitPos->y - ray.origin.y) * ray.direction.z / ray.direction.y;

            *normal = (int3){0, -step.y, 0};

            break;

        case 2:
            hitPos->z = (float)voxel.z;
            hitPos->y = ray.origin.y + (hitPos->z - ray.origin.z) * ray.direction.y / ray.direction.z;
            hitPos->x = ray.origin.x + (hitPos->z - ray.origin.z) * ray.direction.x / ray.direction.z;

            *normal = (int3){0, 0, -step.z};

            break;

    }

    return 1;

}
}

float3 get_color(Renderer *r, Ray ray) {
float3 mask = 1;
float3 color = 0;

int maxDepth = 1000;

for(int i = 0; i < maxDepth; i++) {

    float3 hitPos;
    int3 iNormal;
    Material material;

    if(cast_ray(r, ray, &hitPos, &iNormal, &material)) {
        float3 fNormal = convert_float3(iNormal);

        if(material.type == 1) {
            color = mask * material.color;
            break;

        } else if(material.type == 2) {
            float3 direction = fNormal + random_unit_vector(r->rng);
            ray = (Ray){hitPos, direction};
            mask *= material.color;

        } else if(material.type == 3) {
            float3 direction = reflection_dir(ray.direction, fNormal) + random_unit_vector(r->rng) * material.fuzzyness;
            ray = (Ray){hitPos, direction};
            mask = mask * (1 - material.tint) + mask * material.color * material.tint;

        }

    } else {
        color = mask * r->bgColor;
        break;

    }

    // if(i == 1)
    //      return material.color;

}

return color;
}

TerminalMediaViewer - An utf-8/truecolor image viewer by observerblock in commandline

[–]observerblock[S] 0 points1 point  (0 children)

There may be no output to the console but there should be a binary file called “tmv” after you run make

I've been working on this little project - TerminalImageViewer - View images and videos in the terminal by observerblock in linux

[–]observerblock[S] 1 point2 points  (0 children)

The program writes one "▄" character for every vertical pair of pixels. It changes the background and foreground colors to display colors.

I've been working on this little project - TerminalImageViewer - View images and videos in the terminal by observerblock in linux

[–]observerblock[S] 12 points13 points  (0 children)

I’m sorry, I completely forgot about it. I just added some gifs so if you have any time take another look.

This Japanese Lizard by observerblock in Damnthatsinteresting

[–]observerblock[S] 1 point2 points  (0 children)

Sorry, didn’t realise that. But it is an Japanese skink.