Giter Club home page Giter Club logo

godotpanorenderer's Introduction

Godot Panorama Renderer.

Rendering a 3D Stereoscopic 360 degree view of the scene.

Rendering an equirectangular 360-degree 3d-stereoscopic view of a scene is tricky because the offset from the origin of the cameras needs to change for every vertical pixel on the screen.

As explained very well in this amazing page by shubhmehta, if you are not careful what you'll get is a view from two eyes swiveling in their sockets:

when what we need is a map from a head rotating two eye-cams:

Our approach

We create two pairs of cameras, point one 45 degrees to the sky and one 45 degrees to the floor, then rotate them around like doing a panorama shot with your phone.

Which means you'll need to pause your game while you take a panoramic photograph or you'll get similar duplicated people and elongated dogs etc.

It's going to take quite a few frames.

We reduce the number by having more than one camera. You can set what number you want. I found after about 60 adding more cameras became less useful as it slowed down the each-frame render so much that doing fewer-frames wasn't helpful.

Project to Equirectangular

That gives us a perspective projection, and the VR headsets all want an equirectangular projection, so we do a final pass over the image when it's complete to warp it to make it equirectangular.

Who would want this

You may want to create a background panorama of your scene for environment mapping, or just want to make a whole-world screenshot someone can see in VR, or you might want to stitch thousands of them together to make a VR movie. That's why I needed it.

Licence

Licence is CC0, do whatever you want.

Install

All you really need is PanoRenderer.cs which you can attach to a Node3D in your scene.

When your code wants to start a render, move that Node3d to the view-point, and call the StartRender function of the PanoRenderer.

Then call isFinished() each frame to see if it's finished.

The other files here are a demo scene if you want to check it out in it's own project first.

godotpanorenderer's People

Contributors

revpriest avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.