FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Engine design questions
Goto page 1, 2  Next
 
Post new topic   Reply to topic     Forum Index -> Yage
View previous topic :: View next topic  
Author Message
jdrewsen



Joined: 05 Mar 2008
Posts: 21
Location: Copenhagen, Denmark

PostPosted: Tue Sep 07, 2010 9:55 am    Post subject: Engine design questions Reply with quote

Hi,

I was thinking about creating a 3d engine in myself but checked out existing projects first. I noticed yage as one of the only actively developed engines and I think it might be a better idea to contribute to this instead of starting yet another game engine Wink

I have some question regarding the design though:

The rendering of the scene is as far as I can see done by traversing the tree and rendering the geometries one by one. I've read that context switching (binding textures, changing shaders,...) is quite expensive and because of this the rendering order should not be dictated by the scene tree. Instead another container could keep the meshes in an order where iterating would create a minimum of context switces. Is this something you've concidered? Have you been hit by any rendering performance so far that may be caused by this?

I've previously implemented a parser for the .blend format (in the Go language). Blender is my primary modelling tool and I would like to optimize my workflow as much as possible. If you are open for patches I might try to implement a reader in D and integrate with yage?

Jonas
Back to top
View user's profile Send private message
JoeCoder



Joined: 29 Oct 2005
Posts: 294

PostPosted: Tue Sep 07, 2010 7:56 pm    Post subject: Reply with quote

I gave you write permission to yage's svn repository. Just use your dsource username and password. I love it when people are interested in contributing, but I do have some rules for contributors.
Quote:
I've read that context switching (binding textures, changing shaders,...) is quite expensive and because of this the rendering order should not be dictated by the scene tree. Instead another container could keep the meshes in an order where iterating would create a minimum of context switces. Is this something you've concidered?

Take a look at yage.system.graphics.render:87. Everything that's visible goes into this container before rendering. I'm not sorting it yet, but I hope to eventually.
Quote:
Have you been hit by any rendering performance so far that may be caused by this?

It's hard to tell. At one point I modified yage.system.graphics.api.opengl to only bind a new texture or shader when it was different than the previously bound, and saw a decent speed increase, but I don't remember by how much.
Quote:
I've previously implemented a parser for the .blend format (in the Go language). Blender is my primary modelling tool and I would like to optimize my workflow as much as possible. If you are open for patches I might try to implement a reader in D and integrate with yage?

I've been implementing Collada, but I stopped about halfway through skeletal animation. I chose this format because almost everything supports it, and I think the lasted Blender 2.5 supports it as one of the default export formats?. I hope to keep Yage lightweight, but I would consider also having a .blend loader under some of these conditions:
    .blend can bring useful features into Yage that would be lost in the collada format.
    It can be used without big changes to the Geometry/Model/Material/Technique/Pass data structures.
    It can be done in around 1k lines of code or less.
    Maybe .blend files are smaller in size and faster to load than Collada?
Back to top
View user's profile Send private message
jdrewsen



Joined: 05 Mar 2008
Posts: 21
Location: Copenhagen, Denmark

PostPosted: Wed Sep 08, 2010 3:32 pm    Post subject: Reply with quote

Quote:
I gave you write permission to yage's svn repository. Just use your dsource username and password. I love it when people are interested in contributing, but I do have some rules for contributors.


Thank you. The rules are just fine with me.

Quote:
I think the last Blender 2.5 supports it (collada format) as one of the default export formats?


That is correct. But it is much quicker to work with the native format and speed is important in a creative process from my experience.

Quote:
.blend can bring useful features into Yage that would be lost in the collada format.


I've just looked shortly at the collada format and it seems to be very comprehensive. I cannot pin point any features that .blend has and collada doesn't.

Quote:
It can be used without big changes to the Geometry/Model/Material/Technique/Pass data structures.


I believe the loader can be implemented without big changes yes.

Quote:
It can be done in around 1k lines of code or less.


I think that is possible yes.

Quote:
Maybe .blend files are smaller in size and faster to load than Collada?


As mentioned I do not know collada that much. But from looking at some example collada files they seem as verbose as any other XML formatted documents.

The .blend format is a binary format. But it is quite cleverly formatted being very forward compatible which is why you can read a .blend version 1 file in blender (the newest 2.49) even though many features have been added.

As for size it is much smaller because of the more compact binary format - especially for larger geometries.
Back to top
View user's profile Send private message
JoeCoder



Joined: 29 Oct 2005
Posts: 294

PostPosted: Wed Sep 08, 2010 3:39 pm    Post subject: Reply with quote

Sounds good to me. Add a blender.d module in the same folder as collada.d and add a switch in model.d to use it if the file extension matches.

And thanks for your interest!
Back to top
View user's profile Send private message
JoeCoder



Joined: 29 Oct 2005
Posts: 294

PostPosted: Fri Sep 10, 2010 10:56 pm    Post subject: Reply with quote

I'd be really impressive if you're able to get the data structures for skeletal animation populated. I can write the animation code after that, but with Collada, the skeleton always ended up at a different place for each model, and never the correct place. I may have had my matrices wrong.

You can enable Yage.resource.model.Model.drawJoints on an instance in order to see where it is.
Back to top
View user's profile Send private message
JoeCoder



