3D painting

Started by
21 comments, last by Alessandro 11 years, 10 months ago
I'd like to have the possibility to 3D-paint an object texture using the mouse as a brush.

I've tried ray-casting mouse click, getting the triangles inside the brush area, calculate barycentric coordinates for each point intersection, set the colors on the uv corresponding values, saving and reloading the texture. Too slow.

I'd like to have a glsl solution for this. I've google around but couldn't find much.

If someone would be so kind to develop a small application that paints a sphere, or a cube, using a glsl approach I'd like to pay for it (I use Paypal).
Looking forward to any possible help, thanks.
Advertisement
http://www.pixologic.com/sculptris/

Never used it but it lists the feature to do 3D painting.

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

Thanks, but I actually meant to develop and provide C++/OpenGL application that does 3D painting over a simple primitive, using GLSL.
What exactly are you using it for?

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

Hello Adam, I have an application that load an .obj file, and I'd like to be able to paint the model texture directly using the mouse.
The painting to be done is really basic, I just need to color pixels so that I can use that information to mask parts of the model later for further operations.
Does this explain a little better?
Not really. What are you using it for? Why can't you paint the object and export the OBJ and Texture and then load those into OpenGL? Is the painting part of the game that the user needs to be able to paint?

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

hmm, this is a rather complex problem, for convex objects, this is a bit simpler, but for complex objects, it gets a bit more tedious, and their are most likly many approachs, but i can only think of one way that i'd do it:

create a large texture to be the "brushed" texture, each polygon/triangle would get a small unique patch of this texture(hence why it'd be very large), i'd then fire a ray at the polygon, and figure out where the brush is intersecting which faces, after that, i'd figure out all the faces that the brush would affect, and from their, figure out the pixels to write to in the client side version of the texture.

using glSubImage2D i'd update this texture once every tenth of a second, or once every quater of a second(whichever one doesn't create too much of a noticable lag), by spacing out the updates, this should allow the program to not slow down very much, and by evaluating where in the texture was last updated, i can minimize the amount being uploaded.

in the shader, i'd simple pass x texture coordinates where x is the number of textures the model already has overlayed+1 for the brush texture, finally i'd add whatever the final color is, with the brush's texture, and bam, you have brushed object.

creating the texture can be done in multiple ways, if you want a 1:1 per texel/polygon, then the texture size would have to be equal to the sum of the area of all triangles, and you can increase/decrease precision by the ratio.

anyway, that's my approach, unfortuantly i'm working on other things, so i'm not going to write up an sample, but i feel you are probably well-able.

and again, if speed of constantly submitting a new texture is your concern, simply decrease the rate of uploads into a per second, instead of per frame.
Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.
i can post a code here but it will be native opengl and glu its simple that you find a point in 3d where your mouse is and then draw a blended or not quad on it

it is REALLY SIMPLE

i can post a code here but it will be native opengl and glu its simple that you find a point in 3d where your mouse is and then draw a blended or not quad on it

it is REALLY SIMPLE


Hi, thanks but this wouldn't help. I need to draw pixels, not vertices.
I've done this before. First you need to auto unwrap the mesh, to generate proper UVs. If you are using DirectX it has some utility functions for it, otherwise you have do it yourself. After having the mesh unwrapped, you just need to do a ray test when the user 'paints' the mesh, to get the UV, then update the texture.

This topic is closed to new replies.

Advertisement