2
$\begingroup$

I am trying to project an image, taken from a certain angle, onto a mesh. For the experiment I have a simple box. I was hoping I could use this for more complex geometry, like a 3D scanned room for instance. But first, I would like to make it work with something simple. I'm looking into this because the structore core depth sensors RGB camera is pretty vague and does not provide nice textures.

See the picture below. enter image description here

And it should be project onto this mesh enter image description here

I am trying with the UV project modifier on the box, a spot light lamp with an emtpy as its parent. (Like in this example from Blender docs itself.)

I am hoping to get results similar to what is shown in this video on YouTube.

I have been fiddling for quiet some time now, but I cannot seem to get it right. See my attempt below. Then I thought, I am probably not doing it right.

It is possible (doable), if yes, how could I do this?

Thanks so much.

enter image description here

EDIT

So I first wanted to have something simple to experiment with. I made it more simple. I took the variables of the camera. I took a cube, painted something on it and rendered it. Next I tried projecting this exactly on the cube again. It worked! Here is the result. But it took me like 20 minutes or so to align it!

enter image description here

And this was the rendered image.

enter image description here

$\endgroup$
  • 1
    $\begingroup$ When you press "U" in edit mode to unwrap there is an option called "Projection from view" it works perfectly. $\endgroup$ – FFeller May 22 at 19:44
  • 1
    $\begingroup$ In the Property Editor, under Texture tab, make sure you've set mapping to UV instead of the default of Generated. It's under the Mapping section. (just under Image Mapping.) $\endgroup$ – Susan May 22 at 19:46
  • 1
    $\begingroup$ You are on the right track, but there is a trick: if the image is not square, the proportions of the image have to be set on the modifier using the Aspect X and Y. $\endgroup$ – cegaton May 22 at 23:32
  • 1
    $\begingroup$ Fspy will give you the placement for the camera and you can project from there. The distortion is a different issue. Please ask this as a new question. Make sure that on the question you show the structure of the mesh and the UV maps. $\endgroup$ – cegaton May 25 at 17:46
  • 1
    $\begingroup$ You could also have a look at these tutorials on baking a camera-mapped texture from one UV to another, or painting it. $\endgroup$ – Robin Betts May 26 at 5:47
2
$\begingroup$

For your workflow to work, you need the exact match for the camera, both in placement, rotation and perspective. Not a trivial thing to do, and hard and time consuming to do manually.

You can try (Fspy)(https://fspy.io/) Fspy is an app to match the perspective of a camera in 3d space to a photograph.

Open the Fspy app. and import the image. Set the lines so that you match parallel lines and set the origin where you want it and save the fspy project.

enter image description here

Install the fspy importer addon and then import the fspy project into blender 2.8

Once you open the fspy project, blender will create an active camera that matches the lens and placement of the original camera, and uses an the image as background for reference.

It is then quite easy to create a box that matches your original object.

enter image description here

Then you can unwrap the UV using Project from View.

enter image description here

enter image description here

Create a material that uses the UV map as coordinates for the texture, and the image as color for the shader.

enter image description here

Done. Over and Out.

$\endgroup$
  • $\begingroup$ Thanks so much for the full explanation. Really awesome. It helped me a lot. I've come way closer to the end goal. The last thing I need to figure it is how to prevent the warping of the image. I am using blender 2.79. But I think that should not matter for this UV project modifier. Do you have any idea? I have added EDIT 2 to the question with the results I have now based on your answer. Or dont you use that modifier? I see some nodes? I will try that now. $\endgroup$ – Mike de Klerk May 25 at 17:51
  • 1
    $\begingroup$ Please ask new questions in new posts. $\endgroup$ – cegaton May 25 at 18:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.