All Projects → spacesvr → spacesvr

spacesvr / spacesvr

Licence: MIT license
A standardized reality for the future of the 3D Web.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to spacesvr

Remixvr
RemixVR is a tool for collaboratively building customisable VR experiences.
Stars: ✭ 129 (-4.44%)
Mutual labels:  threejs, vr, webvr, webxr
Ideaspace
😎 Create interactive 3D and VR web experiences for desktop, mobile & VR devices
Stars: ✭ 344 (+154.81%)
Mutual labels:  threejs, vr, webvr, webxr
webvrrocks
Your guide to Virtual Reality in the browser.
Stars: ✭ 116 (-14.07%)
Mutual labels:  vr, webvr, xr, webxr
Webxr Emulator Extension
WebXR emulator extension
Stars: ✭ 231 (+71.11%)
Mutual labels:  threejs, vr, webxr
a-blast
💥 Save the World From the Cutest Creatures in the Universe!
Stars: ✭ 116 (-14.07%)
Mutual labels:  threejs, vr, webvr
Aframe Vimeo Component
Stream Vimeo videos into WebVR.
Stars: ✭ 62 (-54.07%)
Mutual labels:  threejs, vr, webvr
Aframe Inspector
🔍 Visual inspector tool for A-Frame. Hit *<ctrl> + <alt> + i* on any A-Frame scene.
Stars: ✭ 469 (+247.41%)
Mutual labels:  threejs, vr, webvr
Three.vrcontroller
Support hand controllers for Oculus, Vive, Windows Mixed Reality, Daydream, GearVR, and more by adding VRController to your existing Three.js-based WebVR project.
Stars: ✭ 213 (+57.78%)
Mutual labels:  threejs, webvr, webxr
A Mmd
A-Frame MMD component
Stars: ✭ 74 (-45.19%)
Mutual labels:  threejs, vr, webvr
aframe-react
React library for A-frame
Stars: ✭ 58 (-57.04%)
Mutual labels:  vr, webvr, webxr
Webxr Handtracking
👐 WebXR hand tracking examples
Stars: ✭ 116 (-14.07%)
Mutual labels:  threejs, vr, webxr
Thehallaframe
WebVR demo that displays art
Stars: ✭ 120 (-11.11%)
Mutual labels:  threejs, vr, webvr
Worlds2
Building Virtual Reality Worlds using Three.js
Stars: ✭ 34 (-74.81%)
Mutual labels:  threejs, vr, webvr
Webxr Physics
Adds physics to WebXR
Stars: ✭ 18 (-86.67%)
Mutual labels:  threejs, vr, webxr
lvr
👓 Augmented Reality for everyone - Out of the world experiences
Stars: ✭ 92 (-31.85%)
Mutual labels:  threejs, vr, webvr
A Painter
🎨 Paint in VR in your browser.
Stars: ✭ 539 (+299.26%)
Mutual labels:  threejs, vr, webvr
Awesome Aframe
[DISCONTINUED] Collection of awesome resources for the A-Frame WebVR framework.
Stars: ✭ 1,310 (+870.37%)
Mutual labels:  threejs, vr, webvr
Three Mesh Bvh
A BVH implementation to speed up raycasting against three.js meshes.
Stars: ✭ 302 (+123.7%)
Mutual labels:  threejs, webvr, webxr
Aframe Effects
A VR Ready Post processing framework for Three.js and/or A-Frame
Stars: ✭ 176 (+30.37%)
Mutual labels:  threejs, vr, webvr
Konterball
Konterball is a single or 2-player virtual reality game, built for the web as a Google VR Chrome Experiment.
Stars: ✭ 112 (-17.04%)
Mutual labels:  threejs, vr, webvr


logo

spacesvr

A standardized reality for the future of the 3D Web.

Version Downloads Discord Shield

www.muse.place · demo · discord

logo






About

The mission of spacesvr is to organize and implement the standards for experiencing 3D content on the web in the same way that there exists standards for experiencing 2D content with HTML/CSS/JS.

spacesvr is designed to empower the artist. Instead of worrying about file structures or basic functionality like cross-device compatability, artists should spend their time telling their story. As such, consumption is optimized for simplicity, and the organization provides a framework to tell stories.

spacesvr is actively maintained by Muse, a YC-backed startup that provides tooling for visually building worlds. Muse's mission is to accelerate the adoption of 3D websites by increasing their accessibility, both for the end user and for the creator. Muse is completely built on spacesvr.

Quick Start

Develop

You could set up the framework in your sleep. Just import the package

yarn add spacesvr #or npm install spacesvr

and copy/paste 9 lines of code

import { StandardReality, LostWorld } from "spacesvr";

function World() {
  return (
    <StandardReality>
      <LostWorld /> // an example world with a floor, skybox, and fog
    </StandardReality>
  );
}

this is the starting point for this demo


From this point, your creations will be built by directly using the following technologies:

Under the hood and mostly abstracted away are the following technologies:

Folder Structure

the following are each a fundamental unit and their own folder at the top level of spacesvr, with the pattern recursively re-appearing throughout the repository

