Git Product home page Git Product logo

Comments (9)

aluo-x avatar aluo-x commented on September 26, 2024 1

Haven't tried this myself since I am working with RGB, but Line 37 of renderer.py exposes a fragment, which should have a zbuf object.

Also according to documentation here:

The PyTorch3d backward pass returns gradients for zbuf, dist and bary_coords

from pytorch3d.

davnov134 avatar davnov134 commented on September 26, 2024

Hi wangg12,

can I please ask whether you can share the rendering script?

More specifically, it is not obvious what is the position of the LM object in the world coordinates. Furthermore, the "R" matrix you are using does not seem to be a valid rotation, see below:

R = torch.tensor([[-0.5,  0.8,  0],  [0, 0, -1],  [-0.8, -0.5,  0]])
torch.det(R)
> tensor(0.8900) # instead of 1

In case the LM object should be centered around (0, 0, 0), I would suggest setting the camera to a trivial one with a non-zero z-component of the T vector, e.g.:

R = torch.eye(3), T = torch.tensor([0., 0., 2.])

This would point the camera directly at the object center and render it from the distance of 2 world units.

from pytorch3d.

wangg12 avatar wangg12 commented on September 26, 2024

Sorry, R was not the correct one. It was transformed from axis angle and should be correct. I shared my script here

from pytorch3d.

nikhilaravi avatar nikhilaravi commented on September 26, 2024

@wangg12 could you please share a small script to reproduce the error which we can run easily? For example load and render one mesh with the settings you have mentioned. This will enable us to help you much faster :)

from pytorch3d.

wangg12 avatar wangg12 commented on September 26, 2024

Finally I got the correct results with a modified OpenGL Real Perspective Camera.
The scripts are here.
image

BTW, @nikhilaravi How can I render the differentiable depth values?

from pytorch3d.

nikhilaravi avatar nikhilaravi commented on September 26, 2024

@wangg12 Glad you got it to work. I can take a look at your script later! For future, please try to share the minimum amount of code needed to explain the issue so we can review more quickly :)

Thanks @aluo-x for explaining the zbuf/fragments :) As mentioned, we expose the zbuffer as part of the fragments object which is output from the rasterizer. It will be a N x H x W x K dimensional tensor.

from pytorch3d.

bhadresh74 avatar bhadresh74 commented on September 26, 2024

@wangg12 Thanks for sharing your script. I am trying to do something similar using your script.
However the rendering is vertically stretched as shown below.
Screen Shot 2020-03-24 at 5 35 07 PM
Ideally, it should look like this.
Screen Shot 2020-03-24 at 5 34 56 PM

My image size is (960, 1280). I believe it has something to do with rasterizer since it only works for square image.
Can you guide me in the right direction here?

from pytorch3d.

nikhilaravi avatar nikhilaravi commented on September 26, 2024

@bhadresh74 yes the rasterizer currently only works for square images!

from pytorch3d.

gkioxari avatar gkioxari commented on September 26, 2024

Hi @bhadresh74

Since 57a22e7 we have updated the cameras and have added a note to explain the space and definitions here:

https://github.com/facebookresearch/pytorch3d/blob/master/docs/notes/cameras.md

Note that by default PyTorch3D cameras assume parameters in NDC space for rendering. We have updated cameras.py such that SfMPerspective and SfMOrthographic can now accept parameters in both NDC and screen space.

from pytorch3d.

Related Issues (20)

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.