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
Essence
22
Years of Service
User Offline
Joined: 12th Oct 2002
Location: The Netherlands
Posted: 5th Mar 2006 18:38
When im using a map file (.x) with textures, and use this lightmap function, i'm losing all the textures.
So my guess is that multiple textures on one object doesnt work ?

Freddix
AGK Developer
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 5th Mar 2006 18:52
@EVOLVED :
Is there a way to change which images will be used for each lightmapping ?

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: 5th Mar 2006 20:22 Edited at: 6th Mar 2006 02:37
@Essence
Its not designed for that(single level object geometry), it for multiple map objects. And your losing textures cus the object gets remade(iv changed this and it now uses "chang mesh ob,lm,msh" but that in effect dose the same thing). Theres no "get object texture" command so I dont know what texture your object is useing, so you got to re texture them.


@Freddix
Duno what your after but when you call the "Generate_LightMap" function the first value is the image your starting from.



http://www.vector3r.com/3D_Shaders.htm - free dbp shaders
FoxBlitzz
21
Years of Service
User Offline
Joined: 19th Nov 2003
Location: United States
Posted: 5th Mar 2006 21:32
Did you ignore my post on purpose, EVOLVED?

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!
Essence
22
Years of Service
User Offline
Joined: 12th Oct 2002
Location: The Netherlands
Posted: 5th Mar 2006 21:41 Edited at: 5th Mar 2006 21:44
@Evolved: There is a ( limb texture name$() ) command

@FoxBlitzz: If you read this thread completly, you can see the solution of the so many times that you can build a house with the same number of bricks as the solution has been said...

You need sparky's dll and include the file thats on top of the page. (doh )

Freddix
AGK Developer
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 5th Mar 2006 22:16
@Evolved : ok, thanks. it was just to be sure it worked this way

All we have to decide is what to do with the time that is given to us.
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 6th Mar 2006 01:50
no shadows appear when i run it...

...
EVOLVED0
19
Years of Service
User Offline
Joined: 1st Mar 2005
Location: UK
Posted: 6th Mar 2006 02:33 Edited at: 6th Mar 2006 02:38
@FoxBlitzz
soz, I didnt see your post. you have to include the "LightMapping Function.dba" in the files tab(bottom right) .

@Essence
good point (limb texture name$() dose work).

@benny53
is the "shadows" flag set to one when you call the "LightMap_Properties( texsiz, resolution, blur, shadows, AmbR, AmbG, AmbB )" function? tike this LightMap_Properties(256,3,2, 1 ,40,40,40 )

http://www.vector3r.com/3D_Shaders.htm - free dbp shaders
Essence
22
Years of Service
User Offline
Joined: 12th Oct 2002
Location: The Netherlands
Posted: 6th Mar 2006 11:49
If you can actually make a optional flag for the function to use multi-textured object, that would be great

Oolite
19
Years of Service
User Offline
Joined: 28th Sep 2005
Location: Middle of the West
Posted: 6th Mar 2006 15:28
This is really nice!

I applaud you!

<img src="http://i36.photobucket.com/albums/e33/Oolite/th_MainLogo.jpg">
Olby
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 6th Mar 2006 21:55
great stuff... now this is really hardcoded stuff

"Gangsters die, they don't go to heaven where angels fly!"
AMD Sempron 3.1+ Ghz, 512MB Ram, ATI R9550 256MB Ram, Sound Blaster Live!, WinXP SP2, DirectX 9.0c
FoxBlitzz
21
Years of Service
User Offline
Joined: 19th Nov 2003
Location: United States
Posted: 6th Mar 2006 23:10 Edited at: 6th Mar 2006 23:14
Quote: "@FoxBlitzz: If you read this thread completly, you can see the solution of the so many times that you can build a house with the same number of bricks as the solution has been said..."


As a matter of fact, yes I DO have Sparky's collision installed, and I HAVE read the previous posts on the problem. I'm not blind. At least EVOLVED was helpful and gave me the correct solution to the problem.

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!
Takis76
19
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 7th Mar 2006 22:14
I download all Lighmapping examples and In my computer
does not appeared as well.

Appeared without mapping only in white color.


What is the problem?

I have DirectX 9.0c
And my Graphics Card is GeForce XF 6600.


Which version of DarkBasic Should I must have?
Essence
22
Years of Service
User Offline
Joined: 12th Oct 2002
Location: The Netherlands
Posted: 7th Mar 2006 22:26
Oolite
19
Years of Service
User Offline
Joined: 28th Sep 2005
Location: Middle of the West
Posted: 9th Mar 2006 13:45
too bad this doesn't compile with 6

Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 11th Mar 2006 04:51
alright.well,it makes a wierd looking texture with all sorts of colors. i think somethings wrong

...
FoxBlitzz
21
Years of Service
User Offline
Joined: 19th Nov 2003
Location: United States
Posted: 11th Mar 2006 08:52
It does compile with U6. You have to tell it to include the extra .dba file included in the .zip for it to compile.

And if you're getting odd looking results, then either your version of DBPro is out of date or your video card sucks.

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!
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 11th Mar 2006 17:30
hah.i think its my video card then.me and my friend did a search on it and it really does suck. nvidia riva tnt2 model 64. it sucks horribly.

...
EVOLVED0
19
Years of Service
User Offline
Joined: 1st Mar 2005
Location: UK
Posted: 31st Mar 2006 18:19 Edited at: 31st Mar 2006 18:27
ok,
Iv gone back to finishing this thing off, and is there any thing you want me to improve on ? .

Iv add some new code and it now should cope better(faster) with complex objects.

get the new code here>>
http://www.vector3r.com/Code/Snippets/LightMapCalculation/LightMapper2.zip

Heres the plan so far:
* improvements
* get it working with limbs.
* re-look in to transparency effects(alpah masks).
* add a flag for the blended texture stage index.
* add a flag for extra objects+ghost.

Its a bit late to answer the above questions but meh!

@benny53
yeh, your card needs to do blendmapping, I will add a extra flag on the next release to make extra objects+ghost~(like when you load up cshop maps).

@Oolite
should now compile with U6

soz Bringing up an old thread
Oolite
19
Years of Service
User Offline
Joined: 28th Sep 2005
Location: Middle of the West
Posted: 31st Mar 2006 23:02
Cool, i'll give it a try tomorrow, been oblivion'ing for too long and i need sleep!

i look forward to it!

Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 1st Apr 2006 09:38
Don't think you have to worry about bumping a thread like this. It really is amazing work.

M.I.A is pending
Chris Franklin
19
Years of Service
User Offline
Joined: 2nd Aug 2005
Location: UK
Posted: 1st Apr 2006 10:11
ditto baggers

Chenak
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 1st Apr 2006 15:35
This is fantastic cheers!

Got a few ideas. Add the ability to spread the lightmap automatically across many lightmaps so the resolution is still nice when lightmapping a large object.

btw Modified the code work on the latest u6 release If you can't get the lightmap functions to work with u6 then just replace it with this.

Brendy boy
19
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 3rd Apr 2006 17:38
Can you make it work with bump.fx effect from fps creator?
Is there a way to apply lightmap without using set blend mapping on command?

Brendy boy
EVOLVED0
19
Years of Service
User Offline
Joined: 1st Mar 2005
Location: UK
Posted: 4th Apr 2006 09:36
ok,

looks like I wont be able to get it working with lmbs after all , unless any one knows of a way of making a mesh from an objects limb ?

@Chenak
I think I know what you mean , but that would mean splitting the object up in to 2 some how !, are pelople still having problems compiling this under U6 ? it should work im using U6 RC3 atm(soon to RC4) and what part of the code did you change ??

@Brendy boy
Iv now changed it (its not up loaded yet!), so now you can change the internal properties. so you can chang the properties to what you need,

e.g


On to the "bump.fx" I'll come up with my on normal mapping.fx. It doesnt look to hard , just a cases of turning a heightmap(second lightmap texture that dosent have any colours!) in to a RGB map(NOT A NORMAL MAP!). so what you end up with is (Texture)*(RGB lightmap map).(normal map)*(colour lightmap). Simple eh!
Freddix
AGK Developer
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 4th Apr 2006 11:09 Edited at: 4th Apr 2006 11:10
simply using this :



You have to create a new object from a limb of another object
and then create the mesh from the new freshly created object

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 Apr 2006 11:35 Edited at: 4th Apr 2006 21:37
Did not see that command (its under "CONSTRUCTION COMMANDS" lol ) , thx fred!

[Edit]

Ok, its working with limbs now , just working on a demo useing it , Iv scraped the RGB texturemaps as the normalmap shadows end up looking rong on rotated objects.
Chenak
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 4th Apr 2006 14:38
I just changed some of the variable declarations, they didn't compile for me for some reason. It was the variables ending in a _ that was messing it up. No idea if anyone else had the same problem
Gil Galvanti
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Texas, United States
Posted: 5th Apr 2006 03:44
erm...i cant get it to work . do I put the functions at the end of the examples?

Pirates of Port Royale
Live the life of a pirate.
Essence
22
Years of Service
User Offline
Joined: 12th Oct 2002
Location: The Netherlands
Posted: 5th Apr 2006 11:18
Quote: "Ok, its working with limbs now , just working on a demo useing it "


OMFG... can't wait =D

EVOLVED0
19
Years of Service
User Offline
Joined: 1st Mar 2005
Location: UK
Posted: 5th Apr 2006 12:25 Edited at: 20th Jun 2006 20:47
ok, updated to the new version and should now work with limbs.

file>>
EDIT

Im now touching up the code and improving on it!
EVOLVED0
19
Years of Service
User Offline
Joined: 1st Mar 2005
Location: UK
Posted: 7th Apr 2006 15:58 Edited at: 20th Jun 2006 20:47
Added new code

Changes
Functions names have changed (see help index)
now uses V2 of Sparkys Collision dll

New commands:


Download >>
EDIT
Chris Franklin
19
Years of Service
User Offline
Joined: 2nd Aug 2005
Location: UK
Posted: 7th Apr 2006 18:06
Hey evolved mind if i use this for a commercial app?

Theme park simulator wip

EVOLVED0
19
Years of Service
User Offline
Joined: 1st Mar 2005
Location: UK
Posted: 7th Apr 2006 21:32 Edited at: 7th Apr 2006 21:34
Dont see why not!

Fixed a bug btw, Getting odd results on cone objecs should be fixed.
Xander
21
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 8th Apr 2006 07:02
I've got a question on lightmaps...sorry if this is really stupid, but I have never worked with lightmaps or shadowmaps before.

So will this program import an object with textures, then add shadows to it by means of a light, then edit the texture so that when you load the object into your game is looks like it has a light on it and looks really nice?

Xander Moser - Bolt Software - Firewall
EVOLVED
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: unknown
Posted: 11th Apr 2006 00:32
Got my old account back

@Bolt
Yeh, It justs adds static lights to your worlds. What is dose is just saves light data in to texture space. Then applys it to the object that has set uv data thats to the correct position to the light in texture space. if your useing loaded objects you may have to re-texture them tho.
Xander
21
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 18th Apr 2006 01:09 Edited at: 18th Apr 2006 05:47
Cool, thanks for answering my question. I'm going to try this out on my models for my game, see how it works. If I can get it to work they are going to look awesome

Xander Moser - Bolt Software - Firewall
Unjust1
20
Years of Service
User Offline
Joined: 22nd Oct 2004
Location: Missouri
Posted: 19th Apr 2006 02:45
Is something broken in the code? I am using U6RC10 and I keep getting something about a subscript needs to be integer or DWORD when referencing an array.

Brendy boy
19
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 19th Apr 2006 15:57
bump.fx still doesn't work with your lightmapping.

Brendy boy
Unjust1
20
Years of Service
User Offline
Joined: 22nd Oct 2004
Location: Missouri
Posted: 20th Apr 2006 04:15
I figured it out. Needed to get rid of collision.dll Now it works fine. If I can just figure out how to keep my diffuse color channel, and get it to save a file for fast loading.

