Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    135
  • comments
    130
  • views
    52776

About this blog

This journal may contain languages not suitable for minors and some occasional swearing.

Entries in this blog

 

The universe tends to unfold as it should...

I don't remember where that quote comes from (some movie), but it stuck in my mind and for some reason my subconscious is always reminding it to me, especially when things aren't going all that great. Things do seem to be slowly turning around and getting a bit better, we'll see how everything 'unfolds'.

I got the new architecture for SGE working, at least the barebones of the scene graph implementation. It's not at the same point where my previous architecture was yet. I've been porting over different components and man am I proud of the work I did in making each component self sufficient, porting has been extremely easy.

Oh, I also ported the project to VS.Net 2005, and was pleasantly surprised at what MS did in deprecating some old C functions and replacing them with safer versions, I'm not sure if this is an MS thing only, or a C standards change, so I'm not sure what the cross-platform implications are, however, everything is nicely enabled/disabled with a #define, so it's not a big deal, in fact, I put the define in an #if _MSC_VER >= 1400 block, so those defines only get used in VS.Net 2005.

VS.Net 2005 is nice, I haven't used it all that much to find a lot of things. However, I was a little disappointed that some rather small, yet very useful things didn't make it. Particualily, things that VisualAssist gives you. For example, something I use a lot in VA is the ability to open the corresponding .cpp for a given .h or viceversa, I was hoping they would make that part of the VS.net IDE (if it's there and I just haven't seen it, please let me know). IMO VA also provides much nicer syntax highlighting, and although VS.net did improve their syntax highlighting, it's still not as complete as VA.

That is all for now, I need to get back to work on SGE..

VisualLR

VisualLR

 

Cloak shader

So, I offered I would write a little about the cloak shader I implemented, so here it is.

The vertex shader is really straightforward


struct a2v
{
float4 position: POSITION;
float3 normal: NORMAL;
float2 texcoord0: TEXCOORD0;
};

struct v2f
{
float4 position : POSITION0;
float3 normal : TEXCOORD0;
float3 view_vec : TEXCOORD1;
};

v2f main(a2v i){
v2f o;

o.position = mul( i.position, world_view_proj );
o.normal = mul( i.normal, model_to_world );
o.view_vec = camera_pos - i.position;
return o;
}


The only thing worth mentioning is that it is sending the view vector in TEXCOORD1 to the pixel shader, this will be used to calculate the reflection vector as well as lookup into a texture that gives the object the "oily" or "soapy" look to it. The pixel shader is where the fun stuff happens, the shader requires two textures, the first is a 1D texture that gives the object the "oily" feel described before. The next texture is the cube map that will be used for the object's reflection.


sampler Rainbow: register(s0);
sampler Environment: register(s1);

float rainbowiness: register(c0); // 0.0 - 1.0 ( 0.5 looks good )

float4 main(float3 normal: TEXCOORD0, float3 viewVec: TEXCOORD1) : COLOR
{
normal = normalize(normal);

float v = dot(normalize(viewVec), normal);

// lookup into the 1D rainbow texture
float3 rainbow = tex1D(Rainbow, v);

// Calculate the reflection vector, then lookup into cubemap
float3 reflVec = reflect(-viewVec, normal);
float3 refl = texCUBE(Environment, reflVec);

// interpolate reflection color to rainbow color
float3 color = lerp(refl, rainbow, rainbowiness * v);

// return the interpolated color and use 1-v as transparency
return float4(color, 1 - v);
}


The line:

float v = dot(normalize(viewVec), normal);

The first use for the dot product between the view vector and the normal is to lookup into the 1D "rainbow" texture, what this will give us, is a smooth sampling of the texture. The texture will be sampled from left to right, the leftmost color will be used for the places where the normal is least aligned to the view vector at, and gradually up to the rightmost color at the places in which the view and the normal are most aligned. Here's a screenshot of the effect only looking into the rainbow texture:




Click for full size



The next two lines are very straightforward

// Find the reflection
float3 reflVec = reflect(-viewVec, normal);
float3 refl = texCUBE(Environment, reflVec);

All they do is calculate the reflection vector and use it to lookup the appropiate texel in the cube map.

The next use for the dot product is to calculate the transparency of the object, it works in the same way, the object will be fully opaque when the normal is least aligned to the view vector and will gradually become transparent as the view vector and normal become aligned. You can see this in the last line of the shader:

return float4(color, 1 - v);

Here's a screenshot where I hardcoded the ship's color to green just so you can see how the alpha looks:




Click for full size


Here's the rainbow texture I used:




Right click here then Save as...

The pixel shader needs to be compiled in PS2.0 because of the dependent texture read where we lookup the rainbow texture.

VisualLR

VisualLR

 

New shader, new architecture

Ok, so I mentioned a couple posts back that I had worked on some shaders, truth is, I only finished one of them, the other one is in progress, but it was put on hold.

After much struggling with my current rendering architecture, I decided it was time to bite the bullet and refactor it. The new architecture is somewhat similar to what is more commonly used, somewhat like OGRE in that you can create projects and derive the application class from a set of base classes. This will allow me to prototype different things without having to pollute the main namespace with test code.

I'm also refactoring the renderer to something similar to the one in this book:

3D Game Engine Architecture, First Edition

So far it's going good, anyway, here's the screenshot of my high resolution fighter with a cloak type effect. It looks a little soapy right now, kindof like a bubble, in part it has to do with the cube map I'm using, but I think with some good textures, the ship would look a lot less soapy and a lot cooler.


Click here for full size

VisualLR

VisualLR

 

Ow! My eyes!

So, the new gamedev site is up, and I like it. However, now my images no longer blend nicely with the background as they used to... oh well.

Not much today, last week I wrote another small program in C# that I also plan on releasing as trialware. It may even be handy for some people here, I'll make an official release soon, just going to test it for a couple of days...

I installed VC# 2005 Express today, and so far I've liked it, I'll have to port one of my apps to see how it goes, and use some of the new goodies it comes with.

Anyway, I like the new site, but it's 3:40am and the brightness of it hurts my eyes =(

VisualLR

VisualLR

 

Shaders!

So, I decided that I would write a few new shaders for my engine just to make it look a bit more impressive, so far it's going good, yesterday I added a cool transparent glass type shader, it kind of looks like a bubble to me, I just need a better cube map that matches my sky and it'll look a lot cooler.

I'll hold off on posting screenshots until I have one or two more shaders in there, which should be today or tomorrow depending on how busy I get with other work...

VisualLR

VisualLR

 

Getting back on track...

Ok, so I mentioned that my 3D woes deserved a post of their own, so here it is. SGE uses a deferred rendering architecture. For those unfamiliar with the term, what this means is that I put everything that is to be rendered in a list, once the list is generated, I iterate through the list and render each element of said list. This works pretty good, and it's really fast and also very easy to program. Getting something to render is as easy as:


sgRenderUnit* pRenderUnit = sgRenderer::GetNewRenderUnit(sgRenderer::RU_DEFAULT);

pRenderUnit->SetMesh(pMesh);
pRenderUnit->SetMaterial(pMaterial);

pRenderUnit->SetBaseTransform(sgMatrix4::IDENTITY);


pMesh is a simple class with a vertex and index buffer, material has the textures and shaders.

Anyway, this all worked great until I reached the point where I wanted to make my particle and font systems. The reason this became a problem comes from the use of dynamic buffers.

The problem is, if a dynamic buffer gets full, I need to create a render unit, this gets added into the list. But what happens if I have more geometry that needs to use that buffer? if this was not a deferred renderer, I would simple render whatever was in the buffer, flush the buffer and start using it again. Since this IS a deferred renderer, I need the buffer to be flushed on the next frame, AFTER the list has been rendered. This caused stuff to flicker...

I have tried quite a few more things than this, with pretty bad results... unfortunately, I have not found information on deferred renderers and how they handle dynamic rendering.

So, today I started looking into the possibility of switching to a non-deferred architecture. It seems that it will be a lot of work, but if it solves this problem it would be worth it.

Comments? Suggestions?

VisualLR

VisualLR

 

Trialware development

So, as I mentioned in my previous post, I have launched my very first serious trialware application, Explore++. This project was my first ever in C#, before doing it I had only glanced at what C# code looked like.

Now, I'm not the kind of guy that gets into what language is better, C++ or Java, Java or C# and so on.. to me that's a waste of time. You find the most appropiate language to solve a problem and you use it. With that out of the way, let's continue...

I really liked a lot of things about C#, and I also disliked a couple of them, but not enough to make them worth mentioning. I liked how (relatively) straightforward it was to do almost everything, I liked making a custom control and having it appear on my controls toolbox then dragging that into my app and bam! it works. That was cool. With MFC it always felt as if I was fighting VS to get what I wanted to work, with C# most things just kind of worked like you'd expect them to.

