owl-project / NVISII

Apache License 2.0
319 stars 27 forks source link

Is it possible to render fisheye or panorama image? #166

Open StarRealMan opened 10 months ago

StarRealMan commented 10 months ago

Thank you for your great work! I just want to know if it is possible to render fisheye or panorama image by setting the camera. I tried to set the fov of the camera greater than 180 and this is the image I get: 02_random_scene

aspect ratio: 1 fov: 220

the code of the camera setting:

# Create a camera
dummy_camera = nvisii.camera.create(
    name = "camera",  
    aspect = float(opt.width)/float(opt.height)
)

dummy_camera.set_fov(220, float(opt.width)/float(opt.height))

camera = nvisii.entity.create(
    name = "camera",
    transform = nvisii.transform.create("camera"),
    camera = dummy_camera
)
camera.get_transform().look_at(at = (0,0,0), up = (1,0,0), eye = (0,0,5))
nvisii.set_camera_entity(camera)

It dose not seem to be OK.

Thank you if you can help!

StarRealMan commented 10 months ago

I found that the fov is set using glm::perspective() which uses a pinhole camera model, so, I think it is not possible to achieve fisheye effect in this way. I stil wonder if anyone can come up with ideas about fisheye image rendering using NVISII. Thanky you if you can reply.

TontonTremblay commented 10 months ago

I remember @natevm and I talking about, and I recall that he said he would not be too hard to add, but at the moment I was not sure we would ever need it, the prime application we had in mind was computer vision to which you normally get rectified images and thus you would never get rounding artifacts.

I labeled it as a feature request.

natevm commented 10 months ago

Yeah, in theory it would be possible to do. I vaguely remember a ray tracing gem on how to do a fish eye lens, but I’m not sure what changes would need to be made to the camera component to make that work.

I would also like to have an orthographic camera…

StarRealMan commented 10 months ago

Thank you for your timely reply! I'm now trying to generate fisheye images using cubemap rendered from NVISII and hope this will work. The only problem I need to worry is the mismatch of the pixels. I think greater resolution may solve it.