Author Topic: sen3d - My first 3d engine!  (Read 4306 times)

0 Members and 1 Guest are viewing this topic.

Offline b0ib0t

  • ZX 81
  • *
  • Posts: 12
  • Karma: 1
    • View Profile
sen3d - My first 3d engine!
« on: January 11, 2008 »
Today is my first day of access to this fine board you have here. I would like to share with everyone (who will listen!) the 3d engine I am working on!  It is called sen3d. sen stands for Simple ENgine.  I have decided to make it GNU and put it on Sourceforge.net.  Although, if I ever do another engine, it will not be GNU!

The goal for the engine is to achieve at least minimally, the graphics as seen in the Ridge Racer games for Playstation 1.  So that would be an early to mid 90's looking 3d engine. 

I am half way through the next release, which is going to add a lot of things, such as

-View distance settings (culling and cutting of dynamic and static objects!)
-In script multi-line comments ( /* example */)
-Object property settings, renderMode, and inputBinding (and maybe more?)
-A whole new, deluxe camera system!

I'm not sure what else to say about it. It is geared towards games, but could also easily do demo's. I'm not even really sure if a bunch of demo guru's would be interested in a game engine haha!  The fact is, its quite discouraging to put all this work into it, and have nobody even say hello to me!

Any ways, here is the website for the engine. I will be updating it by next week.

http://sen3d.sf.net

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17414
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: sen3d - My first 3d engine!
« Reply #1 on: January 11, 2008 »
What a cool first post :)

 :hi: b0ib0t Have some good karma and a warm welcome to the board.

A lot of people here make thier own 3D engines but some people are really happy to both test a new engine and use it.

It will definately be of interest to people here, thank you for posting it!
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Tetra

  • DBF Aficionado
  • ******
  • Posts: 2532
  • Karma: 83
  • Pirate Monkey!
    • View Profile
Re: sen3d - My first 3d engine!
« Reply #2 on: January 12, 2008 »
 :hi: to the forum :)

I'm looking forward to see how it develops, definately keep posting updates.

Also it would be cool to hear about the various techniques you use in the different aspects of the engine such as how you render your trinagles, and how you store vertex data, etc. Its always good to see the different approaches people have to achive the same thing :)

Good Luck with it and keep us posted.
Challenge Trophies Won:

Offline b0ib0t

  • ZX 81
  • *
  • Posts: 12
  • Karma: 1
    • View Profile
Re: sen3d - My first 3d engine!
« Reply #3 on: January 15, 2008 »
The engine started out as a fairly simple parser. The reason for this is that I wanted
to have a good scripting system. This way to make a game or demo, one would not have
to edit or add much code to the engine itself, but merely write a script to controll
the engines already existing features.

The lexer pulls data from an array (called parsBuffer()) and sets engine states
accordingly. 

In the case of how vertex data is stored, the parser subroutine can be sent many different
codes for what mode it should operate in. These modes change based on what type of file
you are trying to parse.  In the case of .raw model files (exported by the Blender modeling
app) the parser fills an array called modelBuffer().  After the modelBuffer is filled the
program is then routed to a loadModel subroutine. 

The loadModel subroutine is the final stop for vertex data. A lot happens here. The
vertex data is put into a multi dimensional array called vertexArray, the first dimension
of the array stores the models code number, and the second contains all of that models
vertex data. This allows multiple models to be stored in that same array. Also in the
loadModel sub, is an array that stores modelnum and that associated models properties, such
as filename, and object properties.

In the script you can define object properties, such as rendermode (wireframe, points, etc).
When you define the rendermode for an 3d model, those properties are stored to that modelProperties array found in loadModel.  This allows for many options for how you would want to effect an 3d obejct. Such as, but  not limited to
Code: [Select]
-render mode
-key bindings
-anim bindings
-path bindings
In the script you might have something that looks a bit like this.
Code: [Select]
engineMode fps
load 3dcube.raw
bindInput 3dcube.raw
renderMode 3dcube.raw quads
That little bit of script would tell the engine that it is running in "fps" mode. And this means
that if an object is bindInput, it will be bound to the standard controll scheme of an fps style
game (wsad + mouse).  Obviously you would be able to override the standard control schemes, but in many cases you would not need to.  Second, in the script loads the .raw model, and after binding fps input, the engine is told to render that model in quads mode.


Some of my newest additions, are multi line comment system, that allows comments to be contained in the script. For example...
Code: [Select]
/*  this is where
    we start the engine */
engineMode fps
This is how the multi line comments look at the moment.

I am also working with occlusion and culling. Right now I am working on an extremely simple spherical object culling system. The way this is working right now is, the distance between vertex and center of the camera is measured. Any first vertex in a set of 4 verticies, and the 3 verticies that follow it  that exceeds the limitation of view distance is not rendered. A little more clear way to say it is. If an vertex is out of range, the entire quad is not rendered. This means we skip 12 sets of coordinate data. This is going to be for static objects only in the future. The way it will work for dynamic objects is, the entire object will not be rendered if just 1 vertex is out of view.

The reason I get rid of the entire quad on static objects is because it is slow to do a check for each vertex to see if it is out of view. If I check only the root vertex per quad, this is much faster! We save the time of what would have been 12 conditional checks, that involve complex floating point math, per quad.

It is a bit slower than Octree's would be, but much faster than nothing at all. It is also much more simple then Octree's I might add.
« Last Edit: January 15, 2008 by b0ib0t »

Offline b0ib0t

  • ZX 81
  • *
  • Posts: 12
  • Karma: 1
    • View Profile
Re: sen3d - My first 3d engine!
« Reply #4 on: January 15, 2008 »
Earlier I had mentioned that I would be having an update by the middle of this week or so. Unfortunately I do not think things will work out this fast.  I have created two bugs that are quite difficult to squish.

Bug 1:

If you move an object entirely off of the screen, you sill see one poly that is drawn from the edge of the screen, to what is set as the camera coordinates.  This only happens when doing model translations. I am trying to get rid of this unwanted effect.

Bug 2:

When setting the engine to "fps" mode, the camera moves to fast, and inconsistently, regardless of the values passed for amount of translation.

So that everyone is able to see where I am so far, I have uploaded my work to mediafire. Any feedback or suggestions would be most appreciated! :D

http://www.mediafire.com/?bwhy3xszy4r

Offline b0ib0t

  • ZX 81
  • *
  • Posts: 12
  • Karma: 1
    • View Profile
Re: sen3d - My first 3d engine!
« Reply #5 on: January 17, 2008 »
Good news!  I have managed to fix all the mentioned bugs! I also managed to find a better way to do the transformations.  Before, I had been looping the entire set of vertex, and adding to it. Now I am using an transArray. The transArray has a key for the model number, and 3 sets of data for X, Y and Z. 

As the engine loops in the main render loop, the transArray is applied to the vertex data.  This way is much faster, and also helped to fix one of my bugs that had been mentioned.

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17414
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: sen3d - My first 3d engine!
« Reply #6 on: January 17, 2008 »
Thank you for posting back how it is coming along :) Please carry on, it's interesting to read about you developing this project.
Shockwave ^ Codigos
Challenge Trophies Won: