Spotlight Problem

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.
jamessss
Posts: 12
Joined: Tue Aug 11, 2009 4:37 am

Spotlight Problem

Post by jamessss »

Hi all, I'm new to Irrlicht, previously i have worked with axiom3d and some XNA engine to develop game for my school project.

Recently for a change, I started using Irrlicht and encounter a problem right away. The spot light type for Irrlicht is giving me a lot of headache because of the way it shines onto mesh texture. It doesn't shine like how axiom does its lighting which give a dynamic shadow as well, instead it shines onto the triangles of the mesh and isn't very "flash light" like. I need to do a flash light/torch light for my game like how Left 4 Dead does it.

Is there any way i can work about this? I tried the per pixel lighting tutorial and the effect doesn't work well with just diffuse texture mapping.

Another tutorial i found was to use shader but the issue with that is dynamic shadow casting when shone onto it.

Any advice?
wildrj
Posts: 301
Joined: Thu Mar 23, 2006 12:49 am
Location: Texas/ Cyberspace
Contact:

Post by wildrj »

What im using to handle lighting in my game for my flashlight is using xEffects *search forums* it seems to do the effect you want.
http://wild.deathtouchstudios.com << My gamedev blog
<Programming is a way of life>
If at first you don't succeed press the delete key till you do :)
jamessss
Posts: 12
Joined: Tue Aug 11, 2009 4:37 am

XEffect problem

Post by jamessss »

I am having some problem with XEffect loading. Most of the error is dimension2du related. Any help?
wildrj
Posts: 301
Joined: Thu Mar 23, 2006 12:49 am
Location: Texas/ Cyberspace
Contact:

Post by wildrj »

dimension2du is isn't in the current stable release you must download the svn and compile it yourself to have access to dimension2du..
http://wild.deathtouchstudios.com << My gamedev blog
<Programming is a way of life>
If at first you don't succeed press the delete key till you do :)
jamessss
Posts: 12
Joined: Tue Aug 11, 2009 4:37 am

Post by jamessss »

I've managed to get it working by changing the dimension2du to 2di, manage to compile and get the things up but it is still not working ideally, especially when trying to attach the "Torchlight" to the camera.

I am actually quite confused by XEffect frankly. So, for creating the dynamic torch light, do i use effect-> or ILightSceneNode ?

Would be nice if u can provide a snippet code. Thanks in advance.
wildrj
Posts: 301
Joined: Thu Mar 23, 2006 12:49 am
Location: Texas/ Cyberspace
Contact:

Post by wildrj »

you create the light like you normally would. xEffects just handles all the "lighting" and shadow effects. *Shadow effects require shadow lights* 8)
http://wild.deathtouchstudios.com << My gamedev blog
<Programming is a way of life>
If at first you don't succeed press the delete key till you do :)
jamessss
Posts: 12
Joined: Tue Aug 11, 2009 4:37 am

Post by jamessss »

hmmm, so, if let say i am inside a room, i would create the light as usual and attach it to the camera. As for casting of shadow by tables or candle stand, i add shadow effect to them? I am kind of confused by how XEffect works.
wildrj
Posts: 301
Joined: Thu Mar 23, 2006 12:49 am
Location: Texas/ Cyberspace
Contact:

Post by wildrj »

XEffects from what i understand is pre rendered effects lights shadows all happen before its actually rendered. You must set a node to a "Shadow Node" in order for it to cast and receive shadows then you must create a shadow light to shine these shadows. Get what i mean? so anywhere you have a light you would create a shadow light there to same rotation etc.
Examples explain better then me
http://wild.deathtouchstudios.com << My gamedev blog
<Programming is a way of life>
If at first you don't succeed press the delete key till you do :)
jamessss
Posts: 12
Joined: Tue Aug 11, 2009 4:37 am

Post by jamessss »

wildrj wrote:XEffects from what i understand is pre rendered effects lights shadows all happen before its actually rendered. You must set a node to a "Shadow Node" in order for it to cast and receive shadows then you must create a shadow light to shine these shadows. Get what i mean? so anywhere you have a light you would create a shadow light there to same rotation etc.
Examples explain better then me
If my understanding is correct, would that mean using XEffect for my FPS game would be out of the question? I am trying to recreate something like Left 4 Dead flashlight.
wildrj
Posts: 301
Joined: Thu Mar 23, 2006 12:49 am
Location: Texas/ Cyberspace
Contact:

Post by wildrj »

No its perfect for your fps game its how i use it right now.. You make the two lights "shadow light" and "spotlight" children of your "player" node :) you dont even need the shadowlight its for added effect.
http://wild.deathtouchstudios.com << My gamedev blog
<Programming is a way of life>
If at first you don't succeed press the delete key till you do :)
jamessss
Posts: 12
Joined: Tue Aug 11, 2009 4:37 am

Post by jamessss »

I see.. Hmm, I've managed to get something up but the spot light seem to be covering the whole of my scene and its totally white. Not sure if its my radius or outercone.
wildrj
Posts: 301
Joined: Thu Mar 23, 2006 12:49 am
Location: Texas/ Cyberspace
Contact:

Post by wildrj »

Also check your scale. easily checkable just by looking at your position. if its like 0.013241234 << thats x.. time to scale up.
http://wild.deathtouchstudios.com << My gamedev blog
<Programming is a way of life>
If at first you don't succeed press the delete key till you do :)
jamessss
Posts: 12
Joined: Tue Aug 11, 2009 4:37 am

Post by jamessss »

upon closer inspection, i disable the fog, immediately the bright light is gone. This XEffect code is really killing me... Geez.
wildrj
Posts: 301
Joined: Thu Mar 23, 2006 12:49 am
Location: Texas/ Cyberspace
Contact:

Post by wildrj »

OOO disable all the post processing effects. you probably have bloom on. A.k.a comment out all the "addPostProcessingEffectFromFile lines"
Example:

Code: Select all

addPostProcessingEffectFromFile(irr::core::stringc("Media/Shaders/BlurHP.glsl"));
http://wild.deathtouchstudios.com << My gamedev blog
<Programming is a way of life>
If at first you don't succeed press the delete key till you do :)
jamessss
Posts: 12
Joined: Tue Aug 11, 2009 4:37 am

Post by jamessss »

Well, managed to disable that but now i am back to square one which is that the spot light would be shining the triangle mesh of my room and not as a circle. Any idea how i can fix that?
Post Reply