A computer method of generating virtual lighting for an object according to an input image captured by a camera, the method comprising: - dividing the input image in blocks of pixels; - for at least one block, determining a pixel of the block with a highest luminance and associating coordinates and luminance of the determined pixel with the block; - determining a final block with a highest luminance, comprising, iteratively: o generating a new input image using said blocks associated with a luminance and coordinates as pixels of the new input image; o dividing the new input image in second blocks, subsampling the input image such that a pixel in said new input image is associated to N pixels in the input image; and o for each second block, determining a pixel of said second block associated with a highest luminance and associating coordinates and luminance of the determined pixel with the second block; until said new input image is a one-pixel image; - separately filtering coordinates and highest luminance associated with the determined pixels of said final blocks for a number of last successive divisions of said input image into blocks, the final one-pixel block being associated with the filtered coordinates and said filtered highest luminance; and - determining a main lighting source direction by mapping the filtered coordinates associated with said final one-pixel block from said input image onto a position in spherical representation of said input image in a space of the camera, said spherical representation forming a portion of a unit sphere centered on the camera, said portion of a unit sphere being determined according to a field of view of the camera, said main lighting source direction being a vector from said position toward the camera; - determining a main lighting source position in the camera space by choosing an arbitrary light distance (d) from the camera and multiplying said distance (d) with the determined main lighting source direction; and - generating virtual lighting for said object from said filtered highest luminance, said determined main lighting source direction and said determined main lighting source position. - dividing the input image in blocks of pixels; - for at least one block, determining a pixel of the block with a highest luminance and associating coordinates and luminance of the determined pixel with the block; - determining a final block with a highest luminance, comprising, iteratively: o generating a new input image using said blocks associated with a luminance and coordinates as pixels of the new input image; o dividing the new input image in second blocks, subsampling the input image such that a pixel in said new input image is associated to N pixels in the input image; and o for each second block, determining a pixel of said second block associated with a highest luminance and associating coordinates and luminance of the determined pixel with the second block; until said new input image is a one-pixel image; o generating a new input image using said blocks associated with a luminance and coordinates as pixels of the new input image; o dividing the new input image in second blocks, subsampling the input image such that a pixel in said new input image is associated to N pixels in the input image; and o for each second block, determining a pixel of said second block associated with a highest luminance and associating coordinates and luminance of the determined pixel with the second block; - separately filtering coordinates and highest luminance associated with the determined pixels of said final blocks for a number of last successive divisions of said input image into blocks, the final one-pixel block being associated with the filtered coordinates and said filtered highest luminance; and - determining a main lighting source direction by mapping the filtered coordinates associated with said final one-pixel block from said input image onto a position in spherical representation of said input image in a space of the camera, said spherical representation forming a portion of a unit sphere centered on the camera, said portion of a unit sphere being determined according to a field of view of the camera, said main lighting source direction being a vector from said position toward the camera; - determining a main lighting source position in the camera space by choosing an arbitrary light distance (d) from the camera and multiplying said distance (d) with the determined main lighting source direction; and - generating virtual lighting for said object from said filtered highest luminance, said determined main lighting source direction and said determined main lighting source position.