This document provides a comprehensive guide to using the Twitter API v2 sample code and the Mitsuba 3 renderer. It includes setup instructions for various programming languages (Java, Node.js, Python, R, Ruby), details on environment variables, and troubleshooting tips. For Mitsuba 3, it offers installation guidance, usage examples, and information on its key features and contributors.
Twitter API v2 sample code
Sample code for the Twitter API v2 endpoints.
Individual API features have folders where you can find examples of usage in several coding languages (Java, Node.js, Python, R, and Ruby).
Prerequisites
Using the code samples
In order to run the samples in this repository you will need to set up some environment variables. You can find your credentials and bearer token in the App inside of your Project in the dashboard of the developer portal.
For OAuth 1.0a samples, you will need to export your consumer key and secret in your terminal. Be sure to replace
For samples which use bearer token authentication, you will need to export the bearer token. Be sure to replace
Language-specific requirements
Java environment set up
If you use Homebrew, you can install a Java runtime using:
You will also need to download the relevant JAR files referenced in the individual samples in order to build and run the code. If you use an IDE, it may be able to do this automatically for you.
JavaScript (Node.js) environment set up
You will need to have Node.js installed to run this code. All Node.js examples use needle as the HTTP client, which needs to be npm installed. For OAuth with user context requests, you'll need to install the got and oauth-1.0a packages.
Python environment set up
You will need to have Python 3 installed to run this code. The Python samples use requests==2.24.0 which uses requests-oauthlib==1.3.0.
(Optionally) It is common and recommended not to install required package globally, but locally under project subfolder using venv:
You can install these packages as follows:
Ruby environment set up
You will need to have Ruby (recommended: >= 2.0.0) installed in order to run the code. The Ruby examples use typhoeus as the HTTP client, which needs to be gem installed. For OAuth with user context requests, you'll also need to install the oauth gem (see below).
Additional resources
We maintain a Postman Collection which you can use for exercising individual API endpoints.
Support
For general questions related to the API and features, please use the v2 section of our developer community forums.
If there's an bug or issue with the sample code itself, please create a new issue here on GitHub.
Contributing
We welcome pull requests that add meaningful additions to these code samples, particularly for languages that are not yet represented here.
We feel that a welcoming community is important and we ask that you follow Twitter's Open Source Code of Conduct in all interactions with the community.
License
Copyright 2021 Twitter, Inc.
Licensed under the Apache License, Version 2.0: https://www.apache.org/licenses/LICENSE-2.0
example:
Mitsuba Renderer 3
Documentation
|
Tutorial videos
|
Linux
|
MacOS
|
Windows
|
PyPI
|
---|---|---|---|---|---|
️
Warning
️
There currently is a large amount of undocumented and unstable work going on in
the master
branch. We'd highly recommend you use our
latest release
until further notice.
If you already want to try out the upcoming changes, please have a look at
this porting guide.
It should cover most of the new features and breaking changes that are coming.
Introduction
Mitsuba 3 is a research-oriented rendering system for forward and inverse light
transport simulation developed at EPFL in Switzerland.
It consists of a core library and a set of plugins that implement functionality
ranging from materials and light sources to complete rendering algorithms.
Mitsuba 3 is retargetable: this means that the underlying implementations and
data structures can transform to accomplish various different tasks. For
example, the same code can simulate both scalar (classic one-ray-at-a-time) RGB transport
or differential spectral transport on the GPU. This all builds on
Dr.Jit, a specialized just-in-time(JIT) compiler developed specifically for this project.
Main Features
Cross-platform: Mitsuba 3 has been tested on Linux (x86_64
), macOS
(aarch64
, x8664
), and Windows (x8664
).
High performance: The underlying Dr.Jit compiler fuses rendering code
into kernels that achieve state-of-the-art performance using
an LLVM backend targeting the CPU and a CUDA/OptiX backend
targeting NVIDIA GPUs with ray tracing hardware acceleration.
Python first: Mitsuba 3 is deeply integrated with Python. Materials,
textures, and even full rendering algorithms can be developed in Python,
which the system JIT-compiles (and optionally differentiates) on the fly.
This enables the experimentation needed for research in computer graphics and
other disciplines.
Differentiation: Mitsuba 3 is a differentiable renderer, meaning that it
can compute derivatives of the entire simulation with respect to input
parameters such as camera pose, geometry, BSDFs, textures, and volumes. It
implements recent differentiable rendering algorithms developed at EPFL.
Spectral & Polarization: Mitsuba 3 can be used as a monochromatic
renderer, RGB-based renderer, or spectral renderer. Each variant can
optionally account for the effects of polarization if desired.
Tutorial videos, documentation
We've recorded several YouTube videos that provide a gentle introduction
Mitsuba 3 and Dr.Jit. Beyond this you can find complete Juypter notebooks
covering a variety of applications, how-to guides, and reference documentation
on readthedocs.
Installation
We provide pre-compiled binary wheels via PyPI. Installing Mitsuba this way is as simple as running
pip install mitsuba
on the command line. The Python package includes thirteen variants by default:
scalar_rgb
scalar_spectral
scalarspectralpolarized
llvmadrgb
llvmadmono
llvmadmono_polarized
llvmadspectral
llvmadspectral_polarized
cudaadrgb
cudaadmono
cudaadmono_polarized
cudaadspectral
cudaadspectral_polarized
The first two perform classic one-ray-at-a-time simulation using either a RGB
or spectral color representation, while the latter two can be used for inverse
rendering on the CPU or GPU. To access additional variants, you will need to
compile a custom version of Dr.Jit using CMake. Please see the
documentation
for details on this.
Requirements
Python >= 3.8
(optional) For computation on the GPU: Nvidia driver >= 495.89
(optional) For vectorized / parallel computation on the CPU: LLVM >= 11.1
Usage
Here is a simple "Hello World" example that shows how simple it is to render a
scene using Mitsuba 3 from Python:
# Import the library using the alias "mi"import mitsuba as mi# Set the variant of the renderermi.setvariant('scalarrgb')# Load a scenescene = mi.loaddict(mi.cornellbox())# Render the sceneimg = mi.render(scene)# Write the rendered image to an EXR filemi.Bitmap(img).write('cbox.exr')
Tutorials and example notebooks covering a variety of applications can be found
in the documentation.
About
This project was created by Wenzel Jakob.
Significant features and/or improvements to the code were contributed by
Sébastien Speierer,
Nicolas Roussel,
Merlin Nimier-David,
Delio Vicini,
Tizian Zeltner,
Baptiste Nicolet,
Miguel Crespo,
Vincent Leroy, and
Ziyi Zhang.
When using Mitsuba 3 in academic projects, please cite:
@software{Mitsuba3,title = {Mitsuba 3 renderer},author = {Wenzel Jakob and Sébastien Speierer and Nicolas Roussel and Merlin Nimier-David and Delio Vicini and Tizian Zeltner and Baptiste Nicolet and Miguel Crespo and Vincent Leroy and Ziyi Zhang},note = {https://mitsuba-renderer.org},version = {3.1.1},year = 2022}