Git Product home page Git Product logo

pointcloudrenderer's Introduction

Point Cloud Renderer

What Makes Your Academic Paper/Report Beautiful! This is a demo/utility script use to render a point cloud, with integrated mitsuba2 python API. Here are some comparisons following (compare visualizations only, these are all nice work):

Preparation

Tested version:

  • Misuba >= 2.0.0
  • Python 3.7

python dependency:

  • argparse
  • numpy
  • pythonlib
  • matplotlib

Please follow this guid to install misuba and make sure it is installed before further step.

Quick Demo

source YOUR_PATH_TO_MITSUBA2/setpath.sh 
python point_render.py -f chair_pcl.npy

than a image file named output.jpg can be found in current fold:

It appears to contain a lot of noise. you can specify a larger sample times to smooth, but it will take more time to render:

python point_render.py -f chair_pcl.npy -s 256

Getting Started

All you need to do is provide a point cloud in .npy form with shape [num_pts,3 coords(+3 colors(+1 size))], generated from numpy, and run this script. Here are some tips:

  • -f to specify the path to your points file.

  • -o to specify the output filename of the render result.

  • -s to specify the sampling time for sampler

  • -x to specify the xml file to be render. This will ignore the -f option.

  • -c to specify the color mapping. The given .npy file contain no colors will be colored by the matplotlib.colors.Colormap specified by this option, like 'turbo'.

  • -v to specify a specific mitsuba variant, default to "scalar_spectral".

How to modify this script

Preliminary

First of all, you should know something about how to describe a scene in mitsuba. In fact, mitsuba describe scene use xml file. please refere here for details. Next I assume you already know some basics knowledge about it, i.e., scene, intergrater, sampler, emitters and shape.

Rather than using xml file, we use mitsuba's python interface directly to load object from python dict. By this way, a more programmer way, we can easily operate objects rather than click down and up on GUI.

This only requires a few conversions betwee their, refering to here. Some examples of conversions are listed below:

  • A tag with "name" can be treated as a field: <type name="a" value=b => "a":type(b). e.g:

    <float name="height" value="123"> 
    <string name="height" value="123"> 
    <tranform name="to_world"> 
        <scale value="2, 1, -1" /> 
        <translate value="-1, 3, 4"/>
    </transform>
    <rgb name="radiance" value="100,400,100"/>

    =>

    "height": 123
    "height": "123"
    "to_world": ScalarTransform4f.translate([-1, 3, 4]) * ScalarTransform4f.scale([2, 2, -1])
    "radiance": { "type": "rgb","value": [100, 400, 100]}
  • a tag with "type" is a plugin in mistuba: <class type="a"> ... </class> =>{ "type":"a",...}. e.g:

    <shape type="sphere">
        <float name="radius" value="10"/>
    </shape>

    =>

    {  # this brackets cannot be discarded. since obly a dict contain "type" key is treatde as a plugin.
        "type" : "sphere",
    	"radius": 10
    },

for more properties of plugins please refer this link.

To Modify

  • to add other types of data like mesh, please refer function create_objects.
  • to move shadow, please refer function create_ground or remove it from objs = {"ground_plane": create_ground(), }.
  • to adjust the camara view, please refer camera in function create_environment.
  • ...

Known Problems

  • fail to use gpu variant for rendering, because a GPU out of memory error occurred.
  • At the moment I don't know how to render a animation, maybe only remde frame by frame, since I am also new to mitsuba. If you get it, please feel free to let me know.

Acknowledge

This script deeply based onMitsuba2PointCloudRenderer and PointFlowRenderer and is an easy-to-use version.

pointcloudrenderer's People

Contributors

ouyangjunyuan 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.