{"id":13731601,"url":"https://github.com/prideout/heman","last_synced_at":"2026-01-18T11:45:03.110Z","repository":{"id":36149709,"uuid":"40453735","full_name":"prideout/heman","owner":"prideout","description":"C99 heightmap utilities.","archived":false,"fork":false,"pushed_at":"2021-04-27T22:43:51.000Z","size":6897,"stargazers_count":478,"open_issues_count":0,"forks_count":26,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-05-08T05:34:09.890Z","etag":null,"topics":["distance-field","graphics","heightmap"],"latest_commit_sha":null,"homepage":"https://prideout.net/heman/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prideout.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-09T23:12:29.000Z","updated_at":"2025-03-25T20:21:14.000Z","dependencies_parsed_at":"2022-07-22T20:47:21.489Z","dependency_job_id":null,"html_url":"https://github.com/prideout/heman","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/prideout/heman","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prideout%2Fheman","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prideout%2Fheman/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prideout%2Fheman/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prideout%2Fheman/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prideout","download_url":"https://codeload.github.com/prideout/heman/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prideout%2Fheman/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28535177,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T10:13:46.436Z","status":"ssl_error","status_checked_at":"2026-01-18T10:13:11.045Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["distance-field","graphics","heightmap"],"created_at":"2024-08-03T02:01:33.793Z","updated_at":"2026-01-18T11:45:03.090Z","avatar_url":"https://github.com/prideout.png","language":"C","readme":"![](https://github.com/prideout/heman/blob/master/docs/_static/islands.png)\n\nThis toy project is a tiny MIT-licensed C library of image utilities for dealing with **he**ight\n**ma**ps, **n**ormal maps, distance fields, and the like.  It has a very low-level API, where an\n\"image\" is simply a flat array of floats.  There are no dependencies and [only one header\nfile](https://github.com/prideout/heman/blob/master/include/heman.h).\n\n**Heman** can do stuff like this:\n- Create a random height field using simplex noise and FBM.\n- Generate a normal map from a height map.\n- Compute ambient occlusion from a height map.\n- Generate a signed distance field (SDF).\n- Export a 3D mesh in [PLY](http://paulbourke.net/dataformats/ply/) format.\n- Apply a color gradient to a heightmap.\n- Generate a color gradient, given a list of control points.\n- Compute diffuse lighting with an infinite light source.\n- Generate a nicely-distributed list of points according to a density field.\n\nHeman implements some really nice 21st-century algorithms:\n\n- Ambient occlusion is generated using Sean Barrett's efficient method that makes 16 sweeps over the\n  height field.\n- Distance field computation uses the beautiful algorithm from _Distance Transforms of Sampled\n  Functions_ (Felzenszwalb and Huttenlocher).\n- Density field samples are generated using Robert Bridson's _Fast Poisson Disk Sampling in\n  Arbitrary Dimensions_.\n\n## Example\n\nThe images at the top were generated from code that looks like this:\n\n```c\n// Generate an island shape using simplex noise and a distance field.\nheman_image* elevation = heman_generate_island_heightmap(1024, 1024, rand());\n\n// Compute ambient occlusion from the height map.\nheman_image* occ = heman_lighting_compute_occlusion(elevation);\n\n// Visualize the normal vectors.\nheman_image* normals = heman_lighting_compute_normals(elevation);\n\n// Apply a color gradient.\nheman_image* gradient = heman_color_create_gradient(...);\nheman_image* albedo = heman_color_apply_gradient(elevation, -0.5, 0.5, grad);\n\n// Apply diffuse lighting.\nheman_image* final = heman_lighting_apply(elevation, albedo, ...);\n```\n\nFor the unabridged version, see `test_lighting()` in\n[test/test_heman.c](https://github.com/prideout/heman/blob/master/test/test_heman.c).\n\n## Building OpenMP\n\n```\ncurl -L -O https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.0/openmp-12.0.0.src.tar.xz\ntar -xvf openmp-12.0.0.src.tar.xz ; rm openmp-12.0.0.src.tar.xz\ncd openmp-12.0.0.src\ncmake . -DLIBOMP_ENABLE_SHARED=OFF -DLIBOMP_INSTALL_ALIASES=OFF -DCMAKE_OSX_ARCHITECTURES=x86_64\nsudo make install\n```\n","funding_links":[],"categories":["Graphics","图形","Maths","Graphics ##"],"sub_categories":["Resources ###"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprideout%2Fheman","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprideout%2Fheman","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprideout%2Fheman/lists"}