Samples updated

New ones

  • Blur sample (shows how to do a cool post effect, blur)
  • Masking sample (shows how to mask a part of the picture, example, from a quad to make a circle)
  • Normal Mapping sample (shows how to do normal mapping)
And some screens

http://img295.imageshack.us/img295/2596/blurrv8.png

Free Image Hosting at www.ImageShack.us

Free Image Hosting at www.ImageShack.us

I'll go now and try to do soft shadows :) Later

Shadow maps

Till now I thought that doing shadows is very hard... Well, I was very wrong, because, see it yourself.

Free Image Hosting at www.ImageShack.us

And don't get frustrated by the FPS, it's my computer :(
Well, till now I've done some samples for my N3DEngine and here's a list:
  • Label
  • Particles
  • Terrain
  • Water
  • Shadows
  • Destroy the targets
More are coming, about one every day :)

http://rapidshare.com/files/39521297/DestroyTheTargets.zip.html

Free Image Hosting at www.ImageShack.us

It's a little 3D mini-game where you are supposed to shoot those falling targets. Nothing special, but looks cool, because it's my first 3D game with particles :P

Free Image Hosting at www.ImageShack.us

And it isn't this. Even though, it has to do something with these pieces going into various directions. What's coming?? A suprise! No, really, I will tell you. It's a demo, a mini-game which will demonstrate the particle engine in action... Be patient :)

Me again

Free Image Hosting at www.ImageShack.us

A sample with the NGUILabel class in which you can see different states. The first label is only a label, not clickable and not blinking. The second is clickable and not blinking, third is not clickable and blinking, the fourth is disabled, and the last one is clickable and blinking. But that's not the reason why I'm posting this. Behold!

The particle system! I did it! Well, what's a game without particles?? Probably, nothing, because you'll always see particles somewhere, hell, even games like breakout have particles, and I didn't :(
But, a little experimenting with point sprites didn't hurt.

Free Image Hosting at www.ImageShack.us

That's a fire effect and most commonly used in games. But, I wanted to do something that is rare. This particle system can be used for various effects, like this:

Free Image Hosting at www.ImageShack.us

A little blood effect, which I will need in the PacKiller game, and also I'll do some particles for smoke (when you shoot, coming from the gun), wall parts flying around etc...
I also have to say that the particle system is very flexible, you can change parameters and make something unique very easy :)
Damn, I'll have to upload some smiley's.... :D

NGUILabel class

Link

So, what is this about? When you make a game, you will have a menu. You'll have text labels all over the place, then in-game labels etc... So I've created this class to suit my needs, of course, you will have to edit it a little. The class will render text that you want, and also can act like a button (but it doesn't have to). It can be enabled, disabled, supports mouse over color change, blinking, scaling, changing opacity etc... You'll see that all from the class :)

Did you know?

That I had problems with drawing models?? Apparently, when the model is exported and processed in the content pipeline, all of it's meshes are positioned on 0, 0, 0 (X, Y, Z). So, if your model had a box at 1, 2, 4, when you draw it, it would draw at 0, 0, 0. So, what's the deal?? Suddenly, I discovered that they can be positioned the way you like, but you have to do something. There is an array of matrices, that will help you to do this. So, let's begin:

private Matrix[] transforms;

You will use that matrix, to alter the world matrix, and set it to the shader. Now, we need to fill it and resize it.

transforms = new Matrix[model.Bones.Count];
model.CopyAbsoluteBoneTransformsTo(transforms);

and when rendering your mesh parts, always set the new world matrix which is equal to the main world matrix multiplied with the transform. Here's a sample:

below, or see this (link)

foreach (ModelMesh modelMesh in model.Meshes)
{
effect.Parameters["World"].SetValue(transforms[modelMesh.ParentBone.Index] * Matrix.Identity);

effect.Begin();
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Begin();
foreach (ModelMeshPart meshPart in modelMesh.Parts)
{
device.VertexDeclaration = meshPart.VertexDeclaration;
device.Vertices[0].SetSource(modelMesh.VertexBuffer,
meshPart.StreamOffset, meshPart.VertexStride);

device.Textures[0] = meshMaterials[i].Texture;

device.DrawIndexedPrimitives(PrimitiveType.TriangleList,
meshPart.BaseVertex, 0, meshPart.NumVertices,
meshPart.StartIndex, meshPart.PrimitiveCount);
}
pass.Begin();
}
effect.End();
}

Note that I multiplied the transform with Matrix.Identity, you should swap that with your object matrix...
btw, you won't get another collision detection tutorial :( It's because you should do a million things besides it, and I'm too booooored to write about them :(
Sorry again

Well, now that we have this spring break, I can spend more time working with my engine and doing some cool tutorials for this blog. Yuppie! :)

Too cool!

Free Image Hosting at www.ImageShack.us

Nice, isn't it?? Visit Randomchaos 3DEngine blog. Thanks to Charles Humphrey for his code!

Warning: I have not tested any of this code. I've done it in my engine, but on another way so it's compatible with it. If you find any bugs, or you want to add something, say it! Thanks! Now, read up...
And also, these tutorials assume you have some knowledge in C#, and you know how to work with arrays and lists...

What is collision detection??? Well, without it, a model could pass through another model, bullets wouldn't collide with walls, enemies etc... It's very hard to do vertex perfect collisions, so, models are presented with boxes or spheres. XNA has BoundingBox and BoundingSphere classes, which we'll use to detect collision between different objects. So, here we go.
Create a new class called BoundingGroup. That class will do anything for us, it will first create the main bounding box, and then for each mesh in meshes, it will create a bounding box just for that mesh. First some variables:

private BoundingBox boundingBox = new BoundingBox();
private List boundingBoxes = new List();
private Matrix[] Transforms;

These variables will hold our main bounding box, and a list of our small bounding boxes and the transforms. Now make a method called CalculateBoxes(Model model) which looks like this:

http://paste.lisp.org/display/43066

That's all you need to do to get the bounding boxes, but, that's not all. You also need a field, to get the bounding boxes, and while getting them, you need to transform them to the current object position. So, for that, we'll use a method, and not a field.

http://paste.lisp.org/display/43066#1

And you should add a empty constructor BoundingGroup() just in case...
Now, to learn to use it. When you load the graphics content, and when you load your model, make a new bounding group, and then call CalculateBoxes method passing the model you just loaded.
When you check for collisions, check the main bounding boxes first, and if there is collision, check everything else. To check for collisions, use the BoundingBox.Intersects method.

In the next tutorials, you'll see how to get bounding spheres from the models you want...

And of course, do not stop with this. You see that you need to pass the objects position, rotation and scaling everytime you want to get the boxes. Try to edit the class so you will bind it to a object, and then you won't need to pass the values, just read them from the object (that's what I did).

New Template

How do you like it?? :) Better than it was
I'm preparing a little tutorial on collision detection, so, stay tuned...

I'm Back!

It's been a long time since my last post... I've been busy, went on some competitions from B.O.E. (Basics Of Electrotechnics) and, I'm first in my country (lool :)). Now I can get back to my projects!
Long time has passed since my last post, so you probably need to know some things. The Speeder 2 project has been paused(not stopped!) because I need 3D models. But that's not the only reason. I've changed my engine structure, rewritten the whole engine from scratch. Now it's even more powerfull. Some things were kicked from the engine, like Nuclex Fonts, because XNA Refresh 1.0 has font support.
Because I needed models, I've started a little project called PacKiller where I can make everything I need, so I don't depend on anyone :)
Screen
It's a FPS where you will have to save the world from pacman angels, except, they aren't angels anymore... They've switched sides :)

Later...

NInput class

Here's the NInput class, in which you can see how to process input. This class is different from The Hazy Mind class in some things like you can read the scroll wheel value etc... Suite it to your needs :)

http://paste.lisp.org/display/40867

The way you use the class: first, create a new object:

NInput input = new NInput();
input.Initialize();

and everytime the frame is updated call

input.Updat(gameTime);

To check for keys:

input.Keys.Contains(Keys.A);

for mouse buttons

input.MouseButtons[0] - left mouse button
input.MouseButtons[1] - middle mouse button
input.MouseButtons[2] - right mouse button

e.g. if (input.MouseButtons[0] == ButtonState.Pressed)

:)

Also, I forgot to mention, set the ViewportCenterX and ViewportCenterY to WindowWidth / 2 and WindowHeight / 2

Well, here's a link to the class

http://paste.lisp.org/display/40830

I will not post the GUI Manager class because I need to modify it a little... Be patient :) So, how to use the class without the GUI Manager. Firstly you need to create it, something like this:

NGUIButtonSimple button = new NGUIButtonSimple(someArgs)

someArgs are arguments you are passing to the function, there are lots of them and they're all explained in the class. Also, you need to modify the class to use the texture you want, but you'll handle it :) If you have any questions, post a comment and it's done! Now, let's go on.

Here's also the NIGUIControl interface

http://paste.lisp.org/display/40832

The next step is whenever your engine is updated, you call the UpdateMouse class. I will also put up my input class later, but for now you will need to change that method.

And everytime you draw, call the RenderControl method, you also need to give it a active sprite batch.
If you change resolution, and want to update the control so it changes its width and height, call the SetResolutionFactor method. The resolution factor is a Vector2, and you can calculate a resolution factor like this:

http://paste.lisp.org/display/40832#1

Well, think that's it :)

Hello again

Here are some screenshots and info about our new game.

Our engine supports skin based animation, thanks to XNA Creators site who posted a sample.
Free Image Hosting at www.ImageShack.us
The engine also supports creation of bounding boxes from model's vertices data.
Image Hosted by ImageShack.us
Fonts support - Nuclex Fonts (visit Nuclex site)
Image Hosted by ImageShack.us

Our engine supports many things, like this one. Suppose you load a model which is contained of few objects named "Box", "Circle", "Head" etc... Every object can have it's own texture and it's own shader, and you can easily change shader parameters e.g. the box is using the same shader as circle, but you want it to be less reflective or change any other parameter, which is done easily.
Now, I'm gonna tell you about a project we're working on. It's called Speeder 2
Free Image Hosting at www.ImageShack.us

That's the menu, but the car is downloaded from the net and has some problems. That car will not be in the game, it's just a placeholder!
The menu is done so that it will work on any resolution! I'll post the source code of the NGUISimpleButton class soon :)
Also, we've been working on some parts of the GUI like the message box. It can be created with a single line of code, then add it to the screen manager and voila! Also works on every resolution.
Free Image Hosting at www.ImageShack.us

Just a test

Hello people, and welcome to this blog. Here, you will find many interesting things and I hope, learn something :)
N3DEngine means Nuclear 3D Engine, and it's a 3D engine in development, which for a base has The Hazy Mind engine (visit The Hazy Mind website). Soon, some screenshots are coming :)


 

Copyright 2006| Blogger Templates by GeckoandFly modified and converted to Blogger Beta by Blogcrowds.
No part of the content or the blog may be reproduced without prior written permission.