Interoperability stuff took me a bit longer to learn, although when I figured it out I realized how not terribly difficult it is, just well, not what you're used to doing with C++.

I released Explore++ two days ago, and I'm pretty happy with the amount of downloads it has received so far, I'm sure that number will go up once it's posted on the cnet network of download sites.

Now that my first application is done, I'm planning my return into games. I'm thinking of making a simple 3D game using managed directx whenever I feel I need a break from working on SGE.

Speaking of which SGE deserves a post of its own, I'm tired of how incredibly difficult this architecture is proving to be when it comes to dynamic rendering of stuff, so I'm seriously considering ditching the deferred renderer and switching to an immediate renderer instead... but I'll post more about this later.

VisualLR

VisualLR

 

Explore++

So, I've been real quiet lately, but it's only because I've been keeping real busy. Although not directly a game development project, it's something that anyone can use.

The project is called Explore++ and what it does is allow you to have 1 file exploring app open where you can transfer files using tabs. This will get rid of the clutter from your taskbar since you will no longer need all those explorer windows open. It also has a lot more useful features that will help you manage your files more efficiently.

You can read more about it and download the trial version here:




VisualLR

VisualLR

 

Hiatus

So, I've been a bit away from posting on my journal lately, it's not because I haven't wanted to, but I actually took a brief break from working on my engine and I've been extremely busy working on a small program I plan to release as shareware and hopefully get a trickle of income from it now and then. I'm really close to finishing it, I think I'll have RC1 sometime this coming week, I'll have a few friends beta test it for me and hopefully it will be online by week's end. I'll share more about it when it's done, hopefully it might be of use to some of you guys, I know I'll be using it a lot =)

I did post some screenshots on the image of the day gallery, it's pretty cool, I always loved the concept of IOTD, I love seeing what people are doing and wondering "how the hell did they do that?" or thinking, "man, I gotta get off my ass and do something like that".

Especially when I see stuff like Ysaneya's which is just breathtaking, Harry Kalogirou's entry is also very impressive.

So anyway, as soon as I'm done with my little pet project (hopefully a little money tree), I'll get back to my engine. Next on the agenda is a particle system. Half of which is already in the engine, since I can easily add dynamic geometry with as little as 5 lines of code and all dynamic geometry that shares a material gets drawn in a single DPC. I figure the "hard" part of the particle engine will actually be the authoring side of it... I'll post more about when I begin working on it.

Anyway, I gotta get back to work... I want to finish at least one of my 4 final tasks on my list tonight.

VisualLR

VisualLR

 

No luck

So, still no luck fixing the strange flickery stuff problem.. I have no idea what it is. Not that I have been working much on it, I've been keeping myself busy with a different project, hopefully one that will provide some financial gains...

Anyway, just thought I'd do a quick post... cya.

VisualLR

VisualLR

 

Shameless bump

Ok, so my previous post was threatened by lightning, so I'll just repost it again here in hopes that it'll attract some attention. I've tried everything I can think of and haven't been able to figure this one out...

--

So, I'm getting a strange problem in my engine, at first I thought it was my code (and it could still be, but Im not sure). I have some text that was being displayed on the screen, FPS, position, etc. When using the debug drivers everything works great, but when I use the release drivers, even if I remove the code that draws the text, I get junk on the screen, flickery bits of text from what was previously being drawn.

Here's a screenshot:




Anyone seen this before? for the longest time I've thought the problem was on my dynamic rendering code (for text), but I still get the problem even after removing the code that was drawing the text in the first place.

Any ideas?

VisualLR

VisualLR

 

I need help.

So, I'm getting a strange problem in my engine, at first I thought it was my code (and it could still be, but Im not sure). I have some text that was being displayed on the screen, FPS, position, etc. When using the debug drivers everything works great, but when I use the release drivers, even if I remove the code that draws the text, I get junk on the screen, flickery bits of text from what was previously being drawn.

Here's a screenshot:



Anyone seen this before? for the longest time I've thought the problem was on my dynamic rendering code (for text), but I still get the problem even after removing the code that was drawing the text in the first place.

Any ideas?

VisualLR

VisualLR

 

GPU Particle System

A friend of mine suggested that to give my engine a "wow" factor, I should throw in a particle system, and I agree it would make a world of difference. So I'm researching particle systems that run on the GPU.

I'm wondering if anyone out there has done this type of particle system and I'd love to hear about your experience in doing it. I have of course google'd it and have read some of the pages that have turned up, such as Building a Million-Particle System.