Joined: 29 Oct 2005
Posts: 294

PostPosted: Mon Sep 13, 2010 3:10 pm    Post subject: Reply with quote

Oh, and take your time and work on this when it's fun for you. We want to make a good engine, but nobody is in any hurry.
Back to top
View user's profile Send private message
jdrewsen



Joined: 05 Mar 2008
Posts: 21
Location: Copenhagen, Denmark

PostPosted: Tue Sep 14, 2010 2:00 am    Post subject: Reply with quote

Yes. It has to be fun Very Happy

I've now implemented the basic reading of the .blend structure and file blocks. The next thing is to get down and dirty with the data blocks (objects/meshes etc.)

I'll start out with support for simple loading of models. But will definitely try to get skeletal animations to work since I'm going to use that myself.

Thx for the heads up about drawJoints - that will come in handy for sure.
Back to top
View user's profile Send private message
JoeCoder



Joined: 29 Oct 2005
Posts: 294

PostPosted: Tue Sep 14, 2010 9:42 am    Post subject: Reply with quote

I also don't have any code yet for animating the skeleton, but I've done it before outside of Yage so I don't expect much trouble.
Quote:
This is my first commit. I hope it is okey to put the patches directly to subversion and not going through the forum first. Otherwise give me a hint Smile

Thanks for fixing the Linux bugs. It's been at least six months since I built on Linux so getting those fixed was way overdue on my part. It looks like your change broke shaders on windows, but I fixed it. I also moved the string.dup outside the loop, so it happens once.

I've got an Ubuntu 64 setup in VirtualBox, but I still need to install dmd and friends.
Back to top
View user's profile Send private message
anarky



Joined: 03 Jul 2010
Posts: 35

PostPosted: Wed Sep 15, 2010 6:30 am    Post subject: Reply with quote

I looove Blender. It can be a good tribute to the Blender guys to support directly their format, if we all use it Very Happy Also I don't know that many open source engines which support .blend, it can be seen as a "feature" to attract more contributors to Yage3D.

/+ Anarky +/
Back to top
View user's profile Send private message
jdrewsen



Joined: 05 Mar 2008
Posts: 21
Location: Copenhagen, Denmark

PostPosted: Wed Sep 15, 2010 7:45 am    Post subject: Reply with quote

Yeah much better with the string.dup outside the loop. dough!

I'm a bit mystified by the fullscreen member variable being available on the windows platform because there is a version(linux) around the definition in the top of the class.

see:
http://www.dsource.org/projects/yage/changeset/205#file17
file:
trunk/src/yage/system/window.d

Is the version(...) broken when using it this way or am I missing something?
Back to top
View user's profile Send private message
JoeCoder



Joined: 29 Oct 2005
Posts: 294

PostPosted: Wed Sep 15, 2010 9:42 am    Post subject: Reply with quote

This code is almost 5 years old and has been modified way too many times. It's due for a complete rewrite.

Lower down in the same file, you'll see Window2. I'm hoping to ditch SDL completely due to it's many limitations and go with native windowing calls. This is low priority for me and open to anyone who's interested.
Back to top
View user's profile Send private message
jdrewsen



Joined: 05 Mar 2008
Posts: 21
Location: Copenhagen, Denmark

PostPosted: Fri Sep 24, 2010 1:55 am    Post subject: Reply with quote

A little update.

I've now implemented parsing of blender DNA structures and can read the raw data from a .blend file. For people who don't know about the .blend format this means that I've implemented the equivalent of a DOM parser (XML files) for blend files. Except the .blend files are binary and the XML Schema is the DNA Structure embedded in the .blend file - approximately.

The next step will be to read the mesh data (fairly easy) and construct the yage mesh from that. I guess I can use the collada importer as inpiration for this part.
Back to top
View user's profile Send private message
JoeCoder



Joined: 29 Oct 2005
Posts: 294

PostPosted: Fri Sep 24, 2010 8:55 am    Post subject: Reply with quote

That's great. If you want (and if it doesn't break anything else), go ahead and commit this part.

For anyone interested, I posted this question on gamedev.stackexchange a couple days ago.
Back to top
View user's profile Send private message
jdrewsen



Joined: 05 Mar 2008
Posts: 21
Location: Copenhagen, Denmark

PostPosted: Wed Sep 29, 2010 2:17 am    Post subject: Reply with quote

Quote:
For anyone interested, I posted this question on gamedev.stackexchange a couple days ago


Definitely interesting stuff. Looking forward to looking into the rendering part of yage.

Meanwhile I can now import the meshes from a .blend file with normals and texcoords etc. The next thing is to utilize the textures embedded in the .blend file and after that some material conversion from blender version to similar approximate yage version.

I'll wait a bit before committing anything since this is also D learning experience. Some cleanups and refactoring should probably be done first since I'm learning new D/tango tricks each time I code something Smile
Back to top
View user's profile Send private message
JoeCoder



Joined: 29 Oct 2005
Posts: 294

PostPosted: Wed Sep 29, 2010 10:45 am    Post subject: Reply with quote

It's ok to commit sloppy code if you plan to clean it up later. Something could happen to you or your hard drive.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Yage All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group