kandi background
kandi background
Explore Kits
kandi background
Explore Kits
Explore all augmented reality, virtual reality open source software, libraries, packages, source code, cloud functions and APIs.

Augmented reality (AR) is an interactive experience of a real-world environment where the objects that reside in the real world are enhanced by computer-generated perceptual information, sometimes across multiple sensory modalities, including visual, auditory, haptic, somatosensory and olfactory. Virtual reality (VR) is a simulated experience that can be similar to or completely different from the real world. Applications of virtual reality include entertainment (e.g. video games) and education (e.g. medical or military training). Other distinct types of VR-style technology include augmented reality and mixed reality, sometimes referred to as extended reality or XR.

Explore Related Topics

Popular New Releases in Virtual Reality

aframe

v1.2.0

engine

v1.53.2

Relativty

Relativty 2 early Release

MixedRealityToolkit-Unity

Microsoft Mixed Reality Toolkit v2.7.3

openvr

v1.16.8

aframe

v1.2.0

engine

v1.53.2

Relativty

Relativty 2 early Release

MixedRealityToolkit-Unity

Microsoft Mixed Reality Toolkit v2.7.3

openvr

v1.16.8

Popular Libraries in Virtual Reality

AR.js

by jeromeetienne html

star image 15308 MIT

Efficient Augmented Reality for the Web - 60fps on mobile!

ar-cutpaste

by cyrildiagne typescript

star image 14263 MIT

Cut and paste your surroundings using AR

aframe

by aframevr javascript

star image 13681 MIT

:a: web framework for building virtual reality experiences.

engine

by playcanvas javascript

star image 7301 MIT

Fast and lightweight JavaScript game engine built on WebGL and glTF

Awesome-ARKit

by olucurious swift

star image 6962

A curated list of awesome ARKit projects and resources. Feel free to contribute!

Relativty

by relativty c++

star image 5416 GPL-3.0

An open source VR headset with SteamVR supports for $200

MixedRealityToolkit-Unity

by microsoft csharp

star image 5032 MIT

Mixed Reality Toolkit (MRTK) provides a set of components and features to accelerate cross-platform MR app development in Unity.

ARKit-CoreLocation

by ProjectDent swift

star image 4993 MIT

Combines the high accuracy of AR with the scale of GPS data.

openvr

by ValveSoftware c++

star image 4789 BSD-3-Clause

OpenVR SDK

AR.js

by jeromeetienne html

star image 15308 MIT

Efficient Augmented Reality for the Web - 60fps on mobile!

ar-cutpaste

by cyrildiagne typescript

star image 14263 MIT

Cut and paste your surroundings using AR

aframe

by aframevr javascript

star image 13681 MIT

:a: web framework for building virtual reality experiences.

engine

by playcanvas javascript

star image 7301 MIT

Fast and lightweight JavaScript game engine built on WebGL and glTF

Awesome-ARKit

by olucurious swift

star image 6962

A curated list of awesome ARKit projects and resources. Feel free to contribute!

Relativty

by relativty c++

star image 5416 GPL-3.0

An open source VR headset with SteamVR supports for $200

MixedRealityToolkit-Unity

by microsoft csharp

star image 5032 MIT

Mixed Reality Toolkit (MRTK) provides a set of components and features to accelerate cross-platform MR app development in Unity.

ARKit-CoreLocation

by ProjectDent swift

star image 4993 MIT

Combines the high accuracy of AR with the scale of GPS data.

openvr

by ValveSoftware c++

star image 4789 BSD-3-Clause

OpenVR SDK

Trending New libraries in Virtual Reality

ar-cutpaste

by cyrildiagne typescript

star image 14263 MIT

Cut and paste your surroundings using AR

AR.js

by AR-js-org javascript

star image 3449 MIT

Image tracking, Location Based AR, Marker tracking. All on the Web.

react-xr

by pmndrs javascript

star image 1002 MIT

🤳 VR/AR with react-three-fiber

three-mesh-ui

by felixmariotto javascript

star image 686 MIT

⏹ Make VR user interfaces for Three.js

RealityMixer

by fabio914 c

