Giter Site home page Giter Site logo

squarerfive / genericfoliage Goto Github PK

View Code? Open in Web Editor NEW
41.0 5.0 5.0 19.88 MB

Spawn foliage using geospatial data in UE5

License: Apache License 2.0

C# 2.68% C++ 97.32%
plugin unrealengine foliage unreal-engine-5 unreal-engine-plugin compute-shader unreal

genericfoliage's Introduction

GenericFoliage (v 0.5)

This plugin allows you to spawn foliage into planetary worlds in Unreal Engine 5, using geospatial data. It is intended to be generic and extendable by the developer.

Geometry (GeoJSON) foliage spawner

The geometry-based spawner allows you to load a GeoJSON into the engine and spawn foliage instances at runtime.

The AClusterFoliageActor class contains the spawner logic, along with GeoJSON parsing, etc. Multiple instances of these actors can exist in the world and invoked immediately or on-demand.

It can also be extended to stream geojson contents from the web if needed.

Example project with Cesium

https://github.com/SquarerFive/CesiumFoliageExample

How to use

Each GeoJSON feature requires the field type in it's properties. It is a whole number describing the foliage types to spawn.

Foliage types are handled in the UGenericFoliageCollection object, which contains a map of integers to an array of UGenericFoliageType.

Currently supported geometry types:

Geometry Type Status
Point ❌ Not Supported
MultiPoint ❌ Not Supported
Polygon ✅ Supported
MultiPolygon ❌ Not Supported

Rasterized spawner

This is a grid based spawner using render targets to place the foliage instances, colour, normal and depth channels are used to determine where and how they should be spawned.

Current Features

  • Foliage points are sampled from render targets for colour, normal and depth so line traces aren't used.
  • Works on planets and flat surfaces.
  • HISMs are partitioned into tiles, so they can gradually be updated without impacting performance too signficantly.
  • Collision is only enabled on the active tile (closest to the camera). This is done to speed up the time taken to add instances to the HISM.

Sampling using GPU scene depth and world normals

genericfoliage's People

Contributors

squarerfive avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

genericfoliage's Issues

The plugin has been upgraded to version 5.3 and runs without any vegetation.

You did not provide your GeoJSON file, and I am not sure if it is because my own GeoJSON file is incorrect that no vegetation can be generated.

{
"type" : "FeatureCollection",
"name" : "forest",
"features" : [
{
"type" : "Feature",
"properties":{
"name":"group-1",
"type": 1
},
"geometry" : {
"type" : "Polygon",
"coordinates" : [
[
[ -1.852010886, 52.5291051416 ],
[ -1.8516281235, 52.5299201322 ],
[ -1.8532867597, 52.5303082174 ],
[ -1.8532229659, 52.5307739157 ],
[ -1.8546902214, 52.5310455705 ],
[ -1.854690222, 52.529570852 ],
[ -1.8582945656, 52.5302306002 ],
[ -1.8584859472, 52.5290857372 ],
[ -1.8531591732, 52.5280378689 ],
[ -1.8463013496, 52.5282901358 ],
[ -1.8463970413, 52.5290275229 ],
[ -1.8512949189, 52.5290952576 ],
[ -1.852010886, 52.5291051416 ]
]
]
},
"properties" : {
"id" : 22,
"OBJECTID" : 22,
"IndividualOrOrganisation" : "Individual",
"FirstName" : "Example First Name",
"LastName" : "Example Last Name",
"OrganisationName" : "WMCA",
"TreeCount" : 18,
"TreeType" : "Mixed woodland (broadleaf and conifer)",
"PrivacyPolicyAgreement" : "Yes",
"ShowOnMap" : "Yes",
"Reason" : "To provide fruit",
"DatePlanted" : "30/06/2023"
}
}
]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.