{"id":16287608,"url":"https://github.com/flarive/cortex-raytracer","last_synced_at":"2025-07-05T18:33:11.406Z","repository":{"id":262447651,"uuid":"762828928","full_name":"flarive/Cortex-Raytracer","owner":"flarive","description":"Open source CPU monte carlo raytracer","archived":false,"fork":false,"pushed_at":"2025-02-22T12:24:47.000Z","size":553206,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-14T21:05:13.256Z","etag":null,"topics":["cameras","lights","materials","monte-carlo-simulation","raytracer","raytracing","textures"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flarive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-02-24T19:59:59.000Z","updated_at":"2025-02-22T12:24:50.000Z","dependencies_parsed_at":"2025-02-22T12:35:33.062Z","dependency_job_id":null,"html_url":"https://github.com/flarive/Cortex-Raytracer","commit_stats":null,"previous_names":["flarive/cortex-raytracer"],"tags_count":31,"template":false,"template_full_name":null,"purl":"pkg:github/flarive/Cortex-Raytracer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flarive%2FCortex-Raytracer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flarive%2FCortex-Raytracer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flarive%2FCortex-Raytracer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flarive%2FCortex-Raytracer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flarive","download_url":"https://codeload.github.com/flarive/Cortex-Raytracer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flarive%2FCortex-Raytracer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263784855,"owners_count":23510986,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cameras","lights","materials","monte-carlo-simulation","raytracer","raytracing","textures"],"created_at":"2024-10-10T19:45:35.438Z","updated_at":"2025-07-05T18:33:06.392Z","avatar_url":"https://github.com/flarive.png","language":"C++","readme":"# Cortex-Raytracer\n\nCortex RT is a self made CPU based monte carlo path tracer created from scratch in C++.\n\n![Screenshot](images/cortex-raytracer-main.jpg)\n\n\n\n\n# Primitives\n\nCortex supports an extended list of builtin uv mapped primitives mostly for testing purposes :\n- Plane\n- Cylinder\n- Disk\n- Cone\n- Box\n- Torus\n- Sphere\n\n\nPrimitives with test UV texture | Primitives with stone texture\n--- | ---\n![Screenshot of all builtin primitives](images/primitives.png) | ![Screenshot of all builtin primitives](images/primitives_stones.png)\n\n\n[extended_primitives.scene](https://github.com/flarive/Cortex-Raytracer/blob/master/scenes/extended_primitives.scene)\n\n# Meshes\n\nCortex RT supports loading Wavefront .obj files.\n\nobj is a kind of old legacy plain text 3D file format but it is still widely used by 3D software (blender, 3ds max, maya...) as an export file format.\n- .obj file contains vertex, faces, normals, uv mapping and smmothing groups definition\n- .mtl (Material template library) additional file contains materials definition (color, textures, ambient, diffuse, specular, bump...)\n\nIf you want to knowm more about obj and mtl files : https://en.wikipedia.org/wiki/Wavefront_.obj_file\n\n\n\nteapot.obj solid color | teapot.obj textured | 3ds max obj exporter\n--- | --- | ---\n![](images/teapot_obj_solid_color.png) | ![](images/teapot_obj_texture.png) | ![Screenshot of 3ds max OBJ file exporter](images/3dsmax_obj_exporter.png)\n\n\n\n\n# Scenes\n\nCortex RT comes with a convenient .scene configuration file system to describe the scene to be rendered (primitives, meshes, camera, lights, materials, textures, rendering quality...)\n\n```\n# teapot_mesh.scene\n\nimage:\n{\n    width = 512;\n    height = 388;\n    maxDepth = 100;\n    samplesPerPixel = 100;\n    background = \n    {\n        color = { r = 0.0; g = 0.0; b = 0.0; };\n    };\n};\n\n# Configuration of the camera\ncamera:\n{\n    aspectRatio = \"16:9\";\n    lookFrom = { x = 0.0; y = 4.0; z = 9.0; };\n    lookAt = { x = 0.0; y = 0.0; z = 0.0; };\n    upAxis = { x = 0.0; y = 1.0; z = 0.0; };\n    fov = 18.0;\n};\n\n# Lights in the scene\nlights:\n{\n    sphereLights: (\n        {\n            name = \"MySphereLight\";\n            position = { x = 0.0; y = 8.0; z = 5.0; };\n            radius = 3.0;\n            intensity = 3.0;\n            color = { r = 1.0; g = 1.0; b = 1.0; };\n            invisible = true;\n        }\n    )\n}\n\ntextures:\n{\n    solidColor: (\n        {\n            name = \"ground_texture\";\n            color = { r = 0.7; g = 0.8; b = 1.0; };\n        },\n    ),\n    image: (\n        {\n            name = \"teapot_diffuse_texture\";\n            filepath = \"../../data/models/rusted_metal1.jpg\";\n        }\n    )\n}\n\nmaterials:\n{\n    lambertian: (\n        {\n            name = \"ground_material\";\n            texture = \"ground_texture\";\n        }\n    ),\n    phong: (\n        {\n            name = \"teapot_material\";\n            diffuseTexture = \"teapot_diffuse_texture\";\n            ambientColor = { r = 0.0; g = 0.0; b = 0.0; };\n            shininess = 0.9;\n        }\n    )\n}\n\n# Meshes in the scene\nmeshes:\n{\n    obj: (\n        {\n            name = \"MyTeapotModel\"\n            filepath = \"../../data/models/teapot.obj\";\n            position = { x = 0.0; y = 0.0; z = 0.0; };\n            material = \"teapot_material\"\n            use_mtl = false;\n            use_smoothing = true;\n            transform =\n            {\n                translate = { x = 0.0; y = 0.0; z = 0.0; };\n                rotate = { x = 0.0; y = 0.0; z = 0.0; };\n                scale = { x = 0.02; y = 0.02; z = 0.02; };\n            };\n        }\n    );\n};\n\n# Primitives in the scene\nprimitives:\n{\n    # List of boxes\n    boxes: (\n        {\n            name = \"MyGround\";\n            position = { x = 0.0; y = -1.0; z = 0.0; };\n            size = { x = 40.0; y = 0.5; z = 40.0; };\n            material = \"ground_material\";\n            uvmapping = { scale_u = 1.0; scale_v = 1.0; offset_u = 0.0; offset_v = 0.0; repeat_u = 2.0; repeat_v = 2.0; };\n        }\n    );\n};\n```\n\n# Materials\n\n![Screenshot of all suported materials](images/all_materials.jpg)\n\nCortex RT mostly support following materials :\n- Phong\n- Oren Nayar\n- Anisotropic (for wood, slate, ice, velvet...)\n- Isotropic (for glass, crystals with cubic symmetry, diamonds, plastic, metal...)\n- Dielectric (for water, glass, diamond...)\n- Lambertian (simple diffuse material without any specular relection)\n- Metal (for metals, mirrors...)\n- Emissive (WIP)\n\ncrate.obj (diffuse + specular + bump textures) | cushion.obj (diffuse + specular + normal textures)\n--- | ---\n![Screenshot of phong crate model with diffuse + specular + bump textures](images/crate_diffuse_specular_bump.png) | ![Screenshot of phong cushion model with diffuse + specular + normal textures](images/cushion_normal.png)\n![Screenshot of crate textures](images/crate_textures.png) | ![Screenshot of cushion textures](images/cushion_textures.png)\n\nThe phong reflection model is a full featured material that combines ambient + diffuse + specular.\nhttps://en.wikipedia.org/wiki/Phong_reflection_model\n\nOn top of that, Cortex RT phong material also support a lot of possible textures (solid color, gradient, image, bump, normal, displacement, alpha...)\n\n```\n# Sample materials section in scene file\nmaterials:\n{\n    lambertian: (\n        {\n            name = \"ground_material\";\n            texture = \"ground_texture\";\n        }\n    ),\n    phong: (\n        {\n            name = \"crate_material\";\n            diffuseTexture = \"crate_diffuse_texture\";\n            specularTexture = \"crate_specular_texture\";\n            #bumpTexture = \"crate_bump_texture\";\n            normalTexture = \"crate_normal_texture\";\n            ambientColor = { r = 0.0; g = 0.0; b = 0.0; };\n            shininess = 0.0;\n        }\n    )\n}\n```\n[all_materials_spheres.scene](https://github.com/flarive/Cortex-Raytracer/blob/master/scenes/all_materials_spheres.scene)\n\n# Textures\n\n![Screenshot of all suported materials](images/all_textures.jpg)\n\nCortex RT supports quite a lot of textures you can combine in a material :\n\n- Solid color texture\n- Gradient color texture\n- Image texture\n- Bump texture\n- Normal texture\n- Displacement texture (WIP)\n- Alpha texture (transparency texture)\n- Perlin texture (procedural noise)\n- Checker (procedural checkboard pattern texture)\n- Emissive texture (WIP)\n\n```\n# Sample textures section in scene file\ntextures:\n{\n    image: (\n        {\n            name = \"ground_texture\";\n            filepath = \"../../data/textures/scifi_floor2.png\";\n        },\n        {\n            name = \"crate_diffuse_texture\";\n            filepath = \"../../data/models/crate_diffuse.jpg\";\n        },\n        {\n            name = \"crate_specular_texture\";\n            filepath = \"../../data/models/crate_specular.jpg\";\n        },\n        {\n            name = \"crate_bump_texture\";\n            filepath = \"../../data/models/crate_bump.jpg\";\n        }\n    ),\n    normal: (\n        {\n            name = \"crate_normal_texture\";\n            filepath = \"../../data/models/crate_normal.jpg\";\n            strength = 0.005;\n        }\n    )\n}\n```\n\n[all_textures_spheres.scene](https://github.com/flarive/Cortex-Raytracer/blob/master/scenes/all_textures_spheres.scene)\n\nBump texture | Normal texture\n--- | ---\n![Screenshot of bump texture](images/bump_demo.png) | ![Screenshot of normal texture](images/normal_demo.png)\n\n\n\n\n# Camera\n\nCortex RT provides 2 kinds of camera : perspective (default) and orthographic (no perception of depth)\n\nPerspective camera | Orthographic camera\n--- | ---\n![](images/camera_perspective.png) | ![](images/camera_orthographic.png)\n\n```\n# Configuration of a perspective camera\ncamera:\n{\n    aspectRatio = \"16:9\";\n    lookFrom = { x = 0.0; y = 2.0; z = 9.0; };\n    lookAt = { x = 0.0; y = 0.6; z = 0.0; };\n    upAxis = { x = 0.0; y = 1.0; z = 0.0; };\n    fov = 18.0; // Field Of View (zoom level in degrees)\n};\n```\n\n```\n# Configuration of an orthographic camera\ncamera:\n{\n    aspectRatio = \"16:9\";\n    lookFrom = { x = 0.0; y = 2.0; z = 9.0; };\n    lookAt = { x = 0.0; y = 0.6; z = 0.0; };\n    upAxis = { x = 0.0; y = 1.0; z = 0.0; };\n    orthographic = true;\n    orthoHeight = 2.0; // Orthographic viewport height (height of the viewport in world space units)\n};\n```\n\n\n\n\n\n# Rendering parameters\n\nThe image section in .scene files defines some usefull render settings :\n\n- width/height : The size in pixels of the final rendered image (according to the camera aspect ratio)\n- maxDepth : The max number of ray bounces (50 should be more than enough)\n- samplesPerPixel (spp) : The max number of samples calculated to generate each pixel of the rendered image (50 is very fast but very noisy, 500-1000 is high quality, 5000+ is extra high quality but very slow)\n- background : The background to use while rendering the scene (color, simple image or hdr skybox image)\n\n```\n# Configuration of the rendered image quality\nimage:\n{\n    width = 512;\n    height = 388;\n    maxDepth = 50;\n    samplesPerPixel = 500;\n    background = \n    {\n        #color = { r = 0.1; g = 0.1; b = 0.1; };\n        filepath = \"../../data/backgrounds/hdr/christmas_photo_studio_02_2k.hdr\";\n        is_skybox = true;\n    };\n};\n```\n\n50 spp | 500 spp | 1000 spp | 5000 spp | 10000 spp\n--- | --- | --- | --- | ---\n![](images/cornell_box_50_spp.png) | ![](images/cornell_box_500_spp.png) | ![](images/cornell_box_1000_spp.png) | ![](images/cornell_box_5000_spp.png) | ![](images/cornell_box_10000_spp.png)\n\n\n# Lights\n\nCortex RT supports 3 different kinds of lights :\n\n- Omni light : \nAlso known as a point light, an omni light emits light equally in all directions from a single point in space, similar to a light bulb.\n\n- Directional light : \nSimulates light coming from a specific direction, as if it were emitted from an infinitely large source, such as the sun.\n\n- Spot light : \nMore focused light source that emits light in a specific direction within a cone.\n\n\nLights are produced by hidden objects (quad or sphere) with an emissive material.\\\nSuch objects can be displayed for debug lightning purpose.\n\nOmni light | Omni light debug (emissive sphere)\n--- | ---\n![](images/omni_light.png) | ![](images/omni_light_debug.png)\n\nDirectional light | Directional light debug (emissive quad)\n--- | ---\n![](images/directional_light.png) | ![](images/directional_light_debug.png)\n\nSpot light | Spot light debug (emissive sphere)\n--- | ---\n![](images/spot_light.png) | ![](images/spot_light_debug.png)\n\n[all_lights_types.scene](https://github.com/flarive/Cortex-Raytracer/blob/master/scenes/all_lights_types.scene)\n\n# Transforms and groups\n\nCortex RT supports applying transforms to primitives and meshes (translate, rotate, scale).\nTransform attribute overrides the object position and size already defined.\n\n```\n# Transform applied on a box primitive\nprimitives:\n{\n    boxes: (\n        {\n            name = \"MyGround\";\n            position = { x = 0.0; y = -0.28; z = 0.0; };\n            size = { x = 10.0; y = 0.5; z = 40.0; };\n            material = \"ground_material\";\n        },\n        {\n            name = \"MyBox\"\n            position = { x = 0.0; y = 0.35; z = 0.0; };\n            size = { x = 0.7; y = 0.7; z = 0.7; };\n            material = \"uvmapper_material\";\n            uvmapping = { scale_u = 0.5; scale_v = 0.5; offset_u = 0.0; offset_v = 0.0; };\n            transform =\n            {\n                translate = { x = 0.0; y = 0.0; z = 0.0; };\n                rotate = { x = 0.0; y = 45.0; z = 0.0; };\n                scale = { x = 2.0; y = 2.0; z = 2.0; };\n            };\n        }\n    );\n};\n\n# Transform applied on a custom mesh\nmeshes:\n{\n    obj: (\n        {\n            name = \"MyMesh\"\n            filepath = \"../../data/models/smooth_sphere.obj\";\n            use_mtl = true;\n            use_smoothing = true;\n            transform =\n            {\n                translate = { x = -1.3; y = 0.0; z = 0.0; };\n                rotate = { x = 0.0; y = 45.0; z = 0.0; };\n                scale = { x = 1.2; y = 1.2; z = 1.2; };\n            };\n        }\n    );\n};\n```\n\nIn a scene objects (primitives and meshes) can be grouped by using groups.\nA transform can also be applied to a group.\n\n```\nprimitives:\n{\n    boxes: (\n        {\n            name = \"MyBox1\"\n            position = { x = 0.0; y = 0.0; z = 0.0; };\n            size = { x = 0.7; y = 0.7; z = 0.7; };\n            material = \"uvmapper_material\";\n            group = \"MyGroup\";\n        },\n        {\n            name = \"MyBox2\"\n            position = { x = 0.0; y = 0.0; z = 0.0; };\n            size = { x = 0.7; y = 0.7; z = 0.7; };\n            material = \"uvmapper_material\";\n            group = \"MyGroup\";\n        }\n    );\n};\n\n# Definition of groups\ngroups: (\n    {\n        name = \"MyGroup\";\n        transform =\n        {\n            translate = { x = -100.0; y = 270.0; z = 395.0; };\n            rotate = { x = 0.0; y = 15.0; z = 0.0; };\n            scale = { x = 2.0; y = 2.0; z = 2.0; };\n        };\n    }\n);\n```\n\n[transforms.scene](https://github.com/flarive/Cortex-Raytracer/blob/master/scenes/transforms.scene)\n\n# Anti aliasing\n\n# Performances and optimizations\n\n# Command line exe\n\n# Graphical User Interface\n\n# Dependencies\n\n# Thanks to\n\n# What's next ?\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflarive%2Fcortex-raytracer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflarive%2Fcortex-raytracer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflarive%2Fcortex-raytracer/lists"}