Xander
21
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 20th Apr 2006 08:17
I am wondering if it is possible to create pre-rendered shadows with this. I was playing around with it and am not sure if I will be able to accomplish what I want to do.

I have an .x object that I load in along with the box that it sits on. What I want is a shadow to be generated for a lightmap...I don't want the light source shining on the box, only a shadow to be drawn. So, basically, I want a directional light. Can the lightmapper handle directional lights?

Also, one more thing, it appears that the .x objects are scaled down as soon as you generate the lightmap, making it screw up...why does it do this?

Xander Moser - Bolt Software - Firewall
EVOLVED
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: unknown
Posted: 21st Apr 2006 17:34
Should now work with RC10 (hopefully).

@Xander

It dosent support directional lights but it shouldent be to hard to add in.
Doctor Duddits
19
Years of Service
User Offline
Joined: 9th Feb 2005
Location:
Posted: 25th Apr 2006 15:43
Pretty nice! Perfect!

I see you...I think...with me anything is possible...and you can do anything with me...its time to...do anything...
Xander
21
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 25th Apr 2006 22:44
Well, I got the effect I wanted using a point light far enough away.

I am having some troubles though, certain objects cause the program to go haywire. When you attemp to calculate a lightmap, the progress bar just goes to the end and starts over continuously. It never stops. I will force quit the program, use a different model, and it works fine. I even re-exported the model to see if it worked then, no luck. I can give you the models if you want. They're only 300 to 400 polys.

Xander Moser - Bolt Software - Firewall
EVOLVED
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: unknown
Posted: 26th Apr 2006 05:43
Xander can you post the object ? I might be able to fix it then
Xander
21
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 30th Apr 2006 11:39 Edited at: 1st May 2006 02:40
Gosh, this thread doesn't update and turn back to blue after you post on it, otherwise I would have gotten back to you sooner!

Okay, here is a modified version of your .x viewer, use the mouse to move the camera. I have included 3 of my objects. Just change the name of the .x object loaded to switch between them... But there is a new problem...every time I hit space bar to create the lightmap it crashes the program with one of those "send error" windows messages. Just please don't use my 3 models or textures, I spent a lot of time on those, they are for my new project, I trust you

Xander Moser - Bolt Software - Firewall

Attachments

Login to view attachments
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 30th Apr 2006 12:13
This is pretty cool. I had to modify it just a bit to work with Blue IDE (it doesn't like variables that end in _ sometimes). Great Job.

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 30th Apr 2006 13:19
@EVOLVED0

Is there a good reason why you didn't include (!) the following line at the start of your example .dba files?



Took me a while to realise that was the problem. However, having done that, nice work - may well use your code. Thanks.
EVOLVED
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: unknown
Posted: 30th Apr 2006 13:59
@Xander

Yeh, it doesnt show up as a new post cus I havent posted on this account befor (its my old one). So I have to go through the whole "new to the forum" thing. Any way this seem to be a DBP bug with "change object mesh"! thats whats causing the crashes. If the progress bar goes to the end and then starts over again it should exit the calculation (looks like I need to fix this up a bit). This is cus the light map texture cant fit on to the object, so you must lower the resolution or increase the texture size to 512.

I wont use your object , you should ask a mod to delete your post.

@Green Gandalf

the #include command never works for me in dbp(or have they fixed this ?)...
Xander
21
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 1st May 2006 02:35 Edited at: 1st May 2006 03:17
Okay, so it's not a forum bug then...

I don't like the change object mesh command...have you tried change limb mesh and just use limb 0? It might work, it's worth a shot anyway if you haven't tried it yet.

Okay, at least I know to change the resolution or texture size if I have that problem again, thanks!

@ Any Mod: Could you delete my attachment on my previous post? Thanks!

[edit] Thanks Mike!

Xander Moser - Bolt Software - Firewall

Login to post a reply

Server time is: 2024-11-23 07:10:34
Your offset time is: 2024-11-23 07:10:34