-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Post processing code for depth and stencil #13
Comments
Hopefully this article series could help a little bit. |
The depth buffer is linear. That article is out of date. To be sure you can
disassemble the shader code.
…On Mon, Nov 13, 2017 at 6:55 PM Matěj Račinský ***@***.***> wrote:
Hopefully this article series
<http://www.adriancourreges.com/blog/2015/11/02/gta-v-graphics-study/>
could help a little bit.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#13 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABPnvcSwboky4q6-y0vhfQ0ZxGLAmuyUks5s2Nb9gaJpZM4QApG7>
.
|
Thanks for reply. I quite struggle with reading the data, since every page of this multipage tiff uses different flags. |
You can use our VOC format exports for the tar balls we provide.
The Postgres bounding boxes may be offset+extent, check the box2d docs.
Also note that tue box captured directly from the game is very corse.
Since many people have requested it I will consider uploading the post
processing code
…On Mon, Nov 13, 2017 at 8:00 PM Matěj Račinský ***@***.***> wrote:
Thanks for reply. I quite struggle with reading the data, since every page
of this multipage tiff uses different flags.
Also, I struggle with 2D bounding boxes from the PostgreSQL database. Are
they up to date?
Since they have all 4 points from range [0-1], I thought it would be
sufficient to multiply X coords by width and Y coords by height, but that
does not look right and bounding boxes do not have position which seems
right when displayed over a screenshot.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#13 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABPnvW5wuC3l1sU0o2j34Vj_CI69Ifdjks5s2OY9gaJpZM4QApG7>
.
|
@barcharcraz I tried that, but unfortumatelly, it contains only semantic segmentation for cars, not for other objects. And if I am not mistaken, it completely lacks depth data. |
Ah i
…On Tue, Nov 14, 2017 at 9:01 AM Matěj Račinský ***@***.***> wrote:
@barcharcraz <https://github.com/barcharcraz> I tried that, but
unfortumatelly, it contains only semantic segmentation for cars, not for
other objects. And if I am not mistaken, it completely lacks depth data.
I wanted to use ImageViewer you have as part of solution with managed
plugin, but it does not seem to be working.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#13 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABPnvfGkhrfDrQBYk2sPgjrvhrTzk8TOks5s2Z0pgaJpZM4QApG7>
.
|
The postprocessing code would be really great. |
Oh, so those boxes are taken as the 2D bounding box of the 3D bounding
box (as projected onto the image). Because the 3D bounding box is
overlarge for humans (it includes bounds for animations) that box is
large as well.
The postprocess code will try and fix this by using the depth and
stencil buffers to exactly calculate the bounding box in 2D.
…On Tue, 2017-11-14 at 17:12 +0000, Matěj Račinský wrote:
The postprocessing code would be really great.
I checked the bounding box, but it is stored as box (native postgres
structure), not box2d (postgis extension). And in the query building
here coordinates are but there, not offset and extent, if I
understand it correctly.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c5
5493e4bb","name":"GitHub"},"entity":{"external_key":"github/umautobot
s/GTAVisionExport","title":"umautobots/GTAVisionExport","subtitle":"G
itHub repository","main_image_url":"https://cloud.githubusercontent.c
om/assets/143418/17495839/a5054eac-5d88-11e6-95fc-
7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent
.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-
b52498112777.png","action":{"name":"Open in GitHub","url":"https://gi
thub.com/umautobots/GTAVisionExport"}},"updates":{"snippets":[{"icon"
***@***.*** in #13: The postprocessing code would
be really great. \r\nI checked the bounding box, but it is stored as
box (native postgres structure), not box2d (postgis extension). And
in the query building [here](https://github.com/umautobots/GTAVisionE
xport/blob/master/managed/GTAVisionUtils/PostgresExport.cs#L256)
coordinates are but there, not offset and extent, if I understand it
correctly."}],"action":{"name":"View Issue","url":"https://github.com
/umautobots/GTAVisionExport/issues/13#issuecomment-344328716"}}}
|
Oh, my bad with bounding boxes. But the method you proposed in your paper uses much better bounding boxes refinement. I was little bit disapointed that I could not find this post processing code, because you did really good job in refining data from both depth and stencil data. |
check out https://github.com/umautobots/gta-postprocessing for postprocessing code. |
@JiamingSuen. Hi, Have you figured out to decode the true depth value from the depth buffer? |
@TommyAnqi As the author mentioned, the depth is already linearized. So no decoding is needed. |
@JiamingSuen I want to access the real depth value with specific metric, such as meter, what should I do? |
@wujiyoung depth is in NDC, so you need to recalculate it using the incerse of projection matrix. |
Well it's in "meters". Do be a little careful since while things like cars and people should be the right size, things like road length and building distance may be a little distorted, just because it's a game. |
@racinmat thank you so much, your master thesis is very useful to me. I have two questions more.
|
@wujiyoung you won't get w value, since it is the coordinate in homogeneous coordinates. So usual way to treat points in homogeneous coordinates is setting |
@racinmat I used your code to transform NDC into meters, but I don't think the result is correct. |
are you sure the near_clip is correct? You need to obtain it from the camera parameters, the default near_clip is 0.15. I left 1.5 here, because I tried some things at time of writing the code, if you have incorrectly set near_clip it messes things a lot. Same goes for fov (GTA camera field of view), but I think 50 is default value. |
Hi @racinmat , thanks for your sharing. According to your thesis, it seems that the transformation from camera coordinate to NDC is perspective projection. So, does it matter that P_{3,2} (in projection matrix) is 1 or -1. If not, may I use the standard perspective projection matrix (like the one provided by DirectX) to get the depth values in meters? |
it matters, because in the RAGE (engine used by GTA V), in the camera view coordinate system, camera is heading in direction of negative Z, so positive Z values are behind camera, and negative are in front of camera. AFAIK -1 handles this negative Z coordinate. But that is just orientation, so if you use 1 instead of -1, it should work if you care only about depth in meters, and not the whole transformation into camera view. |
thanks, @racinmat Besides, I found a interesting stuff. (data.ProjectionMatrix would be different whether there's sky(infinite depth) in the screen or not. |
yes, you can use the projection matrix directly, but it's inaccurate. |
@racinmat Thanks for your work in depth post-processing. But it is too hard for people who have no idea about rendering to understand. |
@Yannnnnnnnnnnn Thank you for helping dummies like me 👍 ! Appreciate your comment! And thanks to the original genius @racinmat. <3. |
@Yannnnnnnnnnnn I have collected some raw files, but the values converted according to the formula are incorrect. Why is this happening? |
Hi @barcharcraz , thanks for this amazing work!
I'm having trouble processing the captured tiff image. Would you like to post the post-processing code for depth and stencil? It's still a mount of work figuring out the exact logarithmic encoding the game developer used in depth buffer, and for stencil the object ID and "some flags(according to the paper)" are still unclear.
I started with this article decoding the depth buffer, but I'm not sure if
z = log(C*w + 1) / log(C*Far + 1) * w //DirectX with depth range 0..1
is the exact way they encode the depth. Having your post-processing code will really save a lot of effort for me and the community.Thanks for your time!
The text was updated successfully, but these errors were encountered: