New 3d API

Discussions for core devs and contributors. Read only for normal forum members to keep the noise low

Re: New 3d API

Postby mzechner » Thu Jan 17, 2013 12:38 pm

For reference, the logs of the material discussion http://pastebin.com/MFat4Zg9. Btw, the libgdx irc channel is now logged, http://echelog.com/logs/browse/libgdx/1358377200
mzechner
Site Admin
 
Posts: 4879
Joined: Sat Jul 10, 2010 3:50 pm

Re: New 3d API

Postby xoppa » Thu Jan 17, 2013 9:39 pm

The main purpose of the mask was (is) to have a "signature" for the material, so it's possible to compare shaders and materials. Think of every bit in the mask as a uniform a shader might or might not implement (although it doesn't have to be a uniform). In the last implementation you wouldn't have multiple TextureAttributes, but instead a DiffuseTextureAttribute, BumpmapTextureAttribute etc. I changed the NewMaterial a bit and removed the (deprecated) casting support, instead it uses a String now (which could be the uniform name). This way you can use a more generic TextureAttribute which can be a diffuseTexture (bit/uniform), specularTexture, etc. I also separated the code and added a ColorAttribute to better show the usage. The Attribute class could have an alias property like the ColorAttribute hints to, but isn't absolute necessary as that's shader dependent. Note that the actual implementation of the specific attributes can be close to the current attributes.
xoppa
 
Posts: 689
Joined: Thu Aug 23, 2012 11:27 pm

Re: New 3d API

Postby xoppa » Sun Jan 27, 2013 2:43 am

I just added some changes to new3dapi branch:

Added a TextureDescription class which describes everything needed to bind a texture (texture, minfilter, magfilter, uwrap, vwrap, other values to be added). And modified the pipeline to use this instead of a texture.

Added a basic TextureAttribute so its easier to test the material we're discussing.

Added a very simple NewModel class so we can discuss the new model implementation. I also added a InterimModel to create a NewModel (with NewMaterial) based on the current Model implementation.

Added a Renderable class (which can be extended if needed) to describe the parts of a model. And also updated the RenderInstance to use that. The RenderBatch now fully hides the RenderInstance usage, so it's probably easier to work with.

Added a very simple Light class (WIP) and modified the pipeline to include lights. The TestShader shows the usage. But the actual implementation isn't included yet.
xoppa
 
Posts: 689
Joined: Thu Aug 23, 2012 11:27 pm

Re: New 3d API

Postby mzechner » Thu Mar 21, 2013 2:27 pm

Been a while, picking up on this again. Just merged master into the new3dapi branch. Going to go through the sources. We should come up with a list of things that need to be done, including the fbx-converter project (e.g. cross-platform builds).

ninja edit: heh

Image
mzechner
Site Admin
 
Posts: 4879
Joined: Sat Jul 10, 2010 3:50 pm

Re: New 3d API

Postby mzechner » Thu Mar 21, 2013 3:56 pm

Beginning clean-up work. I moved all the old packages to g3d.old, i moved all of xoppa's package to top-level g3d, and kept bach's loader in g3d.loader. I'm now going to remove any references to the classes in the old package, i think we should use the pojos in the json loader as our new representation, not sure yet.
mzechner
Site Admin
 
Posts: 4879
Joined: Sat Jul 10, 2010 3:50 pm

Re: New 3d API

Postby mzechner » Thu Mar 21, 2013 5:14 pm

I temporarily broke the bullet wrapper in the new3dapi branch, as it has a dependency on the old Model class. Should i resolve this, or can i leave it in that state until i have the new Model class ready? I fear merge conflicts with Master, which still relies on the old Model stuff.
mzechner
Site Admin
 
Posts: 4879
Joined: Sat Jul 10, 2010 3:50 pm

Re: New 3d API

Postby mzechner » Thu Mar 21, 2013 11:37 pm

Xoppa and i just discussed how to continue working on this. We want to merge the new3dapi with master. The old classes are still in their, but moved to a temporary package (g3d.old). While this is not ideal, it allows us to resolve issues with the current bullet implementation, which relies on the Model class, quickly and cleanly. The only thing we need to do is to quickly and thoughfully come up with our new Model class. I'll try to prototype that on the new3dapi branch this weekend, then pass it by you folks before i merge.
mzechner
Site Admin
 
Posts: 4879
Joined: Sat Jul 10, 2010 3:50 pm

Re: New 3d API

Postby mzechner » Sat Mar 23, 2013 6:00 pm

Fixed up fbx-conv so it compiles on Windows, Linux and Mac OS X. When i say fixed, i mean i pulled in the changes of a fork of fbx-conv by gered :)

I'll upload binaries to our server some time this weekend, for all OS'. Otherwise, just pull fbx-conv, install premake, install the FBX SDK, export FBX_SDK_ROOT, then run one of the generate_XXX scripts. After that build with VS/Xcode/Makefile. Voila :D
mzechner
Site Admin
 
Posts: 4879
Joined: Sat Jul 10, 2010 3:50 pm

Re: New 3d API

Postby mzechner » Sat Mar 23, 2013 11:38 pm

Added the new Model class, as well as additional classes. See https://github.com/libgdx/libgdx/tree/n ... /g3d/model

JsonModelLoader now loads ModelData (parseModel), which can be used to construct a Model. ModelData is similar to TextureAtlasData or BitmapFontData, it doesn't contain any OpenGL ES resources (meshes, textures). Instead, one has to construct a Model from the ModelData, which will load textures (through a TextureProvider, so you can actually perform the loading however you want) and constructs Meshes (which are now shared, unlike before, win!).

I have yet to tackle animation, and there are a few FIXME's in the new classes. But the overall structure should stay like this. The new Model class is hierarchical, it contains nested Nodes, which have a transform and a reference to a mesh parts and a materials (one node can have multiple mesh part/material pairs, expressed through MeshPartMaterial, we need a better name for that...).

I have not thought about keyframed models yet, will have to come up with a solution for that. I tend to think we should have a special form of Animation for that, which stores the keyframes, instead of trying to shoehorn it into the other Model classes.
mzechner
Site Admin
 
Posts: 4879
Joined: Sat Jul 10, 2010 3:50 pm

Re: New 3d API

Postby xoppa » Sun Mar 24, 2013 1:31 am

Added a PR to use the new model in the bullet tests. Didn't change but commented the MeshShapeTest as it uses StillModel to load obj files.
xoppa
 
Posts: 689
Joined: Thu Aug 23, 2012 11:27 pm

PreviousNext

Return to Libgdx Development

Who is online

Users browsing this forum: No registered users and 1 guest