Hello fellow people =]
I’d like to show what I’ve been working on for the last couple of months. I call it Irradiance =]
You can find two screenies at the bottom of this post!
Why am I doing this?
I’ve always wanted to program a game engine way back since I was a kiddo modding games, and it feels like I’m finally on the right track.
The other reason is this is going to be a portfolio project (big one) and I hope that I’ll get to finish it before my
education comes to an end, cause by that time I need to be out on internship/placement. The goal here is to show
that I have some understanding regarding subjects about game engines as a Tech artist, but also that I can code tools outside of MEL scripting / Maya API.
How far have I got?
The screenshots might not show much but there is alot of stuff ready behind the scenes. Asset tracking, project creation and loading,
3D picking and selecting objects, deleting, parenting with transforms affecting children correctly, layers. Shaders are compiled and
stored as byte array inside a generated c# file duing the process. This file contains all the code needed to run the shader with the engine.
It implements IRadShader interface that contains stuff such as SetEngineParameters(world, view, proj) and SetLightParameters(lightArray)
and the logic inside those functions are done by scanning the .fx file and its available semantics and variable names during the
code generation, then the logic is generated aswell to match (such as properties setting shader constants).
I also have a modelmanager, shadermanager, scenegraph and hierarchy, lightmanager, texturemanager. The engine is component based similar to Unity3D.
I’ve optimized 90% of what I have written so far together with the lovely NProf profiling tool.
The Editor
The editor is coded with the lovely WPF framework from microsoft (Windows Presentation Foundation). This is basically like Silverlight
and it replaces Windowsforms. I’m using the M-V-VM Design approach to code the editor ( decoupling the UI and the
Logic to maintain the code easily and do unit testing). All the data is handled through Databinding in WPF.
The UI style is from Microsoft Expression Blend 3 Theme. Assigning stuff is handled by Reflection from .NET (such as components).
Building the game will be done with the MSBuild class that generates a Visual studio project in memory and compiles. My goal is
to make it as easy to use as possible. I’m not trying to compete with Sunburn or TorqueX, this is just for both learning purposes and
portfolio =)
The rendering pipeline
Note: OPTIONAL means can be set on or off!
Update active objects
Camera frustum culls octree nodes
Camera frustum culls objects that are left but outside screen (OPTIONAL)
Engine fills ZBuffer early on with Front to Back sorting (OPTIONAL)
Drawing with 3 possible settings(Did Occlusion Query culling but didn’t gain much performance so switched it off for now)
[ol]
[li]Batches renderstates and material states and loops inside the effect pass and does drawcalls
[/li][li]OR Uses the order left by the ZBuffer sorting
[/li][li]OR Uses the order from the scenegraph
[/li][/ol]
Handles Transparent objects back to front (not 100% finished yet)
I’m also doing 8 lights per pass in a for loop in the shader, I find this much better than one light per pass since I hate drawcalls and so does my GPU.
The future!
I’m working on integrating Hardware instancing with Shader Model 3 (extra vertex buffer holding the matrices) and
I’m also working on the property grid of the editor. Most of the logic for the propertygrid is done and stuff such as
scripts and materials will be assigned through the Reflection namespace in the .NET framework by instantiating and
adding it as an component. The scene class is almost done and I use the XNA binary intermediate serializer to save and load it,
and it handles the rest for creating and assigning what was saved last time.
Suggestions
I’m not studying Computer Graphics, everything I’ve learned is either from books/articles or from forums where people help out.
I started out my journey as a modeller when I was very young and I’m studying 3D art right now.
This means that what I’ve done might not be the best way / optimal way of doing stuff, even though I keep reading everyday.
So I’ll gladly hear out suggestions concerning anything related to this. Can be anything from what to concider on
the rendering pipeline to the layout of the editor. I’m also really curious if the game industry is using WPF, and if they are not, why may I ask?
I find it much better/easier and faster to use than anything from MFC to Winforms.
Screenshots
In Editor:
Built: