Git Product home page Git Product logo

realitygeometries's Introduction

RealityGeometries

Add more geometries to your RealityKit projects

Note

Now with visionOS support!


By default, the only shapes available in RealityKit are a Sphere, Cuboid and Plane (with 4 vertices). Until iOS 15 the only clean way to include more geometries in your project is to load them from a USDZ file, which could unnecessarily increase the size of your app, especially when the shape you want to add is a basic one such as a cylinder or cone.

RealityGeometries is a solution to increase the basic mesh offering from RealityKit.

Included in RealityGeometries

  • Cylinder
  • Cone
  • Plane (with more vertices)
  • Path
  • Torus

This repository is open to pull requests as well as feature requests.

More Images

realitygeometries's People

Contributors

farshadtx avatar maxxfrazer avatar scoumbe 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

realitygeometries's Issues

1.1.1 example project doesn't appear to have visionOS Support

attempting to display the example project in the vision pro simulator window [Xcode Version 15.2] but many of the defined shapes do not display. Could be related to the other issue on shapes not displaying in this issue. Or it could be that the example project isn't set up for the Vision simulator. Looks awesome though, thanks!

I have a problem with the Torus - can't render a smooth circle

I want to render a smooth Torus -but it looks like it is only possible to create 30-40 sides.

This works - but gives corners (see attached image):

let torus = ModelEntity(mesh: try! .generateTorus(sides: 30, csSides: 3, radius: 3.99, csRadius: 0.03), materials: [SimpleMaterial(color: .blue, isMetallic: false)])

IMG_F359F48B5C9F-1

Is there an upper limit of the number of sides that is resource constrained by the hard ware?

Feature request: tetrahedron

This is impressive!
You said that you were open to feature requests, so I hope this will be OK to suggest:
It would be great to have a tetrahedron primitive. Even better would be per Vertex colors…
And, blue sky dreaming, a 10-nosed tet with side nodes (vertices) giving quadratic sides to the tetrahedron edges, with many such tetrahedrons (for example finite element visualization).

Little problem about UVs

When I put a image as texture, it's mirrored, the "b" becomes "d". It happens in Cone, Cylinder, Torus. But Cone and Cylinder bottom are right, and DetailPlane is right.

then I use ModelDebugOptionsComponent(visualizationMode: .textureCoordinates) to check uv, I find It's different to uv in Shaders.

I think this is the problem: RealityKit mirror y-axis of uv in some step.
In Mesh of a Plane, the uv origin is at left-bottom corner, y-up to top. (use Shader to visualize uv)
When put image to a Plane, the uv origin is at left-top corner, y-up to bottom, just like UIKit. (use ModelDebugOptionsComponent(visualizationMode: .textureCoordinates) to visualize uv)

Maybe we should change uv in Mesh to match image. But I don't know is it the Right way ?

Can't generate tube or line

Hello 👋🏻

I am trying to build a sort of circle arc, or torus section, using the provided line and tube methods. Here is my sample code:

func points(of radius: Float, from start: Angle2D, to end: Angle2D) -> [SIMD3<Float>] {
    let degrees = Int(abs(start.degrees - end.degrees))
        
    var points = [SIMD3<Float>]()
        
    for i in 0...degrees {
        let angle = Angle2D(degrees: Double(i)).radians
            
        let x = Float(radius * cos(angle))
        let y = Float(radius * sin(angle))
            
        points.append([x, 0, y])
    }
        
    return points
 }

let points = points(of: radius, from: .zero, to: .radians(.pi / 2))
        
guard let mesh = try? RealityGeometry.line(points: points, radius: 1).0 else { return nil }
        
let entity = ModelEntity(mesh: mesh, materials: [PhysicallyBasedMaterial.glassMaterial])

The code runs with no errors and manages to go over the guard line. However, using line or generateTube does not produce any visible entity. Interesting fact: using generatePath with the same points does produce the correct mesh, but path is flat and I need a proper 3D tube-like object.

BTW thank you for this package, it's helping me a lot with my non-existent 3D development skills.

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.