A Problem .... does anyone know why?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
smartwhiz
Posts: 120
Joined: Wed Jan 14, 2004 6:03 pm
Location: India

A Problem .... does anyone know why?

Post by smartwhiz »

doesn't the dynamic light in the engine give an effect of shading on the .bsp maps......
How do u implement shadowing of .bsp elements on the map.....
Serg Nechaeff
Posts: 162
Joined: Wed Nov 26, 2003 5:24 pm
Location: Europe

Post by Serg Nechaeff »

check out the techdemo code, it's right there...
http://www.javazing.com
P-III-950, WinXP, GeForce FX5600 128 MB ForceWare 52.16, DX9, Eclipse IDE, JRE 1.6
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

I cant help you with the first part of your questions but I can with the second óne.

I'm just beginning so mainly my experience has to do with loading a Quake 3 bsp into Irrlicht and adding an fps camera.

About shadows in bsps, they are calculated and lightmapped all over the textures in your bsp. In other words. The lights you place in your level editor and the shadows they cast (as well as their intensity and color values, and any sky shader that casts light) will be fixed to the bsp after compiling with your favorite editor.
check this:
Image

I'm also very interested in using Irrlicht's dynamic lights but dunno how to.

cheers.

ps. My only advice would be to pick a good level editor that compiles a proper Q3 bsp. If you are not doing anything commercial then GtkRadiant is the best, in other cases I'd recommend the Quake Army Knife, aka QUARK.

cheers
Image
Luke923
Posts: 59
Joined: Wed Nov 05, 2003 5:26 am

Post by Luke923 »

afecelis wrote: I'm also very interested in using Irrlicht's dynamic lights but dunno how to.
...

ps. My only advice would be to pick a good level editor that compiles a proper Q3 bsp. If you are not doing anything commercial then GtkRadiant is the best, in other cases I'd recommend the Quake Army Knife, aka QUARK.
Afecelis,

To call for a dynamic light, it's very simple. Below, as Dave Chappelle would say, "it's how I do..." (in a Tyrone Biggums voice):

Code: Select all

scene::ILightSceneNode*		Light;
Light = device->getSceneManager()->addLightSceneNode(0,Pos,color,Size);
The first parameter I usually set to NULL (or 0, in this instance), since I don't set a parent ISceneNode* for my lights, but, if you choose, you can change this to any ISceneNode. Pos is just a core::vector3df representing the location of the light in 3D space relative to the parent. color is a video::SColorf to set the color of the light. Finally, Size is just an f32 that specifies the lighting radius. There's also an id parameter that can be set, but I tend to set this to default (-1) by not calling it.

BTW, I believe QuArK relies on GTKRadiant to compile the BSP by default, which can be changed. There exists an open-source compiler for BSPs on SourceForge, which I don't remember the name at the moment. You can find about it on the HOWTO forum. I believe it's in one of the stickys there.

Hope this helps.

P.S. Cool screenshot. That is tight!
"Object-oriented programming is an exceptionally bad idea which could only have originated in California."
- E.W. Dijkstra
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

Thanks for the comment and the help, Luke!

I got a question, though. Dynamic lights don't affect the lightmap of the bsp I'm already loading, right? For what I've read, dynamic lights only affect imported models (3ds,.x,obj,ms3d) and if they are set to be affected by it (set to true for receiving light or casting shadows), correct?

That means you must have planned in advance in which places of your map you'll place models to receive the dynamic light, and reinforce the ambiance of its surroundings with lightmaps compiled from the level editor, correct?

questions questions questions! I have a lot of things to try now.

thnx
Image
Luke923
Posts: 59
Joined: Wed Nov 05, 2003 5:26 am

Post by Luke923 »

I'll be honest, I haven't messed with dynamic shadows; however, from what I've seen of it, the BSPs don't cast shadows from dynamic lights, but will receive shadows from other objects in the 3D world. Also, the BSP should receive dynamic light depending on the setMaterialType() you specify. If you're not getting your BSP to respond to your dynamic lights, the best bet would be that you haven't called the following, or something very close to it:

Code: Select all

BSPNode->setMaterialFlag(video::EMF_LIGHTING,true);
If that's not it, check and see what video::E_MATERIAL_TYPE you have specified when you call setMaterialType(), as certain values disable dynamic lighting.
"Object-oriented programming is an exceptionally bad idea which could only have originated in California."
- E.W. Dijkstra
buhatkj
Posts: 444
Joined: Fri Dec 12, 2003 4:53 am
Contact:

bah, what does djykstra know heh lol

Post by buhatkj »

hey dude, i LIKE OOP. it WORKS mate...
heh though you arent alone if you do share that opinion, ive met a lot of guys who are all about old school c and hate all the OO stuff.
anyways, i is out
-Ted
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

great Luke, most illustrative!

I'll play with it today.


see you around
Image
Luke923
Posts: 59
Joined: Wed Nov 05, 2003 5:26 am

Re: bah, what does djykstra know heh lol

Post by Luke923 »

buhatkj wrote:hey dude, i LIKE OOP. it WORKS mate...
heh though you arent alone if you do share that opinion, ive met a lot of guys who are all about old school c and hate all the OO stuff.
anyways, i is out
-Ted
Actually, I like OOP as well. But, as a network engineer by trade, I have to give props to the father of OSPF. And, I just thought it was a very strange quote.
"Object-oriented programming is an exceptionally bad idea which could only have originated in California."
- E.W. Dijkstra
smartwhiz
Posts: 120
Joined: Wed Jan 14, 2004 6:03 pm
Location: India

Post by smartwhiz »

no it doesn't work......
still only the other formats.... other than bsp gets the dynamic light shades
Luke923
Posts: 59
Joined: Wed Nov 05, 2003 5:26 am

Post by Luke923 »

Smartwhiz,

For us to discern what you're doing wrong, we have to know what you're doing to begin with. If you can, please post all code related to your BSP.

One other thing to consider is that dynamic lighting is per-vertex. In other words, each triangle in the 3D mesh will get a different shade; however, each pixel within the triangle itself it will have an equal shade level, and, in comparison other pixels within the same triangle, will look unshaded. This can be an issue considering that many BSPs, esp. in large rectangular areas, tend to be represented by few vertices. So, take for example, a large room could have only two light levels represented on the floor since only two triangles would exist within this room.

Hope this helps.
"Object-oriented programming is an exceptionally bad idea which could only have originated in California."
- E.W. Dijkstra
Post Reply