cgkit-user Mailing List for Python Computer Graphics Kit
Brought to you by:
mbaas
You can subscribe to this list here.
2005 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
(1) |
May
(3) |
Jun
(3) |
Jul
|
Aug
|
Sep
(2) |
Oct
(3) |
Nov
|
Dec
(7) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(48) |
Jun
(14) |
Jul
(9) |
Aug
(5) |
Sep
|
Oct
(3) |
Nov
(7) |
Dec
(6) |
2007 |
Jan
(2) |
Feb
(2) |
Mar
(7) |
Apr
(15) |
May
(12) |
Jun
(7) |
Jul
(24) |
Aug
|
Sep
(2) |
Oct
(2) |
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
(20) |
May
(3) |
Jun
(4) |
Jul
(10) |
Aug
(21) |
Sep
(1) |
Oct
(5) |
Nov
|
Dec
(3) |
2009 |
Jan
(7) |
Feb
(4) |
Mar
(7) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
(2) |
Sep
(3) |
Oct
(4) |
Nov
|
Dec
(7) |
2010 |
Jan
(2) |
Feb
(6) |
Mar
|
Apr
(2) |
May
(7) |
Jun
(4) |
Jul
|
Aug
(6) |
Sep
(6) |
Oct
(4) |
Nov
(7) |
Dec
(2) |
2011 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
(8) |
May
|
Jun
(3) |
Jul
(3) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2012 |
Jan
(1) |
Feb
(9) |
Mar
(8) |
Apr
(7) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
(1) |
Dec
|
2013 |
Jan
(3) |
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(7) |
Nov
(3) |
Dec
|
2014 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(2) |
Jul
(9) |
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2016 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
13
|
14
|
15
|
16
|
17
|
18
|
19
(1) |
20
|
21
|
22
(1) |
23
|
24
(1) |
25
(1) |
26
(1) |
27
|
28
|
29
|
30
|
31
(1) |
|
|
|
|
From: Matthias B. <mat...@gm...> - 2010-08-31 21:51:55
|
Hi Roland, > The space ship is behaving like a aircraft, so the thrust comes from the > rear of the ship and when I turn the ship to the left or the right or go > up and down, the ship will go into that new direction. Well, I think a real aircraft couldn't really navigate in space due to the lack of an atmosphere, but as this is just going to be a simple game, I suppose this doesn't really matter... ;) > For the delta angles, when an arrow key is pressed to change the > orientation of the ship, a constant value is applied to the variable > corresponding to the impacted axis, left and right modify the y-axis and > up and down modify the x-axis ok, but you still have to be aware of what the actual rotation axes are. Obviously, it's not just the global axes (which your code seemed to suggest) but the local ones. Once you have established a suitable local coordinate system, applying the thrust shouldn't be a problem as it just acts in the opposite direction of what's considered to be "forward". So the question still is how you represent the state of your space ship. Obviously you need a position and an orientation. The position can be represented as a point in space, but for the orientation it would probably be advantageous to represent it as a single orientation instead of three Euler angles. Maybe you could try and do some experiments with a space ship that has no particular position but only an orientation (just render it at the origin and see if its orientation behaves correctly). Once the orientation of the space ship behaves right, adding the proper position shouldn't be a problem anymore. Cheers, - Matthias - |
From: Roland E. <r.e...@gm...> - 2010-08-26 17:59:49
|
Hi, The space ship is behaving like a aircraft, so the thrust comes from the rear of the ship and when I turn the ship to the left or the right or go up and down, the ship will go into that new direction. For the delta angles, when an arrow key is pressed to change the orientation of the ship, a constant value is applied to the variable corresponding to the impacted axis, left and right modify the y-axis and up and down modify the x-axis. Applying a rotation transformation is not a problem, the problem is really computing the new position given the current one, the new orientation and the distance (the thrust), hence, if I understand correctly the principle, create a new vector that can be added to the current position. Regards, Roland. Le 08/25/10 21:38, Matthias Baas a écrit : > Hi Roland, > > Roland Everaert wrote: >> searching some guidance on how to use quaternions correctly given the >> following parameters are known to me: >> >> - The thrust to apply to the ship >> - The current position of the ship in the scene >> - The current angle of rotation on all 3 axes >> - The delta to be added to each axis to define the new angle of rotation >> >> Below is the code I have written so far to update the position of the ship: >> >> if self.position[0] == 0.0 and self.position[2] == 0.0 and >> self.position[2] == 0.0: >> v = vec3(0, 0, (self.thrust * self.tick)) >> else: >> v = vec3(self.position) * (self.thrust * self.tick) >> q = quat().fromAngleAxis(math.radians(self.x_delta_angle), (1,0,0)) >> q_tmp = quat().fromAngleAxis(math.radians(self.y_delta_angle), >> (0,1,0)) >> q = q * q_tmp >> q_tmp = quat().fromAngleAxis(math.radians(self.z_delta_angle), >> (0,0,1)) >> q = (q * q_tmp) >> >> self.addToPosition(*q.rotateVec(v)) > Hm, I'm not quite sure I understand how you want to move your ship. You > should add comments to the lines to explain what the idea behind each > section of the code is. What movements is the ship supposed to be able > to do? > You are saying you represent the state of the ship with a position and 3 > rotation angles. About what axes are you rotating the ship? > How do you calculate your delta angles when you want to change the > orientation of the ship? > > I think what the guys in the other list meant when they said you should > use quaternions is to replace your 3 angles by a quaternion to represent > the orientation of the ship. For applying the quaternion as an OpenGL > transformation you can convert it into a matrix and then pass that one > to OpenGL. > > - Matthias - > > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > cgkit-user mailing list > cgk...@li... > https://lists.sourceforge.net/lists/listinfo/cgkit-user |
From: Matthias B. <mat...@gm...> - 2010-08-25 19:38:37
|
Hi Roland, Roland Everaert wrote: > searching some guidance on how to use quaternions correctly given the > following parameters are known to me: > > - The thrust to apply to the ship > - The current position of the ship in the scene > - The current angle of rotation on all 3 axes > - The delta to be added to each axis to define the new angle of rotation > > Below is the code I have written so far to update the position of the ship: > > if self.position[0] == 0.0 and self.position[2] == 0.0 and > self.position[2] == 0.0: > v = vec3(0, 0, (self.thrust * self.tick)) > else: > v = vec3(self.position) * (self.thrust * self.tick) > q = quat().fromAngleAxis(math.radians(self.x_delta_angle), (1,0,0)) > q_tmp = quat().fromAngleAxis(math.radians(self.y_delta_angle), > (0,1,0)) > q = q * q_tmp > q_tmp = quat().fromAngleAxis(math.radians(self.z_delta_angle), > (0,0,1)) > q = (q * q_tmp) > > self.addToPosition(*q.rotateVec(v)) Hm, I'm not quite sure I understand how you want to move your ship. You should add comments to the lines to explain what the idea behind each section of the code is. What movements is the ship supposed to be able to do? You are saying you represent the state of the ship with a position and 3 rotation angles. About what axes are you rotating the ship? How do you calculate your delta angles when you want to change the orientation of the ship? I think what the guys in the other list meant when they said you should use quaternions is to replace your 3 angles by a quaternion to represent the orientation of the ship. For applying the quaternion as an OpenGL transformation you can convert it into a matrix and then pass that one to OpenGL. - Matthias - |
From: Roland E. <r.e...@gm...> - 2010-08-24 18:53:45
|
Hi, I am trying since some times to write a "little" video game, a space shooter, using pygame and pyopengl. Everything is fine until now except that I am not able to update correctly the position of the player ship, and any other object in the scene. So after some recommendation from the pyopengl mailing list, regarding using quaternions to do the job, I tried using the quat class from cgkit, but without any success. So I am searching some guidance on how to use quaternions correctly given the following parameters are known to me: - The thrust to apply to the ship - The current position of the ship in the scene - The current angle of rotation on all 3 axes - The delta to be added to each axis to define the new angle of rotation Below is the code I have written so far to update the position of the ship: if self.position[0] == 0.0 and self.position[2] == 0.0 and self.position[2] == 0.0: v = vec3(0, 0, (self.thrust * self.tick)) else: v = vec3(self.position) * (self.thrust * self.tick) q = quat().fromAngleAxis(math.radians(self.x_delta_angle), (1,0,0)) q_tmp = quat().fromAngleAxis(math.radians(self.y_delta_angle), (0,1,0)) q = q * q_tmp q_tmp = quat().fromAngleAxis(math.radians(self.z_delta_angle), (0,0,1)) q = (q * q_tmp) self.addToPosition(*q.rotateVec(v)) So far, I use only quat and vec3, but I plan to use more from cgkit, like the components which seems great to define physical objects properties or the OBJ loader. I am quite new to CG and video game programming, so any help will be more than appreciated. Thanks, Roland. |
From: Matthias B. <mat...@gm...> - 2010-08-22 08:11:41
|
will wrote: > The helloworld sphere works find in the viewer; a simple "render.py > hello.py" crashes with a segment fault. Can you post the stack trace of that one? What is hello.py? Is this the demo1.py script from the web site or the source archive? You may have encountered the same issue that some other people have noticed before. It only seems to happen on Ubuntu systems, I have never been able to reproduce these segfaults on Fedora systems, OSX or Windows (so I couldn't really investigate it). > I want to run the snowflake in the example. I have both Aqsis and > Pixie installed, and after trial and error I found these library > paths to work: > > cgkit.cri.loadRI("/usr/lib/libaqsis_ri2rib.so") > cgkit.cri.loadRI("/usr/local/Pixie/lib/libri.so") > > the first, aqsis, when run with viewer.py says: The snowflake example uses the RenderMan interface directly which means you run your script directly and not via the viewer or render tool. Another thing to note, when you use Aqsis' ri2rib library, then it does really just that, it turns the RenderMan commands into RIB requests. This is why you saw the RIB output when you ran your script and it's also why you saw those "Unknown procedural function" messages in the RIB stream. The snowflake example uses the RiProcedural() call which passes a function to the renderer that gets called by the renderer while it's rendering the image. But when you archive a scene into a RIB stream, then that procedural won't work because it needs the function during rendering (from a RIB you can only use a few predefined procedurals). So in the case of Aqsis, you shouldn't use ri2rib for that example but the library that contains the actual renderer (I'm not sure what it's called on Linux, probably libaqsis_core.so). > When run directly without viewer.py, it just segfaults. Invoking it > with gdb shows this stack: > > #0 0x00007ffff56ef7e4 in __cxa_allocate_exception () from > /usr/lib/libstdc++.so.6 #1 0x00007ffff63044c7 in > __getitem__(support3d::vec3<double>*, int) () from > /usr/local/lib/python2.6/dist-packages/cgkit/_core.so #2 > 0x00007ffff630b7d8 in > boost::python::objects::caller_py_function_impl<boost::python::detail::caller<double > (*)(support3d::vec3<double>*, int), > boost::python::default_call_policies, boost::mpl::vector3<double, > support3d::vec3<double>*, int> > >::operator()(_object*, _object*) () > from /usr/local/lib/python2.6/dist-packages/cgkit/_core.so #3 > 0x00007ffff5e5cc2e in > boost::python::objects::function::call(_object*, _object*) const () > from /usr/lib/libboost_python-py26.so.1.40.0 #4 0x00007ffff5e5ced8 > in ?? () from /usr/lib/libboost_python-py26.so.1.40.0 #5 > 0x00007ffff5e64753 in > boost::python::detail::exception_handler::operator()(boost::function0<void> > const&) const () from /usr/lib/libboost_python-py26.so.1.40.0 #6 > 0x00007ffff62ecd67 in > boost::detail::function::function_obj_invoker2<boost::_bi::bind_t<bool, > boost::python::detail::translate_exception<support3d::ENotImplementedError, > void (*)(support3d::ENotImplementedError const&)>, > boost::_bi::list3<boost::arg<1>, boost::arg<2>, > boost::_bi::value<void (*)(support3d::ENotImplementedError const&)> > > >, bool, boost::python::detail::exception_handler const&, > boost::function0<void> > const&>::invoke(boost::detail::function::function_buffer&, > boost::python::detail::exception_handler const&, > boost::function0<void> const&) () from > /usr/local/lib/python2.6/dist-packages/cgkit/_core.so Hm, it crashes in __getitem__(support3d::vec3<double>*, int)() which is in wrappers/py_vec3.cpp and simply looks like this: double __getitem__(vec3d* self, int idx) { switch(idx) { case 0: return self->x; case 1: return self->y; case 2: return self->z; default: throw EPyIndexError("index out of range"); } } As the last call in the stack trace is "allocate exception" thing, it looks like the above function got called with an invalid index and it tried to throw an exception which failed for some reason. What looks suspicious is that the earlier entries in the stack trace also mention some exception stuff. Maybe it was already handling an exception...? Anyway, without being able to reproduce this, I can't really investigate the problem myself. It would be interesting to know what exactly triggered the getitem call. The previous calls in the stack trace are from Boost.Python. Can you try to figure out which Python call triggers this error? Maybe you should rather use your snowflake example (assuming this is the same problem) as that one involves less code. > Running with the pixie lib directly just segfaults. > > Running viewer.py with pixie as the lib actually renders the > snowflake As mentioned above, running the snowflake with viewer.py isn't really any useful. It just runs your RenderMan code which renders the image and then the viewer would pop up an OpenGL window with an empty scene. As far as the bug is concerned though, there is no difference between running the snowflake directly or via the viewer tool. It should either crash in both cases or run properly in both cases. Are you sure you haven't several versions of Python on your system? Can you please double check that you don't mix Python versions. Which Python versions gets run when you use the viewer tool? (you can use the -v option) Is it the same one you use when running Python directly? > (really quite slowly; is the snowflake deceptively > expensive or is this what I should brace myself for with all > rendermen?) On a 4 year old MacBook Pro, it takes about 10 seconds using Pixie. You can increase the subdivision threshold in the subdiv() function (the 0.005 in the if expression). > So, what is it that I actually want to use cgkit/renderman for?? > This: > > * I want to generate a world, renderer it to an (ideally in-memory) > bitmap, do some manipulation, then rinse and repeat. Unattended, no > viewer needed, low quality rendering is fine. It depends on the details on how much work it is, but in general, it's possible, yes. The "in-memory" bit might need a custom display driver though. > * I also want to know > if shapes intersect one another (that would be illegal in my model, > and it'd be nice if the render end can determine this for me rather > than me needing to do complex polygon intersection logic Well, a renderer renders an image, it's not really meant to do computational geometry. (You might be able to "abuse" RenderMan in this case though. The standard includes the CSG feature (=doing boolean operations on geometry) which is implemented by Aqsis. So you could render an intersection and check if the output contains any pixels or not. If it does, the geometries intersect otherwise they don't. But that's probably not the most efficient way to do this...). Cheers, - Matthias - |
From: will <va...@ya...> - 2010-08-19 22:14:59
|
I am new to all this but very enthusiastic! Thx for making this kind of software :) On a full latest version of Ubuntu on 64bit X86. Very standard. Using the non-lite C++ version. The helloworld sphere works find in the viewer; a simple "render.py hello.py" crashes with a segment fault. I want to run the snowflake in the example. I have both Aqsis and Pixie installed, and after trial and error I found these library paths to work: cgkit.cri.loadRI("/usr/lib/libaqsis_ri2rib.so") cgkit.cri.loadRI("/usr/local/Pixie/lib/libri.so") the first, aqsis, when run with viewer.py says: ##RenderMan RIB-Structure 1.0 version 3.03 Format 1024 768 1.000000 Display "koch.tif" "framebuffer" "rgb" PixelSamples 3.000000 3.000000 Projection "orthographic" Scale 0.800000 0.800000 0.800000 Translate 0.000000 0.550000 5.000000 WorldBegin Surface "constant" Color [ 1.000000 1.000000 1.000000 ] Patch "bilinear" "P" [ -2.000000 2.000000 1.000000 2.000000 2.000000 1.000000 -2.000000 -2.000000 1.000000 2.000000 -2.000000 1.000000 ] Color [ 0.000000 0.000000 0.000000 ] Unknown procedural function. #ERROR: Unknown procedural function. Unknown procedural function. #ERROR: Unknown procedural function. Unknown procedural function. #ERROR: Unknown procedural function. WorldEnd When run directly without viewer.py, it just segfaults. Invoking it with gdb shows this stack: #0 0x00007ffff56ef7e4 in __cxa_allocate_exception () from /usr/lib/libstdc++.so.6 #1 0x00007ffff63044c7 in __getitem__(support3d::vec3<double>*, int) () from /usr/local/lib/python2.6/dist-packages/cgkit/_core.so #2 0x00007ffff630b7d8 in boost::python::objects::caller_py_function_impl<boost::python::detail::caller<double (*)(support3d::vec3<double>*, int), boost::python::default_call_policies, boost::mpl::vector3<double, support3d::vec3<double>*, int> > >::operator()(_object*, _object*) () from /usr/local/lib/python2.6/dist-packages/cgkit/_core.so #3 0x00007ffff5e5cc2e in boost::python::objects::function::call(_object*, _object*) const () from /usr/lib/libboost_python-py26.so.1.40.0 #4 0x00007ffff5e5ced8 in ?? () from /usr/lib/libboost_python-py26.so.1.40.0 #5 0x00007ffff5e64753 in boost::python::detail::exception_handler::operator()(boost::function0<void> const&) const () from /usr/lib/libboost_python-py26.so.1.40.0 #6 0x00007ffff62ecd67 in boost::detail::function::function_obj_invoker2<boost::_bi::bind_t<bool, boost::python::detail::translate_exception<support3d::ENotImplementedError, void (*)(support3d::ENotImplementedError const&)>, boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void (*)(support3d::ENotImplementedError const&)> > >, bool, boost::python::detail::exception_handler const&, boost::function0<void> const&>::invoke(boost::detail::function::function_buffer&, boost::python::detail::exception_handler const&, boost::function0<void> const&) () from /usr/local/lib/python2.6/dist-packages/cgkit/_core.so and so on; I'd guess this is the segfault I find when running render.py too? Running with the pixie lib directly just segfaults. Running viewer.py with pixie as the lib actually renders the snowflake (really quite slowly; is the snowflake deceptively expensive or is this what I should brace myself for with all rendermen?) However, when I close the koch.tif window, a second viewer window appears and then there's a segfault. So, what is it that I actually want to use cgkit/renderman for?? This: * I want to generate a world, renderer it to an (ideally in-memory) bitmap, do some manipulation, then rinse and repeat. Unattended, no viewer needed, low quality rendering is fine. * I also want to know if shapes intersect one another (that would be illegal in my model, and it'd be nice if the render end can determine this for me rather than me needing to do complex polygon intersection logic Is this possible, and how? Sorry for the long post, but I'm really excited about cgkit! |