Jump to content

  • Log In with Google      Sign In   
  • Create Account

Painting pixels on 3D object


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Alessandro   Members   -  Reputation: 296

Like
0Likes
Like

Posted 25 February 2012 - 07:39 AM

I already use glReadPixels to get pixel information on a certain 3D object on screen. I'd like to ask if, in order to paint pixels on such object (so that, to be more clear, I can use the mouse as a brush), I'd use glDrawPixels and if there are better solution than this.

Sponsor:

#2 Kristoffer   Crossbones+   -  Reputation: 839

Like
0Likes
Like

Posted 25 February 2012 - 08:23 AM

It is very hard to give a single answer to this, since painting on objects can be done in many different ways.

1. Do you want the painted details to be painted on the objects directly?
2. Do you have a static scene and just want to paint on a texture in screen space and apply it to the scene?
3. Do you want to make decals and have them as separate objects?

If case one then you could paint to a unique texture for each object and apply it using the same uv mapping while rendering, or paint to a second uv mapping.


To do the real painting you can use compute shaders or you can set the object texture as render target and render a brush shaped image.

glDrawPixel and glReadPixels are very slow operations, it is much better to do as above if you want paint in realtime.
Blekinge Institute of Technology
Twitter @devmoon
Homepage http://devmoon.se
Stream http://twitch.tv/devmoon

#3 Alessandro   Members   -  Reputation: 296

Like
0Likes
Like

Posted 25 February 2012 - 09:42 AM

Hi Kristoffer, thanks for the answer. Yes my case would be #1. I guess as you suggested, the best way to do it actually using a shader to paint pixels on the object, and than I can have a separate routine to render to texture when painting is done.
About the GLSL shader, I think I would just need to pass mouse coordinates and set the fragment color to that specific pixel. I'm totally new to GLSL, guess I'll have to start studying those...




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS