Tuesday, 29 March 2011

Odd Lighting

I'm having a few peculiar results with the latest model I've created.  I think it is showing up a limitation with my HLSL shader code.  I changed the code a while back to improve performance but I might have inadvertently changed from per pixel to per vertex lighting.


I'm going to compare my code to a few samples.  The following are some reminder links just on the subject of HLSL lighting:

http://www.neatware.com/lbstudio/web/hlsl.html
http://brooknovak.wordpress.com/2008/11/13/hlsl-per-pixel-point-light-using-phong-blinn-lighting-model/
http://www.dhpoware.com/demos/xnaPerPixelLighting.html
http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series3/Per-pixel_lighting.php

Note: The cause was due to normals interpolating round the corners at the bottom of the model.  I was not aware that if a face shares vertices with another face that this happened.  It does explain why most of my corners look rounded.  There is a modifier in Blender called 'Edge Split' which I used to fix the models.  This information was courtesy of @SigilXNA:
http://forums.create.msdn.com/forums/p/80555/487264.aspx

Note to self: Blender's Cube Projection or project from view, for UV Unwrap, is much easier to texture.  Create vertex groups for each side or section of the model and use Cube Projection to unwrap that group.

Sunday, 27 March 2011

Another Crate Model

I think as it's got handles I could call it a case but I don't think that will fool anyone.  It's a square box that holds stuff. 

Here's the concept drawing:

I took a few screenshots of work in progress.

Started with a box and extruded a ridge in one corner.

Cropped to just the corner faces.

Split the faces to add handles.

Then half a catch.

Used the mirror modifier to repeat the one corner to make the whole box.

Joined it all together.

Removed unnecessary vertices.

UV Mapped the texture.

Used GIMP to create the texture and kept replacing the one used in Blender.

Added more details. 
Nearly finished model.

This will be used as an Ammo case for picking up reloads within the game.  It took me all day Sunday to get this far and still needs a little bit more work where the textures have been stretched unevenly.

Thursday, 24 March 2011

A Tiny Bit Of Progress

I have completed my first model for my first level.  OK, it's not the most interesting creation but I am excited about it.  It's a packing crate.


What's exciting for me is that it proves I can create and texture my own 3D models.  Up until now I was assuming that because I could edit other peoples models I would be able to create my own.  Now I know I can at least create simple shapes which will be more than enough for the buildings and objects I am likely to create myself.

It took me two evenings using Blender.  At the moment I have only been using Blender every few months so I have to look up the commands each time as a refresher but once I start using it on a daily basis I am sure I will get faster.

All the textures came from the excellent http://www.cgtextures.com/ site.

I should be able to crack on and get a level done with the main aim of creating a demo video.

Lets hope I don't get too distracted.  I'm already fighting myself to wait before I start on Ambient Occlusion and to stop looking at BEPUPhysics.  http://bepu-games.com/BEPUphysics/

Tuesday, 15 March 2011

The Level Editor Continues

Every time I try to create a level I find a few new features that I need to add to the editor.  I then have to temporarily stop work on the level to implement them!




This weekend I added a way to line up one object in the scene with any other.  I have also just added a set of 3D axes in the corner of the screen so that I can tell which way any structure is facing.


Now I need to change the keyboard input to make it more obvious which way the structures will move.  At the moment I use the first person controls to move the objects about the scene but this is confusing when applied to an object in front of you.

Wednesday, 9 March 2011

New Ideas... Again

Part of the reason my game takes so long is that I keep having to change it.  Often because performance forces me to find a better way but sometimes just because I had a better idea.

I am changing my rendering loop because now that I have chunks of terrain instead of one big terrain I can use that to store other information as a way to cull which models are in view quicker than my current method.

It's not a big change to add a list of structures in each chunk but it's still a few hours work.  The advantage will be that the terrain will be more scalable.

I also have some ideas for more accurate collision but I am forcing myself to ignore those until I have some finished models in a nice scene to show off what I have done so far!

Saturday, 5 March 2011

Model Prep Application

I've finished moving the code I use to create the bounding spheres for all my structures.  I now use a separate programme instead of trying to include it in with my map editor.  It's much easier to move round a model and adjust the spheres.

Keyboard and mouse control and proper windows menus.

The programme also includes all of my TakeExtractor code so I can save the animations from the same programme.

I've released this as open source available from:
http://code.google.com/p/3d-model-prep/