star image 641 GPL-2.0

Mixed Reality app for iOS

mind-ar-js

by hiukim javascript

star image 621 MIT

Web Augmented Reality. Image Tracking, Face Tracking. Tensorflow.js

PaintingLight

by lllyasviel python

star image 550 Apache-2.0

Generating Digital Painting Lighting Effects via RGB-space Geometry (SIGGRAPH2020/TOG2020)

April-Tag-VR-FullBody-Tracker

by ju1ce c++

star image 510 MIT

Full-body tracking in VR using AprilTag markers.

arcore-depth-lab

by googlesamples csharp

star image 445 Apache-2.0

ARCore Depth Lab is a set of Depth API samples that provides assets using depth for advanced geometry-aware features in AR interaction and rendering. (UIST 2020)

ar-cutpaste

by cyrildiagne typescript

star image 14263 MIT

Cut and paste your surroundings using AR

AR.js

by AR-js-org javascript

star image 3449 MIT

Image tracking, Location Based AR, Marker tracking. All on the Web.

react-xr

by pmndrs javascript

star image 1002 MIT

🤳 VR/AR with react-three-fiber

three-mesh-ui

by felixmariotto javascript

star image 686 MIT

⏹ Make VR user interfaces for Three.js

RealityMixer

by fabio914 c

star image 641 GPL-2.0

Mixed Reality app for iOS

mind-ar-js

by hiukim javascript

star image 621 MIT

Web Augmented Reality. Image Tracking, Face Tracking. Tensorflow.js

PaintingLight

by lllyasviel python

star image 550 Apache-2.0

Generating Digital Painting Lighting Effects via RGB-space Geometry (SIGGRAPH2020/TOG2020)

April-Tag-VR-FullBody-Tracker

by ju1ce c++

star image 510 MIT

Full-body tracking in VR using AprilTag markers.

arcore-depth-lab

by googlesamples csharp

star image 445 Apache-2.0

ARCore Depth Lab is a set of Depth API samples that provides assets using depth for advanced geometry-aware features in AR interaction and rendering. (UIST 2020)

Top Authors in Virtual Reality

1

microsoft

29 Libraries

9752

2

MozillaReality

20 Libraries

2418

3

jeromeetienne

15 Libraries

15863

4

udacity

14 Libraries

98

5

maxxfrazer

13 Libraries

1147

6

PacktPublishing

13 Libraries

144

7

immersive-web

13 Libraries

4977

8

Unity-Technologies

12 Libraries

5925

9

Utopiah

11 Libraries

71

10

marpi

10 Libraries

240

1

29 Libraries

9752

2

20 Libraries

2418

3

15 Libraries

15863

4

14 Libraries

98

5

13 Libraries

1147

6

13 Libraries

144

7

13 Libraries

4977

8

12 Libraries

5925

9

11 Libraries

71

10

10 Libraries

240

Trending Kits in Virtual Reality

AR Core app allows users to experience augmented reality on their Android devices. This kit helps developers and users to experience their own 3d models in their Android devices. The users have the liberty to choose their own 3d models with all the fun elements also. Please see below a sample solution kit to jumpstart your solution on AR App using Android Kit. To use this kit to build your own solution, scroll down to the Kit Deployment Instructions sections.

Development Environment

The Android Studio IDE is open source and used for this development. It has a rich UI development environment with templates to give new developers launching their innovations into Android development.

Android Libraries

ARCore is the advanced platform that enables Android app developers and users to quickly and easily build AR experiences into their mobile apps and games.

Google Sceneform is an open-source 3D framework that makes it easy for you to build ARCore apps.

Android-Gradle is the open-source Android framework used to develop AR projects.

AR Fragments are used to build these ARCore apps.

Instruction to Replace 3d Models

  1. To place your own 3d model, initially, you need to set up your Android studio with "Google Sceneform Tool (Beta)"
  2. To install Google Sceneform Tool just follow the below steps : a. Go to file > settings b. In settings, click on 'plugins' c. In plugins search for "Google Sceneform Tool" in Marketplace d. Once you find, Install and restart the Android Studio
  3. Place your 3d model obj and mtl file in sampledata folder in the application Note:- Name of the obj file should be in lowercase
  4. Make a raw folder under app > src > main > res > raw
  5. Right-click on the obj file and generate the Sceneform for your 3d model under the raw folder.

Support

If you need help to use this kit, you can email us at kandi.support@openweaver.com or direct message us on Twitter Message @OpenWeaverInc.

kandi

1-Click Install

Why is Facebook is rebranding itself to focus on the metaverse? 7 years after its billion-dollar acquisition of Oculus, Facebook is pivoting itself towards virtual reality. While the earlier acquisitions of Instagram and WhatsApp successfully extended social engagement, metaverse is a much bigger bet. While metaverse looks like VR in a new bottle at some levels, betting the company's future on metaverse shows a strategic intent. It was interesting to see Microsoft announce immersive experiences on MS Teams. Multiple metaverses exist today in individual 3D gaming platforms and VR platforms. We are seeing companies fighting it out for cloud and AI platform dominance. Could Meta be positioning itself to own the user engagement channel in a new way? If users move towards using VR as a primary engagement model, this can pay off well. While this will play out over the decade or more, there are multiple low-hanging fruits to build mixed reality experiences into your applications. The kandi kit on Mixed Reality Solutions showcases popular open source libraries across AR, dedicated VR platforms, and device-specific solutions. Get ready for the next platform war!

Web Focused AR and VR Solutions

Virtual Reality Platforms

Virtual Reality Headset Focused Solutions

Facebook's Metaverse is vaporware as of today, but it has people talking and looking at new opportunities. Especially the developers: with virtual reality all set to raid the mainstream, application development that can support 3-dimensional experiences do display certain developmental complications and require experimentation. In fact, Statista reports that virtual reality is a market the size of $4.8 billion (2021). That being so, there is immense potential and a bright future for developers honing their skills in the niche. Metaverse isn’t a single entity, as opposed to common belief: it is merely a “status” or a platform where people can gather, kind of like social media. In fact, tech-biggies like Microsoft and Nvidia have their own purpose-driven versions of metaverse platforms where users can log on and accomplish certain goals. Commercial biggie metaverses apart, there are quite a few open-source metaverses in the realm – like that of Mozilla i.e. Mozilla Hub. Developers take note: virtual reality is soon coming into the mainstream, and the development of applications that can bridge the real and the virtual is going to be in demand. Open source holds quite a leverage in the development of metaverse components, being universal and readily implementable. Much like the 1900s saw a boom in two-dimensional internet, 2020 and onwards is the era of three-dimensional experiences in virtual reality. There is a high opportunity and potential for the developers here. So, if you are looking to kickstart your Metaverse application development, here are trending libraries that help will you ace your requirements.

Virtual, Augmented, and Mixed realities bring in additional dimensions of collaboration in this distributed world. This collection represents a starter collection to experiment with different mixed reality use cases. It showcases toolkits, remote work use cases, and other exciting use cases for you to try across C#, JavaScript, and Java. If you have specific technologies or use cases in mind, use our search to find libraries specific to you.

Augmented reality enables you to bring virtual objects into your environment, augmenting the real world around with new digital content. With AR Kit, you can create experiences that integrate virtual images into the real world to interact with people, things, places, and services; simply by walking around a store, office, outdoors, or at home with a mobile device in their hands. A-Frame is a web framework for building virtual reality experiences. A-Frame is built on top of the web platform to allow it to work across multiple browsers without plugins. Arframe is a library that provides React components for working with A-Frame and React components for working with AR.js (AR library). Networked-aframe is an extension that makes it possible to use interactivity between multiple devices running A-Frame by connecting them over the WebRTC protocol. The entire list of open-source repos, popular and easy to use AR-specific libraries and a demo is provided below.

Aframe for Augmented Reality

A-Frame is an open-source web framework used for building Augmented reality (AR) experiences.

Three.js for AR Libraries

Three.js is the open-source web framework used to develop augmented reality (AR) projects.

Web AR Libraries

Web-based augmented reality (WebAR) is the most advanced technology that allows users to access AR experiences directly from their smartphones.

One of the advantages of using VRChat is that you can use third-party libraries. This includes things like cats-blender-plugin, UdonSharp, and VRCX. The main reason why people choose to use these libraries is because they provide a ready-to-use avatar model with animations. This saves you time and effort, as you don't have to create your own model from scratch or spend hours on animation. cats-blender-plugin provides a number of utilities for working with meshes and textures. This includes mesh generation, mesh manipulation, and texture extraction from image files. You may also find it useful if you need access to some of the more advanced features of Blender's API. The VRChat SDK provides an API for interacting with users and avatars, as well as an interface for adding new features to your game or experience. There are several popular open source VRChat libraries available for developers

Now, most people have not heard of the hype of augmented reality and virtual reality that is driving the world of technology. Creating a high-quality augmented reality app is not as easy as it sounds. Here you can take a look at the augmented reality framework for iOS or Android and make a few comparisons to help you choose the best-augmented reality framework for your mobile app development.

Types of Augmented Reality Apps

Kudan. AR SDK. or Framework

One of the handiest augmented reality development tools, that works quite fast and allows you to use object-based recognition with posters/ stickers. Kudan recognizes objects by initializing their coordinates and adding a layer up on top of them, although this SDK doesn’t offer much for face detection.

Vuforia, Augmented Reality SDK

Vuforia uses computer vision to recognize and track planar images (Image Targets) and simple 3D objects, such as boxes, in real-time. we can also get to grips with some additional features, Including:

Wikitude SDK

Wikitude is an all-in-one included augmented reality framework for Android, as well as for iOS, which enables developers to use GEO data, create a 3D object, and implement image recognition. Apps like Time Magazine Special, ROOMLE, and Wikitude Navigation were developed with the Wikitude library. Wikitude SDK 8.1 has a number of new features like :

ARToolKit

Another popular framework that is pretty commonly used worldwide is ARToolKit - a well-known open-source augmented reality framework that has compiled SDKs for iOS, Android, Windows, Mac OS, and Linux platforms. It is widely used for various purposes as :

ARKit 2

It is a framework, that allows developers to create all the above-listed types of AR applications. This new cutting-edge platform was designed to prove Augmented Reality development for Apple devices specifically. This technology is unique because it is able to take the corner illumination into account for the correct integration of virtual objects in real life.

Augmented reality (AR) and Virtual Reality (VR) bridge the digital and physical worlds. They allow us to take in information and content visually, in the same way, we take in the world. For easier development of such realities, there are many libraries and frameworks. With the help of these, we could create our own reality environments. Here I've listed some of such frameworks which can be used to get started with.

With Facebook rebranding itself as Meta and multiple corporations betting on the Metaverse, the interest for development on Metaverse and Extended Reality (XR) have peaked. And it’s no surprise: XR technologies are changing the way we interact with our environment while offering immersive experiences. But what is Extended Reality (XR)? Extended Reality (XR) is an environment or experience that combines virtual and physical realities through the use of augmented reality (AR), mixed reality, virtual reality (VR) or any similar immersive technologies. Think Pokemon Go or The Walking Dead: Our World — games that combine your phone’s camera with a layer of 3D animated objects superimposed on top of it. Or imagine being able to virtually open up a virtual world inside of real-world buildings, like in Ready Player One. Whether you’re new to XR and just starting out, or you’re looking for specific tools to help you in your development process, you can use the following open source resources for your Extended Reality (XR) applications.

AR Core app allows users to experience augmented reality on their Android devices. This kit helps developers and users to experience their own 3d models in their Android devices. The users have the liberty to choose their own 3d models with all the fun elements also. Please see below a sample solution kit to jumpstart your solution on AR App using Android Kit. To use this kit to build your own solution, scroll down to the Kit Deployment Instructions sections.

Development Environment

The Android Studio IDE is open source and used for this development. It has a rich UI development environment with templates to give new developers launching their innovations into Android development.

Android Libraries

ARCore is the advanced platform that enables Android app developers and users to quickly and easily build AR experiences into their mobile apps and games.

Google Sceneform is an open-source 3D framework that makes it easy for you to build ARCore apps.