So please, if you have worked on something like this and would like to comment on your experience I would appreciate it.

In other news, I got to do a programming test for a company in Australia tomorrow... should be fun ;)


VisualLR

VisualLR

 

All done

So, I think the tech interview went really well, I sent them some code samples and now I can only hope they like what they see. Getting this job would be quite life altering for me (in a good way) and I can't wait to hear that they will hire me.

Anyway, I leave you with a screenshot for your viewing pleasure:


VisualLR

VisualLR

 

Jittery

I just had a phone interview with the development director of a company I want to work at... I think I did OK, but sometimes I feel like I talk too damn much and that only hurts more than it helps. It doesn't help that I get nervous when I do stuff like this...

Now I got a tech interview coming up in a few minutes, and I'm still nervous from the last one...

Man, I really hope I don't screw it up, I really want to work there.

Well, next time I update this, I may have a new job in a great place... we shall see, I really hope I don't screw up.


VisualLR

VisualLR

 

New demo + source

I just uploaded a new demo and source code on Texture Management on my site (http://www.spheregames.com/articles.asp).

I'd like some feedback, so if you have time to check it out, please do and drop me an email.

I used to keep my MSN private, and I've recently realized that I should not be such a private individual, so if anyone wants to chat about making games, programming cool shit or needs help, don't be afraid to contact me, if I'm around I'll be happy to help, or just chat.

What have I been doing lately? well, I've been helping out my friends on a project they're doing, and it has required me to code a GPS receiver. I got it all working quite nicely, I can parse the data and determine my longitude, latitude, altitude, and some other bits of info, which is pretty damn cool. I was pleasantly surprised at how GPS data is formatted, it's very straightforward.

My next game is going to be GPS enabled, you'll need a GPS receiver on your computer to play it.. haha

VisualLR

VisualLR

 

I'm in Honduras!

I'm writing this post from Honduras, we drove here this morning and we'll probably head back to Guatemala tomorrow, it's only a few hours away. And next week, I'll be in sunny Cancun, Mexico. It's gonna be fun.

What am I doing in Honduras you ask? not much, hanging out with my friends, I tagged along while they run a business. I am working with them on a separate project, so we'll probably spend a few hours working on that later tonight.

It's pretty damn hot here, even though it's raining quite a bit.

Anyway, not much of a technology oriented post, but I dont have much news about that, other than my SGE website, if you haven't seen it, go check it out.

SGE

VisualLR

VisualLR

 

Sphere Games Engine!

Early this year I started working on a game engine on my spare time (yes, a game and and engine at the same time... *gasp*), however I mostly concentrated on the technology for now and have not worried much about game design, now that most of the pipelines are in place, I will start designing a game, but I will continue working on the engine all the way through.

The engine is pretty cool, it has a really fast renderer that I have yet to bog down with tons of assets, currently I only have one shader pair for normal mapped objects, so I'll need to write a few more, do some reflective stuff, some cool transparent stuff, and I need to implement a good lighting solution.

The engine uses LUA for scripting and I have a very nice implementation that makes it easy to expose functionality to script. I also use LUA for configuration files, for example, when I export models from 3D Studio Max, I have a set of material files that you can choose, these material files dictate the shader pair to use and other relevant material information.

I could go on and talk about it for a long time, so I'll just let screenshots and videos do the talking for me:

http://www.spheregames.com/sge


VisualLR

VisualLR

 

ASP'n

I'm taking a week off from work to visit family and spend time with my wife. I decided that whenever I got a few minutes to myself (since I'm not at home and don't have access to my code, or even VisualStudio) that I would work on my website.

So I've been doing a little ASP and html, but the weird thing is... I can't think of anything I'd like to add to my site, I mean the site itself is pretty good (IMO) and could only benefit from having more content.

I fixed a couple of small bugs that I had never gotten around to fixing, but they were in the "members" section of the website (which only has 1 member, me). It's really cool, a while back I wrote a nice little system that allows me to update my site from anywhere just by logging in to it.

I asked a buddy of mine, who is pretty good at doing web stuff, and he suggested I tried one of those CMS (content management systems), which basically let you create your site just by customizing some things. Sounds cool and all, but it kind of takes the magic away from it. I'm very proud that I've always made my own website by writing every line of code myself (except of course for those few copy/pasted from somewhere else).

One thing I'm a bit curious to try is using C# in a website, I'm not entirely sure what I would do with it though...

Yea, so that's about it, nothing terribly exciting, hell, I'm kind of falling asleep as I write this.

Oh yea, and it's my birthday today... I'm 26 now, only 4 years left to become a millionaire before my 30th birthday. It's on now.

VisualLR

VisualLR

 

I'm still alive

Man, I've been keeping myself extremely busy lately. I finally fixed all my model loading problems... I can't believe how I couldn't see it, it was obvious what I was doing wrong... it seems that sometimes our brain kind of locks on to what it thinks is correct and just won't let you see the problem. No amount of reasoning and thinking would convince my brain otherwise, everything just seemed right. And then suddenly, after having put model loading in the back burner for a long time I decided to revisit it and there it was, the flaw in my logic.

Part of it was that I hadn't clearely understood the way the data was stored on disk, and the format it needed to have to be displayed.

I'm quite glad that's done, now I can move on to other interesting things, such as animation =). I've done very little animation programming in the past, and I'm very excited about taking it on. I won't be doing anything groundbreaking, I'm going to stick to the simplest method I find, even if it's not very efficient and then I'll take it from there. As long as I design a good API for the system, I can iterate on it and mold it into something great.

