Jump to content
Sign in to follow this  
chris330

HLSL (Pixel Shaders) Should I just walk away?

Recommended Posts

Hi,

I'm in the process of actually making a game. It has finally happened after many years of waffling and talking stuff that sounded good.

I've pretty much got to the end of my DirectX learning curve for now I can do most things I would want. I can load an animated mesh with the Hierachy function and allocation class, load textures, load models, select objects on screen, make a game display make lights all that stuff.

I'm also ok with physics and stuff now having spent alot of time thinking and reading about it and I'm also into collision detection. Pretty familiar with the game loop and hierachy layout and how all this happens after being called from within a windows function. Great.

But. The last area of my DirectX learning has wandered me into pixel shading. The correct term I believe is HLSL - High Level Shader Language. Seems now it allows one to address the graphics card processor directly to produce nice effects. Ok fine. It also however means extra compiling to be done and I'm worried about this might be happening at run time as it's quite an abstracted language above even C++. Ok but modern processors should be able to handle this right?

The further thing I'm worried about is compatibility. I do have the money to get another graphics card if I want but I intentionally have run all my directX stuff so far without a graphics card using the processor to do all that emulating stuff.

I wouldn't have been worried but the first time I tried to compile and run the C++ source file with the effect file (the effect file is a .fx file which holds the shader language) the machine went blank, nothing showed and windows complained of a problem and had to close the application (program). No doubt because of a bad communication between the shader language and on board card simulator being run by my processor. I thought however shader language was supposed to hold a technique function. The shader file I have does have one yet for some reason it could not properly source an acceptable technique for my on board card emulator and crashed the program.

So with that said here's the deal:

The game I'm writing is based on out and out gameplay. Having played WWIIOnline I've seen just how much market there still is for very basic graphics (by today's standards) provided they're backed up by amazing gameplay - which World War II Online (also termed BattleGround Europe produced by Cornered Rat Software) definitely has. So I'm wondering do I *really* need to use HLSL and pixel shaders? The DirectX effects I've seen so far looked very good to me and quite capable of rendering an acceptable game world that's lit very nicely and accurately. They also give access to all required texture filtering such as Anisotropic and all that stuff.

I do not want to write a game which irritates users at the sharp end by refusing to run due to compatibility problems. I've also noticed that with DirectX I can access pixel level I believe so I could even code my own basic stuff into that for things like blur effects or haze effects usng some sort of circle around which a mean average of pixel values was took, and this average was then redistributed back to the pixels - creating a blur. I really don't need my models to look like they're covered in crude oil during a gorgeous sunrise.

So to summarise my two camps of thought:

1) Leave pixel shaders alone.

Pros

- Big bonus in compatibility and speed.

- Can do everything I'd want to anyway.

- Avoid what looks like a giant non-standardisation based mess in the industry.

Cons

- Can't have easy to use special effects.

- I'd have to make any effects I wanted myself.

- Game doesn't look as pretty especially around water and stuff.

2) Use pixel shaders.

Pros

- It's reasonable to expect a gamer to have a low level card.

- Easy to use effects.

- Extra nice looking game for not much effort.

Cons

- Get drawn into compatibility mess caused by multi manufacturers. Maybe some cards (no matter how expensive) may not work at all if they don't support a specific shader no matter how powerful.

- Risk irritating customer base and forcing them to spend money (which is something I don't believe in doing when you're supposed to be providing a paid for service to someone).

So there it is. I'm not sure what to do. I have LOTS of sympathy with people on a budget or having to use their friends/parents/aunties machine. I do not want them to be excluded. At all. I'd prefer a less nice looking game with more time spent on improving gameplay rather than just drafting in 3rd party made shader files to make the game look good so it sold and then dumping the responsibility of that onto the customer by making them having to pay yet more money to get it to run (which is something I'm sure is rife in the industry at present). :rolleyes:

So please can someone help me out here? I just want the best compromise between nice effects and compatibility, but very much leaning towards compatibility.

Thanks ;)

Edited by chris330

Share this post


Link to post
Share on other sites

Maybe a few visual aids would be nice so people can actually see what you have been making. Sounds very interesting though, hats off to you for involving yourself in such a large task!

Share this post


Link to post
Share on other sites

Hi thanks for the reply. There's not that much to show yet to be honest. I'm devoting much more time to learning than making anything. I could if I wanted to start making all sorts of things but I'd rather not until I've covered all the theory and code I'll need to get started properly.

