Hi,
I want to make an application to paint 3d models. I believe I have read every existing thread on the subject and am still quite confused:
discourse.panda3d.org/viewtopic.php … ight=paint
panda3d.org/forums/viewtopic … fe8100c1bd
panda3d.org/forum/viewtopic … 6619#66619
I do not understand the logic. So far, I have been able to write a program that can detect when a model has been clicked, and the coordinates of the point. What is next? How do I get from the x,y,z coordinates to the u,v coordinates of the texture so I can modify it?
One way suggested was to calculate the closest vertex to the point of the click(collision between CollisionRay and model) on the model and find the corresponding U,V coordinates. How can I get a list of the vertexes and their positions, and the u,v coordinates on the texture that correspond?
The other solution suggested using a buffer. The code from the posts suggests that the x,y coordinates of the mouseclick at a point on the model correspond to the x,y coordinates of the texture that is displayed there. I am finding this hard to believe because several points on a model with the same x,y coordinates, but a different z coordinate can have different colors.
Furthermore, when I tried to demo the sample file found on:
panda3d.org/forums/viewtopic … ight=paint
called, uv-texture-pickling_v0.3.zip, my macbook failed to run the program saying:
DirectStart: Starting the game.
Known pipe types:
osxGraphicsPipe
(all display modules loaded.)
:display(error): Window wouldn’t open; abandoning window.
I think I was able to trace the problem back to the RenderTextureMode, which is an argument of addRenderTexture(). When I commented out the lines, I could get the code to run, but no painting was possible. Changing the mode to any of the other possible RenderTextureModes resulted with this error:
AssertionError: do_has_ram_mipmap_image(n) at line 2875 of panda/src/gobj/texture.cxx
So, I am thinking that this may reflect the importance of using a RAM buffer, but I am not very sure why this is happening. I am running on a 10.5.8 Leopard Macbook under panda3d 1.7.0. I tried downgrading to panda1.6.2 but that version also gave me other kinds of errors, so I came back to 1.7.0.
I would really appreciate your help. I have spent days trying to sort these problems out and have not been able to understand and implement solutions(especially since I cannot even run examples from other people’s painting programs).
Thanks a lot,
Rishi