Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Light maps with native commands

Author
Message
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 11th Dec 2011 00:42 Edited at: 11th Dec 2011 00:43
I was flicking through the help files when I stumbled across some light map commands. Apparently you are able to create light maps for static and dynamic objects and apply them all with native DBP commands. This is the example that comes with it:



However, this is what I get when I run the program:



If I rem out this line of code, it works:



However, that's the exact command I need to see what it does Any help?

TheComet

Attachments

Login to view attachments
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 11th Dec 2011 02:37
Perhaps you ran out of memory?... Umm look back at the devide texture sizes... maybe reduce them?... Try running it again and see how much memory it uses... also check your virtual memory space too... increase it to 2.5 times at least 2.0 times the recommended size... I triple mine lol...

Just a rough guess and a massive lol at the rem out solutoon...

This looks too complicated for me to use... stupid at math equations... ... But oddly good at some maths...

chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Dec 2011 02:49
Hi there.

what I have done.

Quote: "rem STEP 1 -----> Creating objects for our level
make object box obj,300,5,300
position object obj,300,200,300
make static object obj,collision,arbitraryvalue,shadow,portal


rem STEP 2-----> Building static portal and adding static object to lightmaps
build static portals
add static objects to light map pool

rem STEP 3----->Adding light to the scene ...you can add as many lights as you need.
rem ADD LIGHT MAP LIGHT X, Y, Z, Radius, Red, Green, Blue, Brightness, Shadow
add light map light 800,220,800,500,155,0,0,170,1

rem STEP 4-----> SAVING LIGHTMAPS (no shadows )
texturesize=128 : texturequality=1 : lightmapsavepath$="lightmaps"
if path exist(lightmapsavepath$)=0 then make directory lightmapsavepath$
create light maps texturesize,texturequality,lightmapsavepath$
if file exist(tfile$)=1 then delete file tfile$
save static objects tfile$ : omax=o"


Notice that you have to setup every object that you add to the scene as:

make static object obj_numer,collision,arbitraryvalue,shadow,portal

It doesn`t gives shadows, but it give us good lights. I can send you a complete example.

Cheers.

I'm not a grumpy grandpa
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 11th Dec 2011 03:30
Memory is not the issue here, especially considering my rig

@ chafari

I'd love to see your complete example

TheComet

chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Dec 2011 11:52
Hi guys. Ok here's the minimum code that we need to add in our Universe code. Let me know if it works to you


Cheers.

I'm not a grumpy grandpa

Attachments

Login to view attachments
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 11th Dec 2011 12:02 Edited at: 11th Dec 2011 12:03
Tried it. When I run your example "Minimum code", I still get the same error:



And again, this command causes the crash:



TheComet

Attachments

Login to view attachments
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Dec 2011 12:13 Edited at: 11th Dec 2011 12:18
So you must have something wrong in your PC, or perhaps you graphic card...test this exe attached.

Edited Could someone test this code please...in my laptop and PC works fine

Cheers.

I'm not a grumpy grandpa

Attachments

Login to view attachments
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 11th Dec 2011 12:23
Yep, that runs. But loading the level isn't the problem. My problem is that I can't use the command create light maps without DBP crashing on me... :/

TheComet

chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Dec 2011 12:29
Quote: " My problem is that I can't use the command create light maps without DBP crashing "


Yes...I know, but this is the last command that will save your lightmaps....if you rem this line, you won't save lightmaps and it doesn't work. How old is your PC ??.

Cheers.

I'm not a grumpy grandpa
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 11th Dec 2011 12:35
Old? I am insulted



TheComet

chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Dec 2011 12:45
Wow !! and with all that, and you can't execute this commands. What version of Darkbasic are you using actually? I still use 1.074 . I don't think this could be the problem although.

I'm not a grumpy grandpa
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 11th Dec 2011 12:51
Update your DBP if you haven't already done so.

My signature is NOT a moderator plaything! Stop changing it!
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Dec 2011 12:56
Quote: "Update your DBP if you haven't already done so."


I'v got the update ready but I'm to lazy .

Mobiius please, could you test the minimum code example above in your PC ?.

Thanks in advance.

I'm not a grumpy grandpa
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 11th Dec 2011 13:10
I upgraded to U77 again just to be safe. No effect, I still get the same error

TheComet

chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Dec 2011 13:15
Not all graphic cards work in the same way...could be that your problem.

Cheers.

I'm not a grumpy grandpa
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Dec 2011 14:19
Quote: "So you must have something wrong in your PC, or perhaps you graphic card...test this exe attached.

Edited Could someone test this code please...in my laptop and PC works fine "


I get exactly the same problems as TheComet - and with the demo that comes with DBPro. I've tried to use the lightmapping commands several times and nearly always get the same result. The odd thing is that I'm sure I had it working at one point but I can't remember what I did to get it working.

I doubt memory or GFX cards are the problem here - although I see TheComet has an nVidia card as well (I have an nVidia GTX 285 which I suppose is rather old now ).

Is it possible that this command interferes with the Dark Lights commands (which I have)?
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Dec 2011 14:46 Edited at: 11th Dec 2011 14:47
Quote: "Is it possible that this command interferes with the Dark Lights commands (which I have)? "


I don't think so,...I'v got Darklights as well and both works fine.I have nVidia card as well...Geforce 9300M GS with just 256MB. In all my machines, works ok.



Cheers.

I'm not a grumpy grandpa

Attachments

Login to view attachments
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Dec 2011 14:58
Just checked again. Neither your code nor the code given in the DBPro Help file works on either of my machines (2006 laptop with XP and ATI card, 2009 PC with Vista and nVidia card, DBPro U77 on both machines). The laptop issues a Visual Studio error window muttering about an unhandled Win32 exception so if I had the DBPro source code I might be able to track down the problem.

Like TheComet it's the create light maps command that causes the problem for me.
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Dec 2011 15:07 Edited at: 11th Dec 2011 15:08
Quote: "Like TheComet it's the create light maps command that causes the problem "


No that is not the problem , as we all know, this line is necesary to save lightmaps...the problem must be somewhere but not there.....that's like if we say that the problem is in the editor when some Shaders crash. I would like someone else post if this Universe code that comes with Darkbasic Pro works to them. It is a good alternative to Darklights and other lightmapping programs, and comes for free.

Cheers.

I'm not a grumpy grandpa
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Dec 2011 15:08
chafari

Just a thought. Here's the compiled exe from my Vista machine. Does that work when placed in your project folder?

If that works then there's something different about our machines. If it fails then there's something different in the compilation.

Let me know what happens.

Could you also post your working exe (compiled from your Minimal code.dbpro example) so I can see if that runs here?

Attachments

Login to view attachments
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Dec 2011 15:19 Edited at: 11th Dec 2011 15:31
Quote: "No that is not the problem , as we all know, this line is necesary to save lightmaps...the problem must be somewhere but not there"


Of course it is necessary - when it works. The point is: that line is causing the program to crash for some reason.

If I change your code to this:



it crashes before that loop is reached - but works if I comment out the create light maps line. Something is wrong somewhere and that line is suspect.

Anyway, if you test my non-worling exe and post your working exe we might make progress.

I still favour the theory that a plug-in somewhere is causing the problem. I could try temporarily moving all my plug-ins out of the way to see if that changes anything.

Edit Tried disabling all the plugins and still the same problem.

Any chance of trying your exe? Please.
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Dec 2011 15:37 Edited at: 11th Dec 2011 15:52
@Green Gandalf

Some time ago, I saw a good example of yours "misty smoky fog", and I was astonished with it...I keep most of your examples, but that one was very impresive for me....with the time, I had some problems in my PC, and I had to restar every thing... when I try to execute your misty smoky fog, my Latpot crashed all the time...I was very upset with it...I coudn't understand why it didn't work...I new that one time I had it working...what happens ?? I googled for the very last directx 9 (not directx 10) and update it and when I try to execute your misty smoky fog, I had a big smile because I got it working again.

So that could be a stupid thing, and as you say, you had it working once....so it is not imposible, and this line must be there.

Quote: "create light maps texturesize,texturequality,lightmapsavepath$"



Edited.
Quote: "Any chance of trying your exe? Please"


It is there in the second upload .

2D Edit.
GG the exe that you post, crash in my laptop. its size is 3.85MB and my exe is 4.04MB

Cheers.

I'm not a grumpy grandpa
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 11th Dec 2011 15:50
Quote: "It is there in the second upload ."


He means you should try his exe ^^

@ GG

I placed your exe into chafari's folder and tried to run it. Same result as last time, it crashed.

TheComet

MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 11th Dec 2011 15:53
Did anyone try increasing their virtual memory¿

chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Dec 2011 15:55 Edited at: 11th Dec 2011 16:02
Sorry Green Gandalf...nobody believe me when I say I'm gettin old. I tested your exe and crashes...something goes wrong compiling.

Edited

Did anyone try increasing their virtual memory¿

I don`t think this is the case. In texturesize= I have use from 2 4 8 16 up to 512 and works perfectly...other things is if you put texturesize=2048 ...then probably you will have problems with virtual memory.

Cheers.

I'm not a grumpy grandpa
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 11th Dec 2011 16:02
Quote: "Did anyone try increasing their virtual memory¿"




Memory is not a problem

Quote: "Sorry Green Gandalf...nobody believe me when I say I'm gettin old. I tested your exe and crashes...something goes wrong compiling."


No problem So this means it's a compiler issue. I've also tried removing all plugins, and that has no effect either.

The problem is this little quote from chafari:

Quote: "I still use 1.074 . I don't think this could be the problem although."


You are using an older version of DBP and that causes it to work. What happens if you upgrade to upgrade 77?

TheComet

Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 11th Dec 2011 16:09
Chafari: The code worked fine on my machine.
Green Gandalf: Your compiled code did not work on my machine.

2.8GHz AMD Phenom II N620 CPU
Windows 7 Enterprise x64
4Gb RAM
ATI Mobility Radeon HD 4250 GFX card

My signature is NOT a moderator plaything! Stop changing it!
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 11th Dec 2011 16:13
I think you are confusing virtual memory with physical...
So anyway...

I will give this a try tomorrow... when I get back in the shop...

Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 11th Dec 2011 16:15
Quote: "I think you are confusing virtual memory with physical..."

Why so fixated on virtual memory? lol It doesn't sound like a virtual memory error, but perhaps the graphics drivers on Nvidia machines are conflicting with something somehow.

My signature is NOT a moderator plaything! Stop changing it!
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Dec 2011 16:16
Thanks Mobiius for testing code.

Quote: "What happens if you upgrade to upgrade 77"
.

I don`t know, but I could make a test. Any way, I'm an old man and don't like updating every day . I don`t know what is new in this very new updates, and I'm a bit scare. Remember, that I had to restar all my mashine one year ago ufffff

Cheers.

I'm not a grumpy grandpa
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Dec 2011 16:34
The problem is this little quote from chafari:

Quote: ""I still use 1.074 . I don't think this could be the problem although.""


You where right about the mistery, but the mistery exist....I have updated to 1.077, and my code crash. So it was good I had made a copy, and I can use both (old/new) deppending on what I need.

Cheers.

I'm not a grumpy grandpa
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 11th Dec 2011 16:38 Edited at: 11th Dec 2011 16:49
can someone compile the offenting db files with code so I can test it... that minimum code this doesnt feature it... but that works for me... I am asking because I am using mh phone to connect to my pc... so copuying that huge but of code at the top is a little diffiult...

would really like to try to compile it tonight if possible...

EDIT

oooo upon closer inspection So dbpro is crashing while compiling the code... perhaps someone needs to ask Lee

or is it the compiled exe thats crashing... perhaps make a screen vid of how it fails?

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Dec 2011 16:49 Edited at: 11th Dec 2011 16:56
Quote: "can someone compile the offenting db files with code so I can test it"


Already done - just try the exe file I uploaded a few posts back. I'll try downgrading to U74 and report back.

We do seem to be getting consistent results now. My compiled exe hasn't yet worked on anyone's machine.

chafari

Quote: "Edited.

Quote: "Any chance of trying your exe? Please"

It is there in the second upload .
"


TheComet has already explained why that doesn't help. Please upload the exe that creates the light maps - that exe of yours merely uses previously created ones and there is no problem. The problem is at the create light maps step as we keep explaining.

Edit It's an upgrade issue. Both chafari's "minimal code" demo and the DBPro Help file demo code work fine with U7.4 - except they both crash on exit (using esc key) with a Windows DEP warning (why give such a warning on exit for Heaven's sake??).
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Dec 2011 16:57
@MrValentine

The files are in the post above, but I attached again if you want to test.
It works fine in version 1.074 but crash in version 1.077


Cheers.

I'm not a grumpy grandpa

Attachments

Login to view attachments
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Dec 2011 17:05
GG
Here's the exe that makes the lightmaps. just put it into the same folther.

Cheers.

I'm not a grumpy grandpa

Attachments

Login to view attachments
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 11th Dec 2011 17:07
File does not exist at line 36...

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Dec 2011 17:08
Just tested on my XP laptop - both demos work fine with U7.4 and exit cleanly. The weird Data Execution Prevention error message on exit is only given by my Vista machine but the code itself runs fine.

Anyone any idea why I'm getting that error message and how to stop it? I already have DEP turned off for DBpro.

chafari

I think we could have saved a lot of time if we'd noticed you'd said this in your earlier post:

Quote: " I still use 1.074 . I don't think this could be the problem although."


For some strange reason I convinced myself you were using U77. Must be getting older faster than you are.
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Dec 2011 17:16
Sorry for my clumsiness, but I didn`t thought about it. As I have mention, I don't like very much the updates...so we never know if our programs are goint to work in other machines as presumably the updates go for better and not for worse

Cheers.

I'm not a grumpy grandpa
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 11th Dec 2011 17:20 Edited at: 11th Dec 2011 17:31
I always presumed updates were for that exact reason...

EDIT

U

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Dec 2011 17:28
Quote: "I always presumed ipdates were for that exact reason"


Not always true as this example demonstrates.

Quote: "Sorry for my clumsiness, but I didn`t thought about it."


It wasn't you that caused the problem - it was the rest of us including me.
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 11th Dec 2011 17:34
Green Gandalf...

Sorry man been trying for almost half an hour trying to find you my post on the DEP things... its a huge post was in one of the tgc produxts and windows 7 threads... so difficult to find it while using phone...

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Dec 2011 17:37 Edited at: 11th Dec 2011 17:48
Thanks for trying. I'll see if I can find it.

Edit

Do you mean this? I'm wading through it now.

http://forum.thegamecreators.com/?m=forum_view&b=2&t=159609&p=1
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 11th Dec 2011 21:48
So is this a bug report? Should I make a thread?

TheComet

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Dec 2011 22:13 Edited at: 11th Dec 2011 22:18
Yes - unless it's been done already. There might be one under GameFX commands now I think about it.

Edit

Well, what a surprise. Why didn't this chap remind me?

http://forum.thegamecreators.com/?m=forum_view&t=173381&b=15

What is the world coming to? You just can't seem to be able to rely on anyone these days.
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 12th Dec 2011 01:02
Hei GG those Alpha Mike`s Dll realy works. Does it mean that the problem is solved? ...it crashes when close the program like 1.074, but it saves lightmaps.

Cheers.

I'm not a grumpy grandpa
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 12th Dec 2011 14:36
Quote: "Hei GG those Alpha Mike`s Dll realy works."


Yes, they seem to. But since they were created from an older version of DBPro some new features (bugs?) might not be there. So no, the problem isn't really solved - except we know now that it can be solved.
JackDawson
12
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 12th Jan 2012 17:35 Edited at: 12th Jan 2012 17:39
Guys, I tested out the code. . the save lightmaps crashes until I comment out this :

add static objects to light map pool

and I can leave everything else un-commented with no problems. But then it wont save the light maps. I am wondering if the bug is in this command.

I am using U77 on Win 7 64 Bit Ultimate.

Rig


Also, virtual memory is not the problem here. In a side note I can run the other code some of the others here with light mapping no problem. Its something in this code here that is having issues. I am thinking its the original DirectX Model that you use when you run this. Its somehow causing an over flow DEP error. I turned off DEP to test this, same error. So I was able to narrow this down to the above command as well as it could be the Original DirectX file : fuerte.X

"Life is like a box of chocolates.. eat it before it melts."
WLGfx
16
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 12th Jan 2012 18:41
Has this been added to the 3 most annoying bugs?

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
WLGfx
16
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 6th Apr 2012 01:13
Where in the help docs are the built in light mapping commands? I've only found a few of them so far using index list...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!

Login to post a reply

Server time is: 2024-05-08 06:47:49
Your offset time is: 2024-05-08 06:47:49