Anyway, all this talking about doing stuff only makes me want to do it more... so off I go =)

VisualLR

VisualLR

 

DirectInput

So, does anyone know how to determine if CapsLock is enabled/disabled with DirectInput? I can detect if the key was pressed, but I need to know in what state it currently is in.

Thanks.


VisualLR

VisualLR

 

* Vanish *

So I pulled out my flash powder and *poof* vanished for a little while. (sorry, wow reference there)...

That does not mean that I have spent every waking hour playing warcraft, although I have played some, my warrior is at lvl 56 and I'm pushing to get to 60 soon (and before my bro! the fool, he will never catch up!).

Anyway, I haven't been too busy at work, which is nice, except for most of this week when I was having the most annoying, most frustrating, enfuriating problem ever. Visual Studio was closing itself on me... no error message, no crash, nothing! it would just disappear, not even using "End Process" kills programs as fast as VS was disappearing, and of course, any unsaved work would go bye bye.

So, after looking for spyware, viruses, even getting my computer swapped with another identical one, the problem persisted. I tried it on our lead's system and the same problem. And all this time I thought it was my system.. damn it...

Anyway, long story short, I uninstalled Visual Assist X and did a painful "Rebuild All" (without Incredibuild) and the problem finally went away.

I miss VisualAssist, but I'm happy that I'm not entirely lost without it, the only thing I truly miss is that thing that lets you open a file quickly by typing in the name of the file, that and the button to open a corresponding .h/.cpp file... everything else was just a cherry on top.

*sigh*

Oh yea, and for the record, DirectInput's force feedback code is crappy and poorly documented... I'm really surprised MS never released a small library of commonly used force feedback effects. Something like "bullets", "idle car", "chainsaw", etc. Instead I gotta sit here and try to mathematically come up with what I think an effect would feel like... great fun.

VisualLR

VisualLR

 

DirectX SDK

An update has been posted for the DX9 SDK for anyone interested:

DirectX SDK April 2005

They fixed some PRT stuff and added a new feature that generates UV mapping for an arbitrary mesh... seems interesting.

VisualLR

VisualLR

 

Weekend in SF

So I took this weekend off and drove up to San Francisco, took the 101 all the way (it's the scenic route). It's such a nice drive, next to be beach, all the vineyards along the way, and just nice scenery all the way.

I do wish I could afford a laptop, our hotel room had free DSL hookup, but I guess we all need to be unplugged for a while and just enjoy the outdoors and small vacations.

So yea, no programming post right now, maybe tonight if I get anything significant done, but I think today will consist of figuring out where I left off and picking it up from there.

So, anyone get a PSP? does it live up to all the hype? I probably won't get one, just like I never got a gameboy, gameboy advance or gameboy advance sp... even though I always said I would... I just don't really have time to play portable games, the only time I could actually play, is when I'm driving home, or to work, but there's one problem... I'm driving. I rather have a beefy laptop.

Ok, for a non-programming related post, this is getting too long. Cya.

VisualLR

VisualLR

 

Almost checkout time.

I'm about to head home, I'll probably post something on-topic from there... basically have been doing more of the same, I keep meaning to go back to that UV bug, but I'm having fun with the other stuff I'm doing.

Why do I get all the stupid bugs?

** EDIT **
Look at the comments of this post for some LUA stuff =)

VisualLR

VisualLR

Sign in to follow this  
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!