View previous topic :: View next topic |
Author |
Message |
Rytz Member
Joined: 09 Jul 2007 Posts: 13 Location: IL, USA
|
Posted: Tue Jun 17, 2008 8:56 am Post subject: B3D lighting issue: can't seem to remove ambient lighting... |
|
|
Hey All:
I'm using DeleD in conjunction with Irrlicht right and now and things are going good but I'm having a lighting issue.
When I create a DeleD map (simple cube room), and export it to B3D, it always has lighting no matter what material settings I change (in Irrlicht or DeleD). I tried leaving out lightmaps in the export and no change. I tried using the DMF format instead but the light was still there.
I tried the "Remove Lightmap" option under the edit menu but nothing there either.
Any thoughts or ideas? I hope this isn't a "feature" of DeleD Lite .
Thanks.
~ Rytz |
|
Back to top |
|
|
jwatte DeleD PRO user
Joined: 26 Apr 2006 Posts: 513
|
Posted: Wed Jun 18, 2008 5:59 am Post subject: |
|
|
There's a Lightmapping preference setting to not include the ambient lighting in the baked light map. |
|
Back to top |
|
|
Rytz Member
Joined: 09 Jul 2007 Posts: 13 Location: IL, USA
|
Posted: Wed Jun 18, 2008 6:45 am Post subject: |
|
|
Thanks for the reply.
I'm using DeleD LITE so the option is greyed out but is shown unchecked.
So there should be light whatsoever generated with the map correct?
Thanks.
~ Rytz |
|
Back to top |
|
|
Rytz Member
Joined: 09 Jul 2007 Posts: 13 Location: IL, USA
|
Posted: Wed Jun 18, 2008 6:48 am Post subject: |
|
|
I also forgot to mention that the DirectX exporter seems to be exporting the map correctly because when it's loaded into Irrlicht, there is no lighting present.
I guess I could just stick with the DirectX exporter unless someone might know of a reason the B3D's have ambient lighting in them.
~ Rytz |
|
Back to top |
|
|
Jeroen Site Admin
Joined: 07 Aug 2004 Posts: 5332 Location: The Netherlands
|
Posted: Wed Jun 18, 2008 8:51 am Post subject: |
|
|
Have you asked on the Blitz forums too? I'm wondering what they might have to say about this. |
|
Back to top |
|
|
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Wed Jun 18, 2008 9:14 am Post subject: |
|
|
Thanks for reporting this!
First of all, it doesn't sound lightmap-related at all, it sounds like the exporter sets set some material properties in the B3D file that have an unwanted result.
Unfortunately, I'm not quite sure what you mean by "ambient lighting" in this case, as I don't see anything about the lighting that shouldn't be there. I do, however, preview my B3D files in Blitz3D, not in Irrlicht.
Any chance of you posting a screenshot of what it looks like, and perhaps even of what it should look like? I'll put this on the list for the exporter, but if I don't have to setup Irrlicht first, tackling this problem will be a lot quicker... |
|
Back to top |
|
|
Rytz Member
Joined: 09 Jul 2007 Posts: 13 Location: IL, USA
|
Posted: Wed Jun 18, 2008 10:22 am Post subject: |
|
|
[EDIT: I changed the images to show a top view to show the problem better.]
[EDIT: I added a texture to the 3DS room to more clearly show how the lighting should look.]
Thanks for the replies. It's kind of hard to describe these issues sometimes so I apologize for that. I've got some screenshots of the ".X" and ".B3D" export settings and the actual look of the meshes in Irrlicht.
The ".B3D" mesh always seems to have "ambient" light or light that is always present no matter what. The textures are still showing up lit even when I'm not using any lightmaps. I'm using dynamic lighting with Irrlicht so there shouldn't be any default lighting.
The ".X" exporter "kinda" works but as you'll see in the pic it's got some strange texture "shading" affects still being applied to it.
I've tried different options on both exports but nothing seems to work. The one thing that I noticed no matter what is that light is not reflecting off of the textures properly. With the B3D I get no shadowing / lighting effects whatsoever. With the ".X" format I get some shadowing / lighting but it's very "blocky" and the lighting only changes in 4 spots on the whole mesh (as the light circles the room).
I'll probably have to make a video to explain the lighting problems correctly .
I've also added a screenshot of what the scene should look like using a 3DS room that is included with the Irrlicht tut's package.
I really want to use DeleD since it's really simple to use and gets the job done great for what I'm trying to do but since I'm developing my game in Irrlicht, it needs to work correctly . I'm not trying to get into the graphics side so I'm trying to keep things as simple as possible.
Anyways, on to the images...
[.B3D Mesh Images (Textures Always Lighted No Matter What)
[.X Mesh Images (Weird Shadowing Effects on Textures)]
[Working 3DS Mesh Images (Correct Dynamic Lighting on Textures)]
Last edited by Rytz on Wed Jun 18, 2008 1:54 pm; edited 1 time in total |
|
Back to top |
|
|
Rytz Member
Joined: 09 Jul 2007 Posts: 13 Location: IL, USA
|
Posted: Wed Jun 18, 2008 1:36 pm Post subject: |
|
|
Click [HERE] to download the Irrlicht map tester source code and mesh files.
Click [HERE] to download the DeleD project and mesh files. |
|
Back to top |
|
|
Rytz Member
Joined: 09 Jul 2007 Posts: 13 Location: IL, USA
|
Posted: Thu Jun 19, 2008 2:33 am Post subject: |
|
|
I've done some more testing and got some maps to export correctly with the 2.0 DirectX Exporter (not the newest version of the plugin) but the problem is that I can't make the rooms bigger than about 512x512 or they stop working correctly with the Irrlicht lighting. I got some feedback on the Irrlicht forums and someone suggested the normals are coming out different somewhere during the export.
Any thoughts?
The B3D exporter does the same thing no matter what (the "ambient" lighting problem).
~ Rytz |
|
Back to top |
|
|
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Thu Jun 19, 2008 6:09 am Post subject: |
|
|
Thanks for all the feedback and reproduction material, the problem is perfectly clear now and I'll get on it right away!
First thoughts:
- The .X issue looks like a normal problem. I know I'm stating the obvious, but in that screenshot you posted you specified 'no normals', have you tried playing around with that? (I'm sure you have, but I just had to make sure there)
- As a quick test, you could also try the DirectX Exporter by JWatte. Unlike our exporter, that exporter is directly based on DirectX functionality, so it might conform better to whatever standard you can think of. |
|
Back to top |
|
|
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Thu Jun 19, 2008 10:20 am Post subject: |
|
|
Well, apparently, this is harder to debug than I thought. Mainly because I don't know Irrlicht that well.
Here are some things I noted:
- The B3D exporter doesn't export any normals. The Irrlicht B3D loader should generate per-poly normals in that case, but I'm not sure how to check.
- The Irrlicht B3D loader always initialize the material emissive color to ( 0.5, 0.5, 0.5, 0 ). This seems simply wrong, if I hack the materials after loading in your example by doing
Quote: |
video::SMaterial& material = nodeRoom->getMaterial(0);
material.EmissiveColor = 0xFF00000;
|
the lighting starts to work... albeit chunky, like the problem you described with the .X files.
I am guessing the chunkyness is related to per-poly normals, I'll see if I can get B3D per-vertex normals up and running. |
|
Back to top |
|
|
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Thu Jun 19, 2008 10:45 am Post subject: |
|
|
Nope, the chunkyness is simply related to your light radius (750) being too small (it gets abruptly cut off once the lights get out of range for a specific vertex). If I increase the radius to 5000, decrease your attenuation to (0.0f, 1.0f, 0.0005f), and swing up your light animator to (0, 50, 0), 300.0f ... things are starting to look up...
Although the walls still get darker whenever the light gets closer, mighty strange. Even more fun is the fact that when I subdivide (smooty) your model a couple of times to get a higher resolution, things look just fine.
I am kinda hoping these notes will give you enough information to get things up and running for you again. If you have any remaining questions, don't hesitate to ask! |
|
Back to top |
|
|
jwatte DeleD PRO user
Joined: 26 Apr 2006 Posts: 513
|
Posted: Thu Jun 19, 2008 7:18 pm Post subject: |
|
|
Quote: |
the walls still get darker whenever the light gets closer |
That's probably because of per-vertex lighting. The angle from the light to each vertex becomes more oblique, so you get more cosine factor attenuation. The only real fix is to use per-pixel lighting. |
|
Back to top |
|
|
Rytz Member
Joined: 09 Jul 2007 Posts: 13 Location: IL, USA
|
Posted: Fri Jun 20, 2008 2:56 am Post subject: |
|
|
Thanks for the replies and the info.
After trying what you suggested Paul-Jan I was able to get DirectX working properly . Originally I thought it was the newer DirectX plugin (2.2) but it was a combination of the lighting settings in my code and the settings with the newer DirectX Exporter. I had to use "smooth" normals. I tried all of the settings before but since my lighting code was off it never worked. Thanks a ton for your testing and feedback. I also learned a lot about lighting in conjunction with this so that's always a plus as well .
As far as the B3D maps go, I can't seem to remove the "ambient" lighting no matter what material or color settings I put in my code for the mesh. I got some suggestings from the Irrlicht boards as well but nadda. If the DirectX files are working then it's not really a big deal but it is pretty weird still.
jwatte: thanks for bring up the per-vertex lighting suggestion. I'm still learning a lot about the graphics side of things and that was something I didn't know about. I'm guessing you are right and that is the issue for the "blockiness" of some of the lighting. I posted about it on the Irrlicht boards and hope to hear back if that is the case.
[HERE] is a video of the working lighting with Irrlicht.
Thanks again for all of your help .
~ Rytz |
|
Back to top |
|
|
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Wed Jun 25, 2008 6:06 am Post subject: |
|
|
Quote: |
That's probably because of per-vertex lighting |
Ah yes, excellent point... Actually, that's the whole reason why I subdivided the mesh to see if that would help, and then whilst typing the post I forgot why I was doing so in the first place .
Rytz: Good to hear (and see!) you got things up and running now! If you want to, I can send you the modified Irrlicht source I used to get the .B3D file up and running, because it still is kinda strange I got it to work and you didn't. However, handmodifying the materials after the fact is not the most convenient way to go I guess... |
|
Back to top |
|
|
|