microsoft / RoomAliveToolkit

Other
713 stars 191 forks source link

DesktopDuplicationEnabled #15

Open helloroxy opened 8 years ago

helloroxy commented 8 years ago

Is there a specific window resolution or other settings recommended for using DesktopDuplicationEnabled to project from other applications? I'm targeting with windowPtr, adjusting the sourceRegion nudge values and fov, but am having difficulty aligning the contents of the output window to the bounds of the projection.

thundercarrot commented 8 years ago

Good question! I don't have the answer, which is why I put the "nudge" values there. I don't understand why those values don't seem to be in pixels, even when desktop scaling is off (1.0).

thundercarrot commented 8 years ago

I think I nailed this problem.

First, there were a few bugs in how the user view was being rendered (the viewport was set incorrectly). Secondly, I found that if you target a top level window, it includes the small area around the left, right and bottom which includes the drop shadow-- the code does not currently take this into account but one could easily handle that for a given application window (not all windows have it I think?). Finally, I added code to target whatever window is directly under the cursor (this could be a child window), and update the texture sizes dynamically.

I would be surprised if any of this worked with DPI scaling turned on.

AlanDZhang commented 8 years ago

It seems that the desktopDuplication only renders correctly on the first pro/cam surface, but does not perform any transform for other surfaces so it appears correct on one wall but skewed on all the other. What plans or suggestions do you have regarding this problem?

thundercarrot commented 8 years ago

Alan can you confirm in the same configuration that the other samples work fine, e.g, 3Dobject?

AlanDZhang commented 8 years ago

Wobble effect works perfectly fine, and 3Dobject also seems to work fine.

thundercarrot commented 8 years ago

I'm not able to repro this. Not sure this will help, but can you zip up your calibration files and put them in a place where I can download them?

donghwan-kim commented 8 years ago

Is it possible to duplicate more than 2 windows by using "DesktopDuplicationEnabled" option? I had some test using this option. but disabled window is not duplicated. So I think more than 2 windows are not duplicated or their resolutions are not fine when all windows align tiled. isn't it?

thundercarrot commented 8 years ago

The sample should only pick up one window. If you study the code, you see that it copies the portion of the desktop corresponding to the one window to a texture which is then projection mapped. You could modify this code to take more of the desktop.

donghwan-kim commented 8 years ago

Yes. but, I think more than 2 windows make trouble because there is overlap problem like below overlaped_window_problem If I use 4 cameras, how can I align windows? Could you advice me? Thank you!

thundercarrot commented 8 years ago

I don't quite understand your note. Why "more than 2 windows"? You will potentially have windows overlapping with just 2 windows. The overlapping by the way is due to the way the sample works with the desktop duplication API in Windows; it gives a snapshot of the entire desktop. The sample copies a region of the desktop that corresponds to the selected window. If another window overlaps with the target window in the desktop, it will be part of the region that is copied.

I don't understand your last question-- what does this have to do with having four cameras?