/resolution_independent

Resolution Independent Rendering technique example implemented with Godot

Primary LanguageGDScript

Resoulution independend rendering example

This is Godot, purely GDScript implementation of Resolution independent rendering technique described by Charles Loop & Jim Blinn here. Original code prepared by Mirco Müller, can be found here.

Implemented simple shape, no antialiasing yet:

good image

This shape drawn with just only 7 trianlges, some calculations required to provide resulting simple shader with params. The shader itself it really lightweight:

shader_type canvas_item;

void fragment(){
    if (COLOR.a <= 0.0){
        float v = COLOR.x;
        float w = COLOR.y;
        float t = COLOR.z;
        if (v*v*v - w*t + 0.000001 > 0.0){
            COLOR.rgb = vec3(1.0, 0.0, 0.0);
        } else {
            COLOR.rgb = vec3(0.0, 1.1, 0.0);
        }
        COLOR.a = 0.5;
    }
}

There is also no curve splitting for edge cases yet, so there are possible some artefacts:

artefacts

Tested with godot 3.1.alpha3.