A computer-implemented method of computing of a visibility function for rendering a three-dimensional scene, comprising: - providing a set of directions ( ω) in the 3D scene; - for each direction of the set, computing a set of lines that are parallel to the direction; - for each computed set of lines, sampling the lines of the set into spatial segments; - associating each line of a set with a bit field, each spatial segment of the line corresponding to a bit of the bit field; - superimposing the set of lines and the 3D scene; - when a spatial segment of a line intersects a geometry in the 3D scene, marking the bit corresponding to the spatial segment of the bit field associated with the line; - providing two points in the 3D scene that define a query segment; - identifying one or more spatial segments having a closest alignment with the query segment; - computing the visibility of the query segment by performing a logical bit operation on one or more bit fields of the lines the identified one or more spatial segments belong to, wherein performing the logical bit operation comprises performing a logical bit for a segment [X Y] by computing a function R = (X-1) NAND (Y-1) AND D, where: X is one or more of the bitfield set to 1 at one of the two points of the query segment and 0 everywhere else; Y is one or more of the bitfield set to 1 at the other one of the two points of the query segment and 0 everywhere else. D is one or more bit fields of the lines the identified one or more spatial segments belong to. - providing a set of directions ( ω) in the 3D scene; - for each direction of the set, computing a set of lines that are parallel to the direction; - for each computed set of lines, sampling the lines of the set into spatial segments; - associating each line of a set with a bit field, each spatial segment of the line corresponding to a bit of the bit field; - superimposing the set of lines and the 3D scene; - when a spatial segment of a line intersects a geometry in the 3D scene, marking the bit corresponding to the spatial segment of the bit field associated with the line; - providing two points in the 3D scene that define a query segment; - identifying one or more spatial segments having a closest alignment with the query segment; - computing the visibility of the query segment by performing a logical bit operation on one or more bit fields of the lines the identified one or more spatial segments belong to, wherein performing the logical bit operation comprises performing a logical bit for a segment [X Y] by computing a function R = (X-1) NAND (Y-1) AND D, where: X is one or more of the bitfield set to 1 at one of the two points of the query segment and 0 everywhere else; Y is one or more of the bitfield set to 1 at the other one of the two points of the query segment and 0 everywhere else. D is one or more bit fields of the lines the identified one or more spatial segments belong to. X is one or more of the bitfield set to 1 at one of the two points of the query segment and 0 everywhere else; Y is one or more of the bitfield set to 1 at the other one of the two points of the query segment and 0 everywhere else. D is one or more bit fields of the lines the identified one or more spatial segments belong to.