niessner / Opt

Opt DSL
Other
254 stars 68 forks source link

Is the "Index" function implemented correctly? #152

Open zhangxaochen opened 5 years ago

zhangxaochen commented 5 years ago

I'm testing the shape_from_shading example,

and getting confused about this line L22:

local posX,posY = Index(0),Index(1)

When I change it to the following line to see its effect:

local posX,posY = 0,0

it seems I get a better mesh result.

The original (left) and modified (right) codes output:

image image
image image
image image

Why is that?

Mx7f commented 5 years ago

That code is supposed to implement Equation (10) in Real-time Shading-based Refinement for Consumer Depth Cameras; posX and posY should by the i and j from the equation, which are the pixel indices.

It's not entirely clear that its better from the image, but I will double check today whether there's a bug in the implementation of Index. It's also entirely possible that the SFS energy from the paper leads to worse results than a different (but related) energy; the authors had to hand-write the energy and its Jacobian terms in CUDA, and so likely didn't experiment with changing the energy much once it produced reasonable results in realtime. Being able to play around with the energy quickly and experiment is one of the main benefits of Opt.