Most of it has just been developing things beyond the tutorials. I could post a few things up but they'd look mundane, whereas in actual fact what's going on behind it is quite deep and that's the bit I've been learning to understand which I now mainly do. Took alot of time but anyway I'm not that far off being able to start in earnest on generating terrain and things like that.

Pixel shaders are a new thing to me though. I found out my on-board emulator does have support for pixel shading up to level 2.0. However the damn things still refuse to run even when just rendering the good old Teapot mesh. Seems shaders above a certain level crash the program whilst those those beneath it will actually run without crashing but the light effects don't render. I just see a black screen or whatever colour I cleared the back buffer to.

I'm very much hoping I don't *have* to use pixel shaders to get shadows! Or perhaps I will yet figure them out and find out they're not so bad. I have my reservations though.

Share this post


Link to post
Share on other sites

I'm not sure - I'll head over. Normally if I have an question I always come here first. Always. The expertise on here is amazing and the attitude of posters very good. Not always the same elsehwere sadly. I'll go over there and re-post it.

---------- Post added at 12:29 PM ---------- Previous post was at 11:35 AM ----------

Ok thanks pal I posted it over there. Be interesting to see what replies come. I did get a shader to run in the end. Looks very nice. Still got a long way to go before I understand them properly though.

To be honest I'm surprised more people who make addons for the Operation Flashpoint family of games don't get into this. I've made some addons in 2003, and it was very difficult. I never got anywhere near the levels of complexity some people reached in later years either.

On balance to be entirely truthful, although it sounds complex I'd say it's probably not been any harder so far doing this than making a complete working addon in OFP. Sure I could bask in the limelight of all these new concepts and terms I've learned but to be honest it really isn't that bad.

Here's the link to the site I got started with. The first 10 lessons are free then it's only a one time £20 fee for access to all the others.

http://www.directxtutorial.com/index.aspx

Thanks again;)

Edited by chris330

Share this post


Link to post
Share on other sites

In my opinion it depends on your target audience.

If you are looking for the hard core FPS crowd then you should do it. If you are after the laptop crowd you should not bother.

If you were an absolute genius of course you might make a scaleable one that could do either as required.

Share this post


Link to post
Share on other sites

Depending on your aims, if you intend on creating a complex game and completing it in your lifetime, I would suggest from personal experience that you explore using third party libraries, such as OGRE.

Share this post


Link to post
Share on other sites

My recommendation would be to start getting more people to help you with your project. Fact is, in real life game development (an actual game, not just a small demo) is way to complex to do it alone - in good quality and taking advantage of all current technological possibilities. Lots of different technologies to master, Art requirements,... if you plan to finish anything sensible while keeping up with technology you have to specialize and divide the workload.

Share this post


Link to post
Share on other sites

Thanks for the replies you three chaps/chapesses ;) Sure deal I'm trying to find help as this is actually going somewhere now. But not having much luck. Did have a great artist over the Christmas period who was really keen and has worked in the industry. Sadly he went back to drink and got beaten almost to death somewhere locally. I think he's now brain damaged for life :(

I'm also off work due to mental illness so got lots of time to work out my 'area' if you know what I mean. But I'll need someone else to help in the others sooner or later.

@Dadl

I bought a cheaper book on Algorithms than the one you recommended me in the thread I started sometime back just to get me started. But I've favourited the one you did recommend and I'll buy it as soon as more money comes through from social security.

Thanks!

Share this post


Link to post
Share on other sites

Hi just to let you know thansk for the help I have now got a very good reflective (specular light) shader file to run and understood it top to bottom too. Even had to fix a major error in the online tutorial's shader file that wasn't returning proper data from the function that displays stuff onscreen.

Pretty much nailed now to be honest. If I need any more depth into shader files I'll be ok myself from here on in. Thanks again, this forum always feels like *home* in some weird way ;)

Share this post


Link to post
Share on other sites
Maybe a few visual aids would be nice so people can actually see what you have been making. Sounds very interesting though, hats off to you for involving yourself in such a large task!

Ok I go it in the end :) Here's a link to a short video on youtube showing a landscape scene with a vertex shader going around it to mimc sunlight or moonlight but speeded up alot.

This should be ok I managed to run this on the on-board card which is the Intel G33/G31 I think. Was clocking about 30-40 Fps at the time even though the counter says 99 for some reason.

http://www.youtube.com/watch?v=LWBpOX2dKZA

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×