Page 1 of 1

how to get Pixel wold position back?

Posted: Wed Nov 23, 2016 12:36 am
by vectorcorpse
Hi, lets say we i have a pixel in fragment shader not necessarily a depth one and i want to recover that pixel position in world space back in the irrlicht to be processed on the CPU, but the only thing that gets out from there are images therefore clamped to the color range...

Re: how to get Pixel wold position back?

Posted: Wed Nov 23, 2016 10:43 am
by Mel
You need to read the depth buffer, and transform the screen coordinates+depth back to world space via the inverse of the view*projection matrix. But, in general, try to avoid bringing things back from a shader to system memory, that is very slow.

Re: how to get Pixel wold position back?

Posted: Wed Nov 23, 2016 12:31 pm
by vectorcorpse
yes, i know how to work with the depth buffer and matrix transformation (it is the same has working with shadow mapping), i also know it is really slow to bring things from a shader to system memory, but since i don't have access to geometry shader (old graphics card) i don't have another choice, in any case i only need a really small sample of pixels, not the entire frame buffer, and my question remains, how to restore the full range of the pixel coordinates, in world space back to system memory?

Re: how to get Pixel wold position back?

Posted: Wed Nov 30, 2016 3:33 pm
by Vectrotek
Any "example code" on this?

Re: how to get Pixel wold position back?

Posted: Wed Nov 30, 2016 4:27 pm
by vectorcorpse
The only similar thing on the subject i managed to found here in the forums is this:
http://irrlicht.sourceforge.net/forum/v ... =4&t=33984
but it only mentions the shader side and not the irrlicht side on how to extract pixel world coordinates
maybe devsh can shed some light :D

Re: how to get Pixel wold position back?

Posted: Wed Nov 30, 2016 4:30 pm
by Vectrotek
Thanks! Il have a look!

Re: how to get Pixel wold position back?

Posted: Thu Dec 29, 2016 11:15 pm
by vectorcorpse
Any news/ideas?

Re: how to get Pixel wold position back?

Posted: Sun Feb 05, 2017 6:08 pm
by Vectrotek