ideas are the fundamental building blocks of your world. They are the 3D the equivalent of HTML Elements. They are implemented as React components.

layers (of reality) offer new functionality to the world. They are implemented using a React container component, a context, and a corresponding hook.

logic offers functions to be used when composing your world. They are implemented as individually exported functions and hooks.

realities define how the player experiences your world. They are comparable in function to a browser. They are implemented as a React container component and composed of an ordering of layers.

tools offer the player affordances in your world. They are implemented as ideas using the Tool modifier, accessed by single keystrokes.

worlds are sets of ideas. They are the actual content of your site. They are implemented as compositions of ideas.






Realities

Standard Reality

The Standard Reality defines the standard experiencing the 3D web. The layers provided are the Environment Layer, Physics Layer, Player Layer, and Network Layer. Additionally, it provides an infinite ground to walk on that can be disabled.

<StandardReality
    environmentProps={{...}} // props to be passed to the environment layer
    physicsProps={{...}} // props to be passed to the physics layer
    playerProps={{...}} // props to be passed to the player layer
    networkProps={{...}} // props to be passed to network layer
    disableGround={true} // disable ground in case you want your own
/>

Layers

Environment Layer

The base layer that abstracts away the DOM, allowing you to think only in 3D

type EnvironmentProps = {
  name?: string; // set the name of your environment, shows up in the pause menu
  pauseMenu?: ReactNode; // for you to provide a custom pause menu
  loadingScreen?: ReactNode; // for you to provide a custom loading screen
  dev?: boolean; // hides the pause menu, useful while switching between world and IDE
  canvasProps?: Partial<ContainerProps>; // to edit the r3f canvas props
};
const environmentState = useEnvironment();

type EnvironmentState = {
  name: string;
  paused: boolean;
  setPaused: (p: boolean) => void;
  device: DeviceState; // the current device being used by the player: xr, mobile, or desktop
  containerRef: MutableRefObject<HTMLDivElement | null>;
};

Physics Layer

Provides a default physics configuration

import { PhysicsProps as ProviderProps } from "@react-three/cannon";
type PhysicsProps = ProviderProps;

Player Layer

Provides a user-controlled entity with a standardized set of controls that work cross-platform (VR/Mobile/Desktop)

type PlayerProps = {
  pos?: number[]; // initial player position
  rot?: number; // initial player rotation (radians along Y axis)
  speed?: number; // player movement speed
  controls?: {
    disableGyro?: boolean; // used to disable gyroscope prompt on mobile
  };
};
const playerState = usePlayer();

type PlayerState = {
  position: PlayerVec; //.get() and .set() for position
  velocity: PlayerVec; //.get() and .set() for velocity
  controls: PlayerControls; //.lock() and .unlock() for stopping player movement
  raycaster: Raycaster; // reference to player's raycaster
};

Network Layer

Provides multiplayer out-of-the-box. Muse provides signalling servers and STUN/TURN servers for everyone :).

type NetworkProps = {
  autoconnect?: boolean; // whether to automatically attempt a p2p connection, false by default
  disableEntities?: boolean; // whether to hide users from seeing each other, in case you want to implement yourself
  iceServers?: RTCIceServer[]; // set of ice servers to use (recommended for production!!)
  host?: string; // signalling host url, uses Muse's servers by default
  sessionId?: string; // if you know the session id you want to use, enter it here
  worldName?: string; // the worldname to hash your signal peers by, by default set to the path name
  voice?: boolean; // whether to enable spatial voice chat, false by default
};
const networkState = useNetwork();

type NetworkState = {
  connected: boolean; // whether the user has established connection with signalling server
  connect: (config?: ConnectionConfig) => Promise<void>; // when autoconnect is off, use this to manually connect
  connections: Map<string, DataConnection>; // reference to active peer connections
  disconnect: () => void;
  voice: boolean; // whether voice is enabled
  setVoice: (v: boolean) => void; // enable/disable voice
  mediaConnections: Map<string, MediaConnection>; // reference to active media connections
  useChannel: <Data = any, State = any>(
    id: string,
    type: ChannelType,
    reducer: Reducer<Data, State>
  ) => Channel<Data, State>; // set up a data channel to standardize communication between peers
};

Ideas

types of ideas

  • basis/ for visualizations of fundamental metaphysics
  • environment/ for setting up the environment
  • media/ for importing common media types
  • mediated/ for some basic art assets
  • modifiers/ for modifying other ideas. they don't render anything themselves
  • ui/ for guiding and interacting with the user

basis/

VisualIdea

Visualize an Idea

<VisualIdea idea={new Idea()} />

VisualSite

Visualize a Site

<VisualSite idea={new Site()} />

VisualWorld

Visualize a World

<VisualWorld idea={new World()} />

environment/

Background

Set the background color of your space

<Background color="blue" />

Fog

Add fog to your scene.

<Fog color="white" near={10} far={100} />

InfinitePlane

Adds an infinite plane to walk on (added by default with the Environment Layer)

<InfinitePlane
  height={-0.0001} // offset a slight amount
  size={[100, 100]}
  visible={false}
/>

media/

Audio

A positional audio component that will play the passed in audio url. Handles media playback rules for Safari, iOS, etc.

<Audio
  url="https://link-to-your-audio.mp3"
  position={[0, 4, 0]}
  volume={1}
  rollOff={1}
  dCone={new Vector3(coneInnerAngle, coneOuterAngle, coneOuterGain)} // defaults should be fine
  fftSize={128}
/>

HDRI

Set the scene background to an hdr file. You can find free hdr files here: https://hdrihaven.com/

<HDRI
  src="https://link-to-your-hdri.hdr"
  disableBackground={false} // used to disable visual hdr (skybox)
  disableEnvironment={false} // used to disable environment map
/>

Image

Quickly add an image to your scene

<Image
  src="https://link-to-your-image.png"
  size={1} // size, default normalized to longest side = 1
  framed // adds a frame
/>

Model

Quickly add a GLTF/GLB model to your scene. Will handle Suspense, KTX2, Draco, Meshopt. Clones the gltf scene so the same file can be re-used.

<Model
  src="https://link-to-your-model.glb"
  center // whether to center the model so its bounds are centered on its origin, default false
  normalize // whether to normalize the model to a height/width/depth of 1, default false
/>

Video

Add a video file to your space with positional audio. Handles media playback rules for Safari, iOS, etc.

<Video
  src="https://link-to-your-video.mp4"
  size={1} // size, default normalized to longest side = 1
  volume={1}
  muted // mutes the video
  framed // adds a frame
/>

mediated/

Frame

Builds a frame to showcase media, especially images.

width: number; height: number; thickness?: number; material?: Material; innerFrameMaterial?: Material;

<Frame
  width={1}
  height={1}
  thickness={0.1} // optional, default 0.1
  material={new MeshBasicMaterial({ color: "red" })} // optional, default is a black MeshStandardMaterial
  innerFrameMaterial={new MeshBasicMaterial({ color: "blue" })} // optional, default is no inner frame
/>

LostFloor

An infinite floor styled to the Lost World.

<LostFloor />

modifiers/

Collidable

Enables colliders for its children either by a named collider mesh or using all meshes and capping collective triangle count to triLimit prop.

<Collidable
  triLimit={1000} // max number of triangles before it uses bvh
  enabled={true}
  hideCollisionMeshes={false} // set visible to false on meshes used for collision
/>

Interactable

Makes its children react to onclick and on hover methods

<Interactable
  onClick={() => console.log("Ive been clicked!")}
  onHovered={() => console.log("Ive been hovered!")}
  onUnHovered={() => console.log("Ive been unhovered?")}
>
  <Stuff />
</Interactable>

Anchor

Makes its children link out to when clicked. handles leaving vr session.

<Anchor
  href="https://link-to-your-website.com"
  target="_blank" // optional, default is _self
>
  <Stuff />
</Anchor>

FacePlayer

Turns its children into a billboard, always facing the camera.

<FacePlayer lockX={false} lockY={false} lockZ={false} />

Floating

Lazily floats its children.

<Floating height={0.2} speed={1} />

LookAtPlayer

Makes its children face the player, but with easing.

<LookAtPlayer enabled={true} />

Spinning

Makes its children spin

<Spinning xSpeed={0} ySpeed={1} zSpeed={0} />

Tool

Provides the UX for its children to become a tool, meaning it will show up in camera at all times.

<Tool
  pos={[0, 0]} // position on screen from [-1, -1] to [1, 1]
  face={true} // whether the tool should face the screen
  distance={1} // how far away to place the item. It will scale as it moves away
  pinY={false} // pin the tool on the y axis
/>

ui/

TextInput

A text input component made to mimic an HTML input element. Supports all shortcuts, drag to select, shift click, double/triple click.

const [text, setText] = useState("");

<TextInput
  type="text" // text | password | number, default is text
  value={text} // control the input value
  onChange={setText} // optional onChange function
  onSubmit={(s: string) => console.log(s)} // optional onSubmit function, called when enter is pressed
  onFocus={() => console.log("focused")} // optional onFocus function
  onBlur={() => console.log("blurred")} // optional onBlur function
  font={"https://link-to-your-font.ttf"} // optional font
  fontSize={0.1} // font size, default 0.1
  width={1} // width, default 1
  placeholder="Enter your name" // optional placeholder text
/>;

Arrow

An arrow icon

<Arrow dark={false} />

Button

A simple button

<Button
  onClick={() => console.log("Ive been clicked!")}
  font="https://link-to-your-font.ttf" // optional font, default is Quicksand
  fontSize={0.1} // font size, default 0.05
  maxWidth={1} // max width, default no max width
  textColor="red" // text color, default black
  color="green" // button color, default white
  outline={false} // whether to show an outline, default true
  outlineColor="#9f9f9f" // outline color, default white
>
  Click me!
</Button>

Switch

A boolean switch

const [value, setValue] = useState(false);

<Switch
  value={value} // control the switch value
  onChange={setValue} // optional onChange function
/>;
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].