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.

Code Snippets / Lightmap Calculation [DBP]

Author
Message
EVOLVED0
19
Years of Service
User Offline
Joined: 1st Mar 2005
Location: UK
Posted: 11th Feb 2006 18:46 Edited at: 19th May 2006 22:19
Just a simple lightmap Calculation function to add basic light maps to your editors.

Should now work with U6 RC10!

Latest code:
http://www.vector3r.com/Code/Snippets/LightMapCalculation/LightMapping.zip

screens: (Click on image to enlarge)

Attachments

Login to view attachments
EVOLVED0
19
Years of Service
User Offline
Joined: 1st Mar 2005
Location: UK
Posted: 11th Feb 2006 19:55 Edited at: 12th Feb 2006 00:53
Edit

Attachments

Login to view attachments
Turoid
21
Years of Service
User Offline
Joined: 1st Nov 2003
Location: The Netherlands
Posted: 11th Feb 2006 21:24
PERFECT!!!!!!

thanks! this is most hard-coded thing in dbc i guess!!


.::Studying game design at the moment::.
Matinuker
20
Years of Service
User Offline
Joined: 25th Mar 2004
Location:
Posted: 11th Feb 2006 22:40
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Edit: I DON'T WANT TO TURN MY CAPS LOCK OFF!

EVOLVED0
19
Years of Service
User Offline
Joined: 1st Mar 2005
Location: UK
Posted: 12th Feb 2006 00:48 Edited at: 13th Feb 2006 20:03
[edit]
Matinuker
20
Years of Service
User Offline
Joined: 25th Mar 2004
Location:
Posted: 12th Feb 2006 12:22 Edited at: 14th Feb 2006 18:19
How on Earth did you work it out?!?

Could you explain the memblock editing side of it?
I'de really like to know how it works

Edit: Screenie

<REMOVED>

Matinuker
20
Years of Service
User Offline
Joined: 25th Mar 2004
Location:
Posted: 12th Feb 2006 16:41 Edited at: 14th Feb 2006 18:19
I was messing around with your code to see whether
I could look at the vertex data of a sphere and I
can't get it to look the same as it was origionally
by editing the memblock.

It looks like this instead -
<REMOVED>

Here's the code-


Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 12th Feb 2006 17:20
Jaw dropping stuff there Evolved...May end up in my Jazz3D game once the rest of the editor is worked out.
Even if it doesnt though, thanks and well done !

EVOLVED0
19
Years of Service
User Offline
Joined: 1st Mar 2005
Location: UK
Posted: 12th Feb 2006 17:23
this is whats causing the problem "write memblock float 1,(12+((32*v))-32)+8, polys#(index,3,2)"

try this

Matinuker
20
Years of Service
User Offline
Joined: 25th Mar 2004
Location:
Posted: 12th Feb 2006 19:07
Brilliant!

Thankyou

EVOLVED0
19
Years of Service
User Offline
Joined: 1st Mar 2005
Location: UK
Posted: 13th Feb 2006 05:32 Edited at: 13th Feb 2006 05:32
I think I just got my head around DBP fvf and I now know how to edit texture stages

if your still not sure about FVF check out this code (+ small tutorial)







Download media >>

Attachments

Login to view attachments
Matinuker
20
Years of Service
User Offline
Joined: 25th Mar 2004
Location:
Posted: 13th Feb 2006 19:29 Edited at: 14th Feb 2006 14:52
I haven't looked at your tut yet but I'm sure that
I will find it usefull when I do because...


Thanks to you I have started my own 3D-Editor
Screenie -
<REVOVED>
ATM it's still buggy and doesn't do anything much but it's a
start

Edit: Great tut

Edit: I'm having some problems with my program

Here's the code that is most important:

Just remove the functions and the blue gui stuff and it should work.

Here's the entire of the code-


dugzilla
21
Years of Service
User Offline
Joined: 5th Aug 2003
Location:
Posted: 15th Feb 2006 13:23
I get an error "Could not understand command line" when I try to compile and run your simple demo. (setupobject) and (removeobject) commands. Nowhere do I see these commands in your function code.
Essence
22
Years of Service
User Offline
Joined: 12th Oct 2002
Location: The Netherlands
Posted: 15th Feb 2006 17:28
@dugzilla: i got the same problem.
Running on DBP 5.9


First DifNiX -> now EvaX.
Matinuker
20
Years of Service
User Offline
Joined: 25th Mar 2004
Location:
Posted: 15th Feb 2006 18:16
You have to include the functions .dba

dugzilla
21
Years of Service
User Offline
Joined: 5th Aug 2003
Location:
Posted: 15th Feb 2006 18:54
I've included the "lightmapping function.dba" and I'm using 5.9....
I get the error from inside the lightmapping function dba... There is no function or command called "setupobject" or "remove object" declared in the lightmapping dba yet he is using "setupobject" or
"remove object" as a function/command.
EVOLVED0
19
Years of Service
User Offline
Joined: 1st Mar 2005
Location: UK
Posted: 15th Feb 2006 18:54 Edited at: 15th Feb 2006 19:06
@dugzilla
you need Sparkys Collision dll (http://forum.thegamecreators.com/?m=forum_view&t=31051&b=5) in the "plugins-user" folder and the newest DB5.9 (not beta).

@Matinuker
sorry for not helping , iv been bizzy working on improving the speed.
Essence
22
Years of Service
User Offline
Joined: 12th Oct 2002
Location: The Netherlands
Posted: 16th Feb 2006 09:54
@Matinuker : I did that of course

But, i installed sparky's collision dll, and now its working
Pretty neat code i must say, but is there a possibility to add way more lights?
Just for a whole gamemap or something?
That would be awesome.


First DifNiX -> now EvaX.
Freddix
AGK Developer
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 16th Feb 2006 11:38
wow it's really great !!!!

@Evolved : plz can you contact me at ( freddbprojects@wanadoo.fr ) or on my msn ( psykokwak75@hotmail.com ) I have some informations to ask you about your samples :p
Thanks.

All we have to decide is what to do with the time that is given to us.
dugzilla
21
Years of Service
User Offline
Joined: 5th Aug 2003
Location:
Posted: 16th Feb 2006 18:22
Working good here.Thanks.
Freddix
AGK Developer
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 16th Feb 2006 22:24
is it totally free ? Can we use your snippet for commercial products ?

All we have to decide is what to do with the time that is given to us.
EVOLVED0
19
Years of Service
User Offline
Joined: 1st Mar 2005
Location: UK
Posted: 16th Feb 2006 23:18 Edited at: 18th Feb 2006 18:29
Quote: "is it totally free ? Can we use your snippet for commercial products ?"


Yeh sure, dont see why not , but this is still wip :/

```````````````````````````````````````````````````````

newer version for downlaod,the calculation should be a lot faster. make sure to have the "Collision.dll" and "DarkSideProgressBar.dll" (there in the .zip) in the plugins folder.

Next Version(s):

Attachments

Login to view attachments
MikeS
Retired Moderator
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: United States
Posted: 18th Feb 2006 18:38
Oh boy, I can see Freddrix making great use of this, I'm quite excited.

---------------
Evolved, contact Rich about putting this into the newsletter. Implementing lightmaps is something DBP users have been taking about for years and years. It seems you've done it with some simple functions, excellent work!



A book? I hate book. Book is stupid.
(Formerly Yellow)
Turoid
21
Years of Service
User Offline
Joined: 1st Nov 2003
Location: The Netherlands
Posted: 18th Feb 2006 18:41
Quote: "I can see Freddrix making great use of this"


Yea, the next xquad editor is going to be veeeery big


.::Studying game design at the moment::.
EVOLVED0
19
Years of Service
User Offline
Joined: 1st Mar 2005
Location: UK
Posted: 19th Feb 2006 03:05 Edited at: 19th Feb 2006 03:14
Quote: "Evolved, contact Rich about putting this into the newsletter. Implementing lightmaps is something DBP users have been taking about for years and years. It seems you've done it with some simple functions, excellent work!"


Do you think this will get on the newsletter ?

````````

new version (v1.8)

its now:
faster
fixed borders

this will be my last update for a while as I need to get Project Evolution out the door.

Attachments

Login to view attachments
Freddix
AGK Developer
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 19th Feb 2006 18:58 Edited at: 19th Feb 2006 19:31
@MikeS & Turoid ( & EVOLVED ) : you're right X-Quad Editor does not actually handle "Light Mapping Calculations" and, the DarkBASIC Professional's default one is really slow and with no progress bar (when you make it calculate a large number of objects, you can't know if program is freezed or really under calculations (user can guess and use CTRL+ALT+SUPPR thinking X-quad freezed, your one (EVOLVED) is really interesting and I'll be really be proud to include your in my editor (giving information about LM author (you) in the help files )
The only problem is that I've not understood hos it really work and I must learn it to be able to export the correcttextures and apply them in the game loader (that's also why I asked you to contact me in MSN if you can, to discuss about this )

Thanks
and, once agains, excellent work Evolved !

All we have to decide is what to do with the time that is given to us.
EVOLVED0
19
Years of Service
User Offline
Joined: 1st Mar 2005
Location: UK
Posted: 19th Feb 2006 20:02 Edited at: 19th Feb 2006 20:09
In the new download(I up loaded today) theres a new save/load example , but if you want the lightmap image number that an object uses just use the "img=Get_LightMap_Texture(object)" function to return the texture number. Then use "if file exist("myimage.bmp")=0 then save image "myimage.bmp",img " command to save it as a .bmp. Or use memblocks and wirte it to a file (like in the example)

on what area do you need help on ? and ill do my best to help ya.
Freddix
AGK Developer
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 19th Feb 2006 22:02 Edited at: 19th Feb 2006 23:56
@Evolved : thanks. You helped a lot

I think it's enough to make it work with X4

All we have to decide is what to do with the time that is given to us.
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 20th Feb 2006 04:37
Er ... hold on a minute .....

<picks self up off floor>

WOAH!!!

This is the most amazing piece of code I've seen in the two years I've been using DBP. I tried some basic lightmapping myself once, but this is just ridiculously good. This is extremely significant, because, all being well, it could mean we will no longer have to faff around importing/exporting objects between CShop, Giles and DBP, then struggling because of compatability issues - now we will be able to create levels and light them entirely within dbp. WOW!! This looks like it could solve so many problems I've wrestled with.

This MUST go into the newsletter!

Matinuker
20
Years of Service
User Offline
Joined: 25th Mar 2004
Location:
Posted: 21st Feb 2006 20:37
If this doesn't go in the newsletter I'll eat my... penguin

French gui
20
Years of Service
User Offline
Joined: 11th May 2004
Location: France
Posted: 21st Feb 2006 21:37
Mmmh? What do you call a... 'penguin'?.

Freddix
AGK Developer
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 21st Feb 2006 23:50
probably this :

All we have to decide is what to do with the time that is given to us.
French gui
20
Years of Service
User Offline
Joined: 11th May 2004
Location: France
Posted: 22nd Feb 2006 00:16
Ouf, je croyais que c'était sa... enfin son... le truc quoi.

TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 22nd Feb 2006 17:31
I love you! Can't wait to try this out!

[url]andrewneale2004@yahoo.com[/url]
http://www.elbsoftware.dbspot.com
EVOLVED0
19
Years of Service
User Offline
Joined: 1st Mar 2005
Location: UK
Posted: 22nd Feb 2006 23:57 Edited at: 22nd Feb 2006 23:57
Iv added a link to a newer version. I tride to add textuer masks but I could not figger out how its done.
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 23rd Feb 2006 23:02
Very nice, well done. I put one of my FPSC rooms through the lightmapper and it is taking some time...I have attached the DBO of this room here. If you can lightmap it with a single white light, that would be something pretty cool. Lightmapping is a swine to get 'fast', and handling entire levels worth of geometry is no easy task. Good luck with your experiments - nice to see!

"Small, smart, and running around the legs of dinosaurs to find enough food to survive, bedroom programmers aren't extinct after all "

Attachments

Login to view attachments
EVOLVED0
19
Years of Service
User Offline
Joined: 1st Mar 2005
Location: UK
Posted: 24th Feb 2006 01:39 Edited at: 24th Feb 2006 01:44
yeh , I see what you mean lee. But its really not designed for single meshes atm. Its more or less direct code from a dbc editor(heance the messey code) which im still working on that uses single object geometry. so its prettey much designed for basic (single boxes,cylinder,wedges etc) objects that get use in mapeditors and not a single map object geometry, but it should work with any low poly models(well sort of). I`ll try getting it working with collapsed meshes when I can be bothered and heve the time .

[edit]
Im stund at how many polys that map is , Iv never used fpsc befor but it dose have its own lightmapper right ?
tatts
18
Years of Service
User Offline
Joined: 13th Jan 2006
Location: Ontario,Canada
Posted: 24th Feb 2006 02:03
I keep getting an error could not understand command at line 24 (setup_data( 2 , 1 ) as if the compiler was not even reading the dll.
I put the two dll's into the right folder plugins user, but with all the examples I keep getting the same error. :S

any advice?
EVOLVED0
19
Years of Service
User Offline
Joined: 1st Mar 2005
Location: UK
Posted: 24th Feb 2006 02:35
include the "LightMapping Function.dba" in the files tab ( on the right panal )
tatts
18
Years of Service
User Offline
Joined: 13th Jan 2006
Location: Ontario,Canada
Posted: 24th Feb 2006 03:32
Oops! that would help thanks
Oddmind
20
Years of Service
User Offline
Joined: 20th Jun 2004
Location: Atlanta, Georgia
Posted: 3rd Mar 2006 00:15 Edited at: 3rd Mar 2006 00:16
wow im quite impressed! Im having a bit of trouble with the save function, ill tweak it around a bit and see what works best. It seems as though its making a dupe of the object and putting one on top of the other because im geting artifacts and stuff.

formerly KrazyJimmy
EVOLVED0
19
Years of Service
User Offline
Joined: 1st Mar 2005
Location: UK
Posted: 3rd Mar 2006 01:12 Edited at: 3rd Mar 2006 01:15
eh yeh, I forgot to set object light to 0

so the load functions should be like this:


[Edit]
im also working on improving the code a lot as I got my editor runing a dbp exe for the light map calculation.( cheack out my editor here >> http://www.projectevolution.vector3r.com/)
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 3rd Mar 2006 22:16
@EVOLVED - you might be able to speed it up a bit by using 'setupComplexObject' instead of 'setupObject'

This looks really good, well done!

EVOLVED0
19
Years of Service
User Offline
Joined: 1st Mar 2005
Location: UK
Posted: 4th Mar 2006 02:23
Thx Sparky, Iv tried it but it dosent seem to make much of a difference . Your collision dll is awesome btw

Iv just found out that the code doesnt work U6 , well iv fixed that and added a border option(it make the calculation processes a lot longer tho), I`ll upload the new code tomorrow.

http://www.vector3r.com/3D_Shaders.htm - free dbp shaders
EVOLVED0
19
Years of Service
User Offline
Joined: 1st Mar 2005
Location: UK
Posted: 4th Mar 2006 20:34
Iv uploaded a newer version. it should now work in U6(beta2).

http://www.vector3r.com/Code/Light%20Map%20Calculation/Download.htm

http://www.vector3r.com/3D_Shaders.htm - free dbp shaders
Freddix
AGK Developer
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 4th Mar 2006 22:56 Edited at: 4th Mar 2006 22:59
when I try to compile the .x sample I get an error message pointing to that line telling that the command is unknown :

Quote: "DarkSide_Set_Progress_Bar_Title "Lightmap Progress""


Same problem with other samples

??

All we have to decide is what to do with the time that is given to us.
EVOLVED0
19
Years of Service
User Offline
Joined: 1st Mar 2005
Location: UK
Posted: 4th Mar 2006 23:03
have you got the "DarkSideProgressBar.dll" in your "Compiler/plugins-user" folder ?

http://www.vector3r.com/3D_Shaders.htm - free dbp shaders
Freddix
AGK Developer
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 4th Mar 2006 23:19 Edited at: 4th Mar 2006 23:24
no
just added it in

I didn't see the parent folder with dlls

All we have to decide is what to do with the time that is given to us.
FoxBlitzz
21
Years of Service
User Offline
Joined: 19th Nov 2003
Location: United States
Posted: 5th Mar 2006 07:43
I get this error:

"Could not understand command at line 21."

AMD Athlon 64 X2 4200+
1GB DDR-SDRAM (May increase to 2GB one day)
512MB ATI Radeon X1800 Series - Finally! A card that does pixel shaders correctly!
Chris Franklin
19
Years of Service
User Offline
Joined: 2nd Aug 2005
Location: UK
Posted: 5th Mar 2006 12:19
sweet thanks

Login to post a reply

Server time is: 2024-11-24 06:24:14
Your offset time is: 2024-11-24 06:24:14