my_model = pyglet.model.load("thing.obj")
--You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe@googlegroups.com.
To post to this group, send email to pyglet...@googlegroups.com.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.
Hi Ben,That's great to hear.Projection (or rather, getting my model positioned and view configured to display the model on screen ;-) is something that frequently stumps me when I go back into OBJ modelling each time. It'd be awesome if there was a reasonable default 3D projection (with an extended one that had some view controls would be super). Having that code be highly modular and easy to read would be a boon for newcomers.Richard
On 30 May 2017 at 14:10, Benjamin Moran <benmo...@gmail.com> wrote:
Thanks Richard,--
Batch support is definite. I actually hacked up a Sprite-module-like class based off of the /contrib code, which included both batch support as well as a direct Model.draw() method for people who like slow code :)
Since you're here, what are your thoughts on projection? For my personal projects I have 2D and 3D fixed resolution viewport classes, which maintain aspect ratio on resizing. These are similar to the examples/fixed_resolution.py file. I gather from reading old discussions that something like this may have been planned for inclusion at some point.
-Ben
On Tuesday, May 30, 2017 at 12:43:20 PM UTC+9, Richard Jones wrote:+1 to make life easier, since OBJ is something I carry around between projects. As long as the implementation has batch support :-)
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users...@googlegroups.com.
I use these clases here for my personal 2D and 2.5D (3D, but only ever viewed from straight on) projects:
https://bitbucket.org/snippets/HigashiNoKaze/7ndxM
It might work to have a Projection class with set and unset methods, which could be passed to the Window. This could be called automatically before and after draw. One issue is that sometimes you might want to reset this stuff during a draw call, such as for doing a 2D hud over a 3D background...
As for the actual 3D model transformations, I suppose it makes the most sense to put the transform calls inside a ModelGroup (based on how the Sprite class does it with SpriteGroup). This would allow setting any transform variables (x, y, z) on the model, and having it handled when the Group sets the state.
It would be foolish to try to recalculate all of the Model's vertex lists to move it, but it might be useful to have a base offset parameter for when the image is loaded. This would allow loading in multiple models that are all based around 0, 0, 0, but you want to situate at different positions within the scene.
Modern Python techniques suggest a context manager (or set of related context managers that could be used individually or combined) that pushes/pops state :-)
Perhaps attach some GLSL to the model to handle transformation? ModelGroup etc. then just loads the vertices etc. and manages the GLSL variables.
image = pyglet.image.load("image.png")
# and:
image = pyglet.resource.image("image.png")
teapot = pyglet.model.load("teapot.obj", batch=batch)
# and:
teapot = pyglet.resource.model("teapot.obj", batch=batch)
--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe@googlegroups.com.
LGTM
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users...@googlegroups.com.
I hacked on this a bit more, and basically have a working implementation now. It's structured pretty much like the image module, which I think makes the most sense after all. There is a single codec, which is wavefront (obj) decoder based on the pyglet/contrib/model code. It works, but needs major cleanup.
Richard, what would you say are vital method to have on the Model class? So far, I have a draw method (which people shouldn't use anyway), and an update method which allows shifting the model on one of the x, y, z axis (requiring lots of list slicing). Any thoughts on what methods would be most important to add? My personal use case is mainly for static background objects, so I'm not the best judge in this case!
ISTM that gross operations on the model (transformations on all vertices like the translation - I think that's what you mean by "shifting the model") should be handled entirely by a shader, and no actual vertex data manipulation, since setting the shader variable will be infinitely faster.Richard
Model.update(x, y, z) # Translate on a specific axis.
Model.scale(1.0) # Rescale the entire model.
Model.rotate(x, y, z) # Rotate along one or more axis.To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe@googlegroups.com.
To post to this group, send email to pyglet...@googlegroups.com.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe@googlegroups.com.
Hi there
Not sure if you would like an external dependency or not, but
there is assimp, see
http://www.assimp.org/index.html
It loads various formats to the same structure so the code will
only have to worry about one format internally (I haven't used it
yet, but probably will try it out in future).
And I don't see the point to write your own codecs if some one else already has gone through the trouble making such a library.
But sure, pyglet could focus on just one or few formats and that
would be probably enough (since there are other ways to convert a
model to the supported format). I would like a format where one
can define bones and animations too. But that is just my wish.
Keep up the good work.
~DR0ID
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe@googlegroups.com.
I think as one of the "pyglet elders", Richard gets two votes here :)
I believe that generic 3D model support, and a user-friendly way to set 2D and 3D projections are two of the last things missing from pyglet.
Splitting pyglet into seperate modules at this point is probably not a good idea due to the aforementioned number of contributors. It's a discussion best left for the future when we're migrated to GL3+/Python3, and possibly pick up a few active contributors.
Regarding avoiding bloat, I think the basic classes and loading mechanisms are important. The codecs themselves are a different story, and I agree that we shouldn't try to support too much. We have good mechanisms for adding codecs later, just like the image module:
One or two generic decoders are probably a good idea. Obj seems a no-brainer.
The obj codec (so far) uses the os module to find the base path of the file object, and locates the other material and image files that way.
There might be some hiccups that will pop up once trying to use the resource module, but nothing we can't solve. Any suggestions welcome, as always.
--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe@googlegroups.com.
Hi all,The ratcave package I wrote (https://github.com/neuroneuro15/ratcave) and use in my virtual reality research is exactly this.Documentation and Tutorials: http://ratcave.readthedocs.io/en/latest/introduction.html#featuresBest wishes,Nick
On Mon, Jun 19, 2017 at 4:29 AM, Benjamin Moran <benmo...@gmail.com> wrote:
I still plan on merging in the basic framework for Models, but first I'm going over Steve's work on the documentation.
Regarding loading the files, I realize we'll have to do something regarding binary versus ascii formats. My initial thinking is that we should default to loading as binary for everything, and just decode to ascii inside the ModelDecoders if necessary. This would prevent a bit of waste inside the load and resource methods.
On Friday, June 9, 2017 at 12:46:36 AM UTC+9, Benjamin Moran wrote:Other modules support loading resources from either a file object or just a filename, which the model one does as well.The obj codec (so far) uses the os module to find the base path of the file object, and locates the other material and image files that way.
There might be some hiccups that will pop up once trying to use the resource module, but nothing we can't solve. Any suggestions welcome, as always.
--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe@googlegroups.com.
Hi all,
This is one thing that was often talked about in the past, but noone ever got around to implementing. It would be great to implement for some future release.
I've done some tinkering around with this, and after some thought I think I have a decent idea on how it might fit in. (I'm going with the working name "model" for the module, but name suggestions are welcome!).
Creating a 3D models would be different from Sprites, since it involves loading one or more files from disk. For this reason, it seems to me that it makes the most sense to shape this this after the current "image" module. Just as there are different codecs for handling different image formats, we would have different parsers for a few different 3D model formats. You would do something like:The file extension would be used to determine which parser to use, just as the image module does. (There is already some example code in /contrib for loading obj files, so a parser would be easy to create). Extending pyglet.resource to use this loader would be trivial.my_model = pyglet.model.load("thing.obj")
The main thing to do is to figure out internal classes for the abstract representation of the data. For example, instead of ImageData that's returned from the image codecs, we would have VertexData, MaterialData, etc. The 3D model class would constructed from this, in the same way the Sprite class is constructed from an image and positional data.
I'd love to hear feedback on this.
-Ben
The classes are all pretty limited, with the idea that it can be expanded for the upcoming GL3 release where appropriate.
A transform matrix can be set after loading. Matrix Multiplication currently takes place in the Groups, and will be done in a Shader in the pyglet 2/3 release.
--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe@googlegroups.com.
\o/ (not that I'm in a position to really kick the tyres on this one at the moment, but it's great to see this land)
On 16 August 2018 at 10:41, Benjamin Moran <benmo...@gmail.com> wrote:
I merged in an initial version of thid work. Feedback would be great, if you see something really wrong!
The classes are all pretty limited, with the idea that it can be expanded for the upcoming GL3 release where appropriate.
A transform matrix can be set after loading. Matrix Multiplication currently takes place in the Groups, and will be done in a Shader in the pyglet 2/3 release.
--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users...@googlegroups.com.