Git Product home page Git Product logo

3dstreet's Introduction

3DStreet

Version License Build Status

3DStreet creates 3D visualizations of your 2D Streetmix.net streets using A-Frame and WebXR. Developers can use the same core street A-Frame component of 3DStreet for their own projects.

Online Tool

Start 3DStreet

(or visit https://3dstreet.app)

The rest of this README is for developers. User-facing docs are here.

This repo is the 3DStreet Core Viewer. It provides parsing of JSON in Streetmix format into a 3DStreet scene. It also provides all of the core components needed for viewers. It is also a core dependency of the 3DStreet Editor hosted in a separate repository.

Project Hosting Path

This repo's main branch is hosted via github pages at github.3dstreet.org. The 3DStreet Editor uses this path to fetch 3DStreet dependencies. A-Frame developers leveraging 3DStreet Core will also use this path.

A-Frame component

3DStreet is built upon a custom A-Frame street component which is also available for you to customize for your own custom A-Frame street scenes. The street component takes a string of JSON and renders one or more "segments" (also known as lanes or slices) of a street and optionally buildings and ground to the left and right.

Usage Example

Remix

<html>
  <head>
    <title>Street Component!</title>
    <script src="https://aframe.io/releases/1.5.0/aframe.min.js"></script>
    <script src="https://unpkg.com/[email protected]/dist/aframe-street-component.js"></script>
  </head>  
  <body>
    <a-scene>
      <a-entity id="mySimpleStreet" street streetmix-loader="streetmixStreetURL: https://streetmix.net/kfarr/3/" ></a-entity>
    </a-scene>
  </body>
</html>

A-Frame street Component API

The street component creates a street made up of one or more segments as children of the entity it's attached to. It may also create buildings, ground, and place models in the scene using mixins. Creating the JSON array of segments by hand is cumbersome and typically the streetmix-loader component (below) is also used on the same entity to populate the street JSON from a Streetmix.net street.

Property Description Default Value
JSON A string of JSON containing an array one or more segments (also known as slices) representing cross-section parts of a street. See basic-json.html for an example of proper usage ''
type A string representing the formatting of the JSON passed in the JSON property 'streetmixSegmentsFeet'
left A string to determine which building variant to create for the left side of the street (heading outbound) ''
right A string to determine which building variant to create for the right side of the street (heading outbound). ''
showGround A boolean to determine if the ground associated with theย specified building variant(s) in left and right should be created or not. true
showStriping A boolean to determine if the lane stripings should be created or not. true
length A number that sets the street's length in meters 150

A-Frame intersection Component API

The intersection component creates an intersection surface with options for adding curbs, sidewalks, crosswalks, stop signs, and traffic signals.

Property Description Default Value
dimensions Specifies the width and depth of the intersection. First value represents width, second value represents depth. '20 20'
sidewalk Sets the width of the sidewalk at each side of the intersection. Values are set in the order of west, east, north, south. '0 0 0 0'
northeastcurb Sets the curb dimensions for the north east curb. Values are updated as width, then depth. '0 0'
southwestcurb Sets the curb dimensions for the south west curb. Values are updated as width, then depth. '0 0'
southeastcurb Sets the curb dimensions for the south east curb. Values are updated as width, then depth. '0 0'
northwestcurb Sets the curb dimensions for the north west curb. Values are updated as width, then depth. '0 0'
stopsign Sets if each side of the intersection has a stop sign. Values are set in the order of east, west, north, south. 0 is false, 1 is true. '0 0 0 0'
trafficsignal Sets if each side of the intersection has a traffic signal. Values are set in the order of east, west, north, south. 0 is false, 1 is true. '0 0 0 0'
crosswalk โ€‹โ€‹Sets if each side of the intersection has a crosswalk. Values are set in the order of east, west, north, south. 0 is false, 1 is true. '0 0 0 0'

A-Frame streetmix-loader Component API

The streetmix-loader component requests a Streetmix API response when given a unique street URL and then passes the segments array JSON as a string to the street component (which is a dependency -- you must have the street component on the same entity as that of the streetmix-loader component).

Property Description Default Value
streetmixStreetURL A string representing a "user facing" Streetmix street URL such as https://streetmix.net/kfarr/3/ ''
streetmixAPIURL A string representing the Streetmix API street URL such as https://streetmix.net/api/v1/streets/7a633310-e598-11e6-80db-ebe3de713876 ''
showBuildings A Boolean that determines whether or not buildings are rendered true

Either 1 of the 2 properties are required. If both are provided the component will use streetmixAPIURL value and ignore streetmixStreetURL.

Orientation and Scale

A default Streetmix.net cross-section view is oriented to show vehicles heading away from you as "outbound". The street component follows this convention and when placed in a new A-Frame scene the default camera is looking toward the outbound direction of the generated street. The default rendering is 1:1 scale.

Automatic Asset Loading

When aframe-street-component.js is included on a page it automatically loads 3D models and other assets using the A-Frame asset loader by adding them to the scene's a-assets block and defining mixins pointing to these assets. The street component itself simply places entities with appropriate mixin names. For more information on the asset loader see this docs link.

Additional variant strings

  • The word animated can be added to the variantString of the type sidewalk to make the pedestrians animated. Here is an example of how this can be implemented:
{
  "width": 9,
  "variantString": "normal|animated",
  "type": "sidewalk"
}

Please see animated.html for a demo.

List of Supported Segment Types

3DStreet does not yet support all of the street segments found in Streetmix. You may find some segments don't display at all or are missing 3D elements. Here is a complete list:

Streetmix Segment Type 3DStreet Support? Variants Notes and Model Source
sidewalk Yes - Partial empty All variants show empty sidewalk, no pedestrian 3d models or density variants.
sidewalk-lamp Yes - All Variants: right, left, both Subvariants: modern, traditional, pride Modern Lamp Post, License Google Poly CC Attrib; Traditional Lamp Post, License Google Poly CC Attrib
bike-lane Yes - All Variants: regular, red, green No bikes shown
drive-lane Yes - Partial car-type: "car" and "sharrow" Not supported: car-type truck and autonomous vehicle
turn-lane Yes - All left right left-right-straight shared both left-straight right-straight straight Note: there appears to be a bug with Streetmix.net rendering of turn-lane-orientation variant in street cross section for inbound - it appears to be inverted from the street's json database value. streetmix/streetmix#683. Note: Shared turn lane does not exhibit proper segment lane markings.
bus-lane Yes - Partial shared (sharrow) variant not supported Model Credits: New Flyer XD40 Bus
divider Yes - Partial striped-buffer, bollard striped-buffer is rendered for all variants. Original model credit: Flexi Guide 300 Safe Hit Post
parking-lane Yes - Partial parking-lane-direction and parking-lane-orientation unsupported, parking delimiter markings unsupported
sidewalk-tree Yes - All palm-tree, big Supports palm tree and normal ("big") street tree. Palm Tree: License Google Poly CC Attrib, Model Source, Street Tree: License Sketchfab "Standard", Polygon City Pack
sidewalk-bench Yes - Partial left, right "center" bench not supported.
sidewalk-bike-rack Yes - Partial Doesn't support height -- always at sidewalk level. No bike model yet, just the rack. Model credits: Bike Rack by illustrationlogic, License CC BY NC SA 4.0
sidewalk-wayfinding Yes - Partial small, medium, large variants all render same object All size variants render the same simple wayfinding obelisk shape with texture based on original NYC design from Pentagram..
parklet No
light-rail Yes - All grass variant displays as green color asphalt Model credits: Siemens Avenio, License CC BY NC SA 4.0; Train track 2 black, License Google Poly CC BY
streetcar Yes - All grass variant displays as green color asphalt Model credit: Godarville Tram, License Turbo Squid Royalty Free
transit-shelter Yes - Partial Doesn't support height -- always at sidewalk level.
train No No support planned, not a public Streetmix segment type.
scooter Yes - All Variants: regular, red, green No scooters shown. (Treated identically to a bike lane.)
scooter-drop-zone No
bikeshare Yes left right Rendered every 100 meters. Original model credit
food-truck No
flex-zone No
flex-zone-curb No

List of Building Variants

"Buildings" are lots and/or objects rendered on either side of the street to add to the setting.

Streetmix Building Variants 3DStreet Support? Notes
grass Yes https://www.textures.com/download/grass0052/12094
fence Yes Fence Model: Paid Royalty Free License CGTrader.com T&Cs Paragraph 21 for construction fence Low-poly 3D model
parking-lot Yes https://www.textures.com/download/roads0111/53096
waterfront Yes Credit to @Lady_Ada_King for a-ocean-plane; @threejs for water normal jpeg; cgskies for sky image (paid license). Seawall Models: License Sketchfab "Standard" from Polygon City Pack
residential Yes Buildings: License Synty Store EULA from Polygon Town Pack. Does not support varying floors as specified by Streetmix JSON.
narrow Yes - partial
wide Yes - partial

License

The 3DStreet codebase is offered under the GNU Affero General Public License v3, as specified in the LICENSE file.

Assets such as 3D models, textures, and audio are offered under the Creative Commons By Attribution Non-Commercial License, unless a more specific license is specified for each asset in the documentation on this page.

Contact [email protected] for commercial licensing.

Developer Docs

See this link for more information about the custom components developed and modified for the project.

Model Credits

Audio Credits

Skybox credits

3dstreet's People

Contributors

algorush avatar burritojustice avatar davidek123 avatar dependabot[bot] avatar gnansai avatar haraldreingruber avatar kevincannon avatar kfarr avatar mharegot avatar pjstein avatar srothst1 avatar sweep-ai[bot] 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  avatar

3dstreet's Issues

Sound level low

Test user reports:

Sound level is really low. Wasn't really able to hear something until I turned the volume to the max.

Issue:

  • Tram SFX is nonpositional but low (0.3)
  • BG ambient audio is positional

Instead:

  • Tram SFX should be higher but positional (testing needed)
  • BG should be nonpositional but low

Re-enable 3DStreet sound effects

possible solutions:

  • better messaging of current behavior (reset icon to red x when loading new street?)
  • create a new component "playme" that autoplays the asset if global sound enable constant is true

reduce building complexity and split into parts

  • reduce complexity of buildings (reduce the size and number of parts and buildings)
  • reduce draw calls by merging geometries in blender
  • create named parts for each building that can be referenced in A-Frame to construct larger blocks
  • use some sort of optimization or compression scheme such as draco or meshopt / gltfpack

create tested JSON serializer and deserializer

  • Serializer - convert DOM to JSON, allow for appending more elements to the JSON
  • Deserializer - convert JSON to DOM elements, add them to the scene

Features:

  • support parent / child entity nesting
  • support any components
  • modular to be used in other applications

make a nicer looking sidewalk

  • nicer texture - pbr optional - try out a few from cgaxis as well as look at existing library
  • combine adjacent segments where "isSidewalk" is true to have one combined polygon
  • include properly sized curb
  • max anisotropic filtering since this is a noticeable texture in the horizon

Add movement controls including "snap turn"

From Maximus on A-Frame Slack:

No snap turn made it quite hard to navigate. But i see the hands and can teleport ๐Ÿ‘

I think this means:

  • once positional stick crosses 50% thresh-hold in right or left direction, then add or subtract 45 degrees from current camera rig rotation with a rate limiter of every 1 second if held down

Make tram and other vehicle sounds positional

<a-mixin id="tram" gltf-model="#trammodel" sound="src: #tram-pass-mp3;positional:true;distanceModel:inverse;refDistance:5;rolloffFactor:3;volume: 1"></a-mixin>

  • audio artifacts on playback using positional audio, likely due to the overly complex scene that is skipping frames in Oculus Quest headset.
  • Further, those are not the perfect variable settings as the tram is in motion which results in quieter audio when it approaches and leaves (but correct while it is nearby) so more tweaking will be necessary for this specific use case.

hash striping too dense

the hash striping is too dense and does not match the other roadway striping from north america / california

Additional sound effects for environments

  • seagulls / ocean sound for seaside building type
  • no sound for parking lot (or occasional car alarm? idle vehicles? beeping reverse indicator?)
  • people sound for multiuse - current ambient noise
  • nature sound for empty grass lot

Use instancing to reduce draw calls for cloned objects

Right now objects such as trees, safe hit bollards, light posts, etc. are cloned with a very cumbersome approach to create new entities, each with its own entity that loads and parses a new glTF model for each of the cloned entities. This results in many draw calls and time to load and parse each object.

I think we can reduce draw calls and speed up the loading process by cloning in a more intelligent manner.

I tried A-Frame geometry merger to no avail: #8 (comment)

Things to try:

  • Try using the gltf-part component. Start with one type of object - lamp posts for instance. Put all of them in one glTF file. Their relative position many need to be "reset" and I have modified the gltf-part component here to try to do that.
  • If that works, then create a new "master" blender file and export to glTF for all combined street props that are frequently repeated: trees, benches, light posts, etc.

building interiors

user testers want to go inside a building

  • bonus - be able to take stairs or elevator up to the roof to see the scene from the top

Support Multiple Streetmix "Sections"

Amazing piece of work. I would like to be able to glue a series of Streetmix together to create a 3D scape. Allowing me to show a bus stop bypass or a narrow section of a road.

host on custom domain name?

purchased domain name options: 4d.city or streetmix3d.com

what is the benefit of this? is it worth the effort?

pros to using custom domain:

  • shorter url
  • can control gzip settings to make gltfpack a reasonable solution #4
  • opens the door to more dynamic features and authentication (firebase)

pros to keeping existing github pages url:

  • less maintenance
  • indicates to user that the project is still a "developer" product and a work in progress
  • retains value for streetmix.net to offer simpler interface wrapping of streetmix3d as part of premium service

use simple geometry for train track rails

instead of a gltf object use:

  • slightly elevated highly reflective silver rail (box)
  • ground level no reflection dark black for inner trench for wheel flanges (plane)

current: ~3k tris and 24 draw calls per rail lane
after: 20 tris, 4 draw calls per rail lane

What could be done with an external grant?

For example, if there were a grant for $250k from mozilla or knight:

  • Mozilla mixed reality initiatives - how support mozilla things? Hubs? Firefox Realities? ECS / A-Frame?
  • How does that mix into streetmix? How benefit streetmix: visual design, current conditions, advocacy goals, better seamless integration?
  • Streetmix3d - technical things (performance improvements); lower load time (both 3d/2d); mobile accessibility (3d/2d)
  • What is value to community / planners / engineers / agencies based on user interviews from March 2020?

sometimes duplicate vehicles appear

you can see 2 catenary wires on the trains sometimes when loading a scene -- is the scene being loaded twice?

how to reproduce reliably?

Consider gltfpack'ing assets

Optimizing the building (scenesmall2.glb) in the demo scene, you can drop it from 360 draw calls to 3 draw calls just by running it through gltfpack (although I had to un-draco-ify it first).

That will increase file size a bit (from 1.6mb to 2.6mb after gzip) but 1MB of that is just the billboard textures, which could probably be removed for streetmix's purposes. I thought adding Draco back to the asset afterward would get it back down to the same size, but for some reason it didn't help further.

I didn't test on any other assets in the folder, but gltfpack can be a pretty worthwhile tool a lot of the time. :)

Break out buildings to be programmatically generated

Issue:

  • Right now the building block is a fixed GLTF exported from the asset pack that I purchased from sketchfab.

Impact:

  • The buildings do not reflect settings from a streetmix street's json configuration
  • There are more buildings on the "back" of the block than necessary
  • The buildings do not fill up the entire block

Instead:

  • Buildings should be separated (either in one or multiple GLTFs) so that they can be placed programmatically along the entire block based on a streetmix scene's json configuration

Phase 1: (this ticket) Separate the buildings "as is" with identical height regardless of streetmix json configuration -- use the same height as the current GLTF file
Phase 2: (later ticket) Ability to programmatically change height of buildings using the building "levels" from the asset pack

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.