Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Painting a models texture from a 3d model

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2012
    Posts
    5

    Painting a models texture from a 3d model

    I've been thinking how to paint a 3d model texture in 3d.
    I am thinking of actually how a modelling program would do it not a game. So it needs to modify the texture.

    I have failed to find anything on this topic from my searches. That is probably more to do with having the right terminology.

    My current thought is rendering to texture the uv coordinates so you have the uv locations in screen space. Though the texture could be more detailed than the screen space and would miss some pixels. Also I am not sure what would be the best way. using cpu to manually edit these values into the texture or using a shader.

    I'm hoping there is simpler way that also hopefully works across seams.

    Any help or ideas are much appreciated.

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: Painting a models texture from a 3d model

    Blender has this feature, calling it texture painting.
    Indeed a shader could output as color the current uv coords, and a simple readpixels under mouse cursor would give you the texcoord. Then go the the texture and paint a circle, done.
    Of course plenty of subtle precision issues can arise. Going across seams for example, could be solved by reading not only a single pixel but a few that cover the brush, so that it will detect that the brush must be painting at 2 (or more) different parts of the texture.

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2012
    Posts
    5

    Re: Painting a models texture from a 3d model

    I was hoping there would be more solutions.
    reading and writing pixels sounds pain-full and not efficient.
    I can not think of any glsl solution that could write to a texture in this situation.

    I am thinking that when I click I do a render to texture that is just as wide as the brush. The resolution can be ramped up aswell. and render the texture uv to r,g and the brush uv to b,alpha(in-case it is rotated or part of a bigger image).

    problem is more when writing the texture. I essentially need to re upload the entire texture after editing as it is not just editing a small rectangular area of a texture. I suppose I could loop through and work out the smallest area. I suppose i'll just need to try it.

  4. #4
    Junior Member Newbie
    Join Date
    Apr 2012
    Location
    Washington
    Posts
    1
    WHAT rot to suggest it is embarras

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •