Context. While Gaia enables to probe in great detail the extended local neighbourhood, the thin disk structure at larger distances remains sparsely explored. Aims. We aim here to build a non-parametric 3D model of the thin disc structures handling both the extinction and the stellar density simultaneously. Methods. We developed a Bayesian deconvolution method in two dimensions: extinction and distance. It uses a reference catalogue which completeness information defines the selection function. It is designed so that any complementary information from other catalogues can be added. It has also been designed to be robust to outliers, frequent in crowded fields, and differential extinction. The prior information is designed to be minimal: only a reference H-R diagram. We derived for this an empirical H-R diagram of the thin disk using Gaia DR2 data and synthetic isochrone-based H-R diagrams can also be used. Results. We validated the method on simulations and real fields using 2MASS and UKIDSS data complemented by Gaia DR2 photometry and parallaxes. We detail the results of two test fields: a 2MASS field centred around the NGC 4815 open cluster which shows an over-density of both extinction and stellar density at the cluster distance, and a UKIDSS field at $l=10^{circ}$ where we recover the position of the Galactic bar.