Android-Gradle is the open-source Android framework used to develop AR projects.

AR Fragments are used to build these ARCore apps.

Instruction to Replace 3d Models

  1. To place your own 3d model, initially, you need to set up your Android studio with "Google Sceneform Tool (Beta)"
  2. To install Google Sceneform Tool just follow the below steps : a. Go to file > settings b. In settings, click on 'plugins' c. In plugins search for "Google Sceneform Tool" in Marketplace d. Once you find, Install and restart the Android Studio
  3. Place your 3d model obj and mtl file in sampledata folder in the application Note:- Name of the obj file should be in lowercase
  4. Make a raw folder under app > src > main > res > raw
  5. Right-click on the obj file and generate the Sceneform for your 3d model under the raw folder.

Support

If you need help to use this kit, you can email us at kandi.support@openweaver.com or direct message us on Twitter Message @OpenWeaverInc.

kandi

1-Click Install

Why is Facebook is rebranding itself to focus on the metaverse? 7 years after its billion-dollar acquisition of Oculus, Facebook is pivoting itself towards virtual reality. While the earlier acquisitions of Instagram and WhatsApp successfully extended social engagement, metaverse is a much bigger bet. While metaverse looks like VR in a new bottle at some levels, betting the company's future on metaverse shows a strategic intent. It was interesting to see Microsoft announce immersive experiences on MS Teams. Multiple metaverses exist today in individual 3D gaming platforms and VR platforms. We are seeing companies fighting it out for cloud and AI platform dominance. Could Meta be positioning itself to own the user engagement channel in a new way? If users move towards using VR as a primary engagement model, this can pay off well. While this will play out over the decade or more, there are multiple low-hanging fruits to build mixed reality experiences into your applications. The kandi kit on Mixed Reality Solutions showcases popular open source libraries across AR, dedicated VR platforms, and device-specific solutions. Get ready for the next platform war!

Web Focused AR and VR Solutions

Virtual Reality Platforms

Virtual Reality Headset Focused Solutions

Facebook's Metaverse is vaporware as of today, but it has people talking and looking at new opportunities. Especially the developers: with virtual reality all set to raid the mainstream, application development that can support 3-dimensional experiences do display certain developmental complications and require experimentation. In fact, Statista reports that virtual reality is a market the size of $4.8 billion (2021). That being so, there is immense potential and a bright future for developers honing their skills in the niche. Metaverse isn’t a single entity, as opposed to common belief: it is merely a “status” or a platform where people can gather, kind of like social media. In fact, tech-biggies like Microsoft and Nvidia have their own purpose-driven versions of metaverse platforms where users can log on and accomplish certain goals. Commercial biggie metaverses apart, there are quite a few open-source metaverses in the realm – like that of Mozilla i.e. Mozilla Hub. Developers take note: virtual reality is soon coming into the mainstream, and the development of applications that can bridge the real and the virtual is going to be in demand. Open source holds quite a leverage in the development of metaverse components, being universal and readily implementable. Much like the 1900s saw a boom in two-dimensional internet, 2020 and onwards is the era of three-dimensional experiences in virtual reality. There is a high opportunity and potential for the developers here. So, if you are looking to kickstart your Metaverse application development, here are trending libraries that help will you ace your requirements.

Virtual, Augmented, and Mixed realities bring in additional dimensions of collaboration in this distributed world. This collection represents a starter collection to experiment with different mixed reality use cases. It showcases toolkits, remote work use cases, and other exciting use cases for you to try across C#, JavaScript, and Java. If you have specific technologies or use cases in mind, use our search to find libraries specific to you.

Augmented reality enables you to bring virtual objects into your environment, augmenting the real world around with new digital content. With AR Kit, you can create experiences that integrate virtual images into the real world to interact with people, things, places, and services; simply by walking around a store, office, outdoors, or at home with a mobile device in their hands. A-Frame is a web framework for building virtual reality experiences. A-Frame is built on top of the web platform to allow it to work across multiple browsers without plugins. Arframe is a library that provides React components for working with A-Frame and React components for working with AR.js (AR library). Networked-aframe is an extension that makes it possible to use interactivity between multiple devices running A-Frame by connecting them over the WebRTC protocol. The entire list of open-source repos, popular and easy to use AR-specific libraries and a demo is provided below.

Aframe for Augmented Reality

A-Frame is an open-source web framework used for building Augmented reality (AR) experiences.

Three.js for AR Libraries

Three.js is the open-source web framework used to develop augmented reality (AR) projects.

Web AR Libraries

Web-based augmented reality (WebAR) is the most advanced technology that allows users to access AR experiences directly from their smartphones.

One of the advantages of using VRChat is that you can use third-party libraries. This includes things like cats-blender-plugin, UdonSharp, and VRCX. The main reason why people choose to use these libraries is because they provide a ready-to-use avatar model with animations. This saves you time and effort, as you don't have to create your own model from scratch or spend hours on animation. cats-blender-plugin provides a number of utilities for working with meshes and textures. This includes mesh generation, mesh manipulation, and texture extraction from image files. You may also find it useful if you need access to some of the more advanced features of Blender's API. The VRChat SDK provides an API for interacting with users and avatars, as well as an interface for adding new features to your game or experience. There are several popular open source VRChat libraries available for developers

Now, most people have not heard of the hype of augmented reality and virtual reality that is driving the world of technology. Creating a high-quality augmented reality app is not as easy as it sounds. Here you can take a look at the augmented reality framework for iOS or Android and make a few comparisons to help you choose the best-augmented reality framework for your mobile app development.

Types of Augmented Reality Apps

Kudan. AR SDK. or Framework

One of the handiest augmented reality development tools, that works quite fast and allows you to use object-based recognition with posters/ stickers. Kudan recognizes objects by initializing their coordinates and adding a layer up on top of them, although this SDK doesn’t offer much for face detection.

Vuforia, Augmented Reality SDK

Vuforia uses computer vision to recognize and track planar images (Image Targets) and simple 3D objects, such as boxes, in real-time. we can also get to grips with some additional features, Including:

Wikitude SDK

Wikitude is an all-in-one included augmented reality framework for Android, as well as for iOS, which enables developers to use GEO data, create a 3D object, and implement image recognition. Apps like Time Magazine Special, ROOMLE, and Wikitude Navigation were developed with the Wikitude library. Wikitude SDK 8.1 has a number of new features like :

ARToolKit

Another popular framework that is pretty commonly used worldwide is ARToolKit - a well-known open-source augmented reality framework that has compiled SDKs for iOS, Android, Windows, Mac OS, and Linux platforms. It is widely used for various purposes as :

ARKit 2

It is a framework, that allows developers to create all the above-listed types of AR applications. This new cutting-edge platform was designed to prove Augmented Reality development for Apple devices specifically. This technology is unique because it is able to take the corner illumination into account for the correct integration of virtual objects in real life.

Augmented reality (AR) and Virtual Reality (VR) bridge the digital and physical worlds. They allow us to take in information and content visually, in the same way, we take in the world. For easier development of such realities, there are many libraries and frameworks. With the help of these, we could create our own reality environments. Here I've listed some of such frameworks which can be used to get started with.

With Facebook rebranding itself as Meta and multiple corporations betting on the Metaverse, the interest for development on Metaverse and Extended Reality (XR) have peaked. And it’s no surprise: XR technologies are changing the way we interact with our environment while offering immersive experiences. But what is Extended Reality (XR)? Extended Reality (XR) is an environment or experience that combines virtual and physical realities through the use of augmented reality (AR), mixed reality, virtual reality (VR) or any similar immersive technologies. Think Pokemon Go or The Walking Dead: Our World — games that combine your phone’s camera with a layer of 3D animated objects superimposed on top of it. Or imagine being able to virtually open up a virtual world inside of real-world buildings, like in Ready Player One. Whether you’re new to XR and just starting out, or you’re looking for specific tools to help you in your development process, you can use the following open source resources for your Extended Reality (XR) applications.

Trending Discussions on Virtual Reality

    Algorithm to fill arbitrary marked/selected tiles on a square grid with the smallest number of rectangles?
    Centering element in LaTeX table with fixed column width
    How can I display an array of strings of an object as spans in a JS template literal?
    Python regular expression unable to find pattern - using pyspark on Apache Spark
    Why is my website slightly wider than the window?
    Unity Gameobject not visible in Hololens 2
    Why does my webpage look different upon resizing the browser window VS on mobile?
    NoClassDefFoundError in OSGi although it is exported and imported
    Why does the mobile-version navbar pops up automatically when downsizing screen?
    count sum of values of selected radio buttons which have particular data-id

QUESTION

Algorithm to fill arbitrary marked/selected tiles on a square grid with the smallest number of rectangles?

Asked 2022-Jan-12 at 15:58

What I am asking here is an algorithm question. I'm not asking for specifics of how to do it in the programming language I'm working in or with the framework and libraries I'm currently using. I want to know how to do this in principle.

As a hobby, I am working on an open source virtual reality remake of the 1992 first-person shooter game Wolfenstein 3D. My program will support classic mods and map packs for WOLF3D made in the original format from the 90s. This means that my program will not know in advance what the maps are going to be. They are loaded in at runtime from user provided files.

A Wolfenstein 3D map is a 2D square grid of normally 64x64 tiles. let's assume I have a 2D array of bools which return true if a particular tile can be traversed by the player and false if the tile will never be traversable no matter what happens in the game.

I want to generate rectangular collision objects for a modern game engine which will prevent collisions into non traversable tiles on the map. Right now, I have a small collision object on each surface of each wall tile with a traversible tile next to it and that is very inefficient because it makes way more collision objects than necessary. What I should have instead is a smaller number of large rectangles which fill all of the squares on the grid where that 2D array I mentioned has a false value to indicate non-traversible.

When I search for any algorithms or research that might have been done for problems similar to this, I find lots of information about rectangle packing for the purposes of making texture atlases for games, which packs rectangles into a square, but I haven't found anything that tries to pack the smallest number of rectangles into an arbitrary set of selected / marked square tiles.

The naive approach which occurs to me is to first make 64 rectangles representing 64 rows and then chop out whatever squares are traversible. but I suspect that there's got to be an algorithm which can do better, meaning that it can fill the same spaces with a smaller number of rectangles. Maybe something that starts with my naive approach and then checks each rectangle for adjacent rectangles which it could merge with? But I'm not sure how far to take that approach or if it will even truly reduce the number of rectangles.

The result doesn't have to be perfect. I am just fishing here to see if anyone has any magic tricks that could take me even a little bit beyond the naive approach.

Has anyone done this before? What is it called? Just knowing what some of the vocabulary words I would need to even talk about this are would help. Thanks!

(later edit)

Here is some sample input as comma-separated values. The 1s represent the area that must be filled with the rectangles while the 0s represent the area that should not be filled with the rectangles.

I expect that the result would be a list of sets of 4 integers where each set represents a rectangle like this:

  1. First integer would be the x coordinate of the left/western edge of the rectangle.
  2. Second integer would be the y coordinate of the top/northern edge of the rectangle.
  3. Third integer would be the width of the rectangle.
  4. Fourth integer would be the depth of the rectangle.

My program is in C# but I'm sure I can translate anything in a normal mainstream general purpose programming language or psuedocode.

ANSWER

Answered 2022-Jan-12 at 14:46
1Mark all tiles as not visited
2For each tile:
3    skip if the tile is not a top-left corner or was visited before
4    # now, the tile is a top-left corner
5    expand right until top-right corner is found
6    expand down
7    save the rectangle
8    mark all tiles in the rectangle as visited
9

However simplistic it looks, it will likely generate minimal number of rectangles - simply because we need at least one rectangle per pair of top corners.

For faster downward expansion, it makes sense to precompute a table holding sum of all element top and left from the tile (aka integral image).

For non-overlapping rectangles, worst case complexity for an n x n "image" should not exceed O(n^3). If rectangles can overlap (would result in smaller number of them), integral image optimization is not applicable and the worst case will be O(n^4).

Source https://stackoverflow.com/questions/70674385