This topic is now archived and is closed to further replies.


Lighting techniques DX9?

Recommended Posts

Which are the nicer techniques used for getting a decent lighting setup in DirectX9 and current hardware? Apart from per-pixel lighting,because iv''e heard that this technique would be incredibly difficult to get working in my project. Are there any (general) ways to get better and nicer lighting effects for indoor enviroments? What are the pro''s and con''s of each of these techniques? e.g implementation difficulty,kind of results expected etc. Any advice or info about a particular technique would be good. Cheers!

Share this post

Link to post
Share on other sites
Lightmapping is one way to do it. Basically you calculate all the lighing on static geometry before hand using something like radiosity (which makes nice lighting but can't really be done in real time). You then use multitexturing to modulate your base textures with your lightmaps (this means multiply the texture colour by your lightmap colour). Writing the program to generate the lightmaps may be hard, but you can get hold of ones off the net to do it. As for actually implementing it's pretty easy, you've just got to use multitexturing to put a lightmap on all your surfaces. Of course since lightmapping is all precalulated you can't use it for ligthing anything dynamic e.g. models.

[edit]Do you know why perpixel lighting would be so hard to use in your project? I've never really looked at DX but in OpenGL if you've got pixel shaders (and if you're targetting the full DX9 feature set you do) it's not really that hard and if you can use shaders you can do all kinds of nice lighting.

[edited by - Monder on April 20, 2004 5:43:20 PM]

Share this post

Link to post
Share on other sites
To be honest,i''m not sure how difficult(or if it is very difficult)to implement per-pixel lighting using shader''s and DX9.
I just heard from a couple of friends that had tried to implement
it into their projects previously,that it was too difficult for them.

I suppose it might depend on the API your using,i don''t know.
I''m also not sure whether they tried it in OpenGL,HLSL,ASM,
or what? i''m pretty new to using vertex + pixel shader''s.
Still learning the basics of how to write and use them.
I bought the ShaderX2 introduction book a while ago,but have kept putting off reading it,because the first few pages kind of lost me a bit(mathematics wise),when i first read it

Iv''e got quite a few books here,that are good for math''s,but none that will actually start you off with some basic mathematics first,i.e they all assume that you were fairly advanced in maths at school.
Which i wasn''t

For example,reading through the maths refesher course in one of my books for vectors,matrices,quanterions etc,i understand most of what he''s trying to get across(meaning i have a good understanding of 2D and 3D coorinate systems,Left-handed/right handed,+x -x,+y -y,+z -z,for representing points(locations) in 3D space,origin of the coord systems(the middle or start point)magnitude(or length)from the origin to the point,and what vectors actually are(sets of numbers) etc,But what''s really annoying is in all of the books i own(even a supposedly introduction to DX9),the writer assumes you know all about
the notation(you know,the v|| (don''t know the keys to write it) and symbols used in what he is explaining,to get a grip on any of it.

I was a bit of a rebel at school,and its only now,that iv''e quitened down,and actually want to start learning and educating myself.
When everyone else was in maths class,i was playing truent or smoking with some girl behind the bike shed''s! Lol silly i know,but its only when you get older you realize what a waste it was
Anyway,i''m rambling! yes, i think the points my friend were making was that with my 3D mathematics being the way it is,it would be difficult for me.

This doesn''t mean i''m thick! Lol or couldn''t understand all the 3D math concepts,i just never learnt any of those(roman looking?)symbols or have anyone explain their meanings to me.

I also can''t find(or know what it is i should be looking for)to learn about them.

Lightmapping sounds good,any good tutorials that you know of?

Share this post

Link to post
Share on other sites
The standard lighting in DirectX is quite powerful. Just remeber to carfully dress your ''film set'' carefully to get nice looking lighting... keep ambient light low.

I use vertex shaders at the moment. The lighting therefore sets the colour of each vertex based on the relative position of the light and the way the vertex normal is pointing. The maths isn''t too complicated (I didn''t do it as school either...) I could add a few more fancy lighting techniques but to date I''ve only used point lights, fading point lights and directional lights (simple). For nice specular though, a light map that maybe uses a pixel shader would probably be the best option.

Cornutopia Games
Sound Effects For Game Developers

Share this post

Link to post
Share on other sites