Per pixel lighting

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
roelor
Posts: 240
Joined: Wed Aug 13, 2008 8:06 am

Per pixel lighting

Post by roelor »

How can I use per pixel lighting without using parralax or bump on a mesh? (so only per pixel lighting).
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post by slavik262 »

The easiest way to do it would be to use the parralax shader with a flat normal map.

The better and faster (performance-wise) way to do it would be to write a shader in HLSL or GLSL. Tutorial 10 won't teach you how to write shaders, but it does show you how to hook them up to Irrlicht.
roelor
Posts: 240
Joined: Wed Aug 13, 2008 8:06 am

Post by roelor »

Hmm thanks, I found this: http://wiki.truevision3d.com/hlsl_phong_sample
Don't know if its useful for Irrlicht, but hey. It's a start.
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Post by ent1ty »

If you want, i can post my GLSL per pixel lighting shader. Diffuse lighting, up to 8 lights and supports both point and spot lights

Some Screens
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post by slavik262 »

roelor wrote:Hmm thanks, I found this: http://wiki.truevision3d.com/hlsl_phong_sample
Don't know if its useful for Irrlicht, but hey. It's a start.
This looks like a pretty cool tutorial to at least show you the basics. Just know that with Irrlicht, you don't need to mess with techniques or passes. You specify the shader models in your call to IGPUProgrammingServices:addHighLevelShaderMaterial.

Also know that the tutorial has you writing some extra code to show you how Phong shading works. There's a built-in HLSL function called lit that does a lot of the work for you. See http://msdn.microsoft.com/en-us/library ... S.85).aspx (highlight it and copy it into your URL bar, the Irrlicht forum doesn't hyperlink the whole thing when it hits parens for some reason).
Post Reply