PDA

View Full Version : how to apply a texture to an area of image which has been marked already?



dariush
10-04-2017, 08:49 AM
The first thing to say is that I only have coded OpenGL in a course 4-5 years ago at university, so my knowledge of OpenGL is very limited and what I'm asking is for a bigger project which needs some image processing and showing the output.
So I would be very thankful if anyone kindly and generously helps me to solve my problem.
Let's say I have an image of a sofa and a region of interest marked red like below:
2497
And let's say I have fabric image like below:
2498

The purpose is to cover the fabric image over the region of interest in the sofa image.
How can I accomplish this?

Thanks in advance

Silence
10-05-2017, 12:00 AM
You'll basically have to split the mesh of the sofa into different meshes. You'll have to have a mesh for your marked region.
If your model (the sofa) does not have multiple meshes, modelers will generally help you to cut your model into different meshes.
One you have that, then use the texture only for this mesh.
You can consider a mesh to be a set of vertices, normals, colors, texture coordinates which share the same material properties (here your texture).

Another approach, which is more for artists, is to copy/paste your image portion at the UV positions where you want this texture to apply.

john_connor
10-05-2017, 01:58 AM
in terms of "image processing", the marked region could also be determimed by its color (red for example). render full-screen quad: if fragment color's red component > threshhold, use texture. or blend both images, using the source image's red component as blending weight.

Silence
10-05-2017, 06:41 AM
in terms of "image processing", the marked region could also be determimed by its color (red for example). render full-screen quad: if fragment color's red component > threshhold, use texture. or blend both images, using the source image's red component as blending weight.

Nice solution !