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 / Use lights with set bump mapping on?

Author
Message
wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 13th Jun 2012 22:30
This question has been asked already around the forum, and for the most part the answer was that dbpro's bump mapping command was broken. However, these threads are years old, and since the set bump mapping command now works I thought it would be worth asking again.

I played around with Evolved's normal mapping shader and was pleased with the results I got, but the specular lighting just looks so much more like what I want with the native bump map command.
Take a look at the screenshots, left is with Evolved's, right is native dbp.


I've read that bump mapped objects respond only to light 0, but that hasn't worked for me either.

http://mattsmith.carbonmade.com/
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 13th Jun 2012 23:39 Edited at: 13th Jun 2012 23:40
To me, this shader (I think it's a Green Gandalf shader) looks like it is a bit of both. Try it... DOWNLOAD...

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 13th Jun 2012 23:47
This looks fantastic, thanks I'll give it a go!

Still interested in whether or not the native command works with lights though if anyone knows.

http://mattsmith.carbonmade.com/
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th Jun 2012 03:25
Quote: "(I think it's a Green Gandalf shader)"


I'm fairly sure it was one of Evolved's modified by Revenant Chaos not me.


Quote: "This looks fantastic"


It certainly does.
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 15th Jun 2012 12:22
wow, this got me thinking about using shaders sooner than later...

Very nice indeed!!!

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 16th Jun 2012 20:11
Quote: "wow, this got me thinking about using shaders sooner than later..."

Not sure if this is a good one to use though, I'm getting pretty low frame rates with just 4 walls.

http://mattsmith.carbonmade.com/
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 16th Jun 2012 21:03 Edited at: 16th Jun 2012 21:05
Quote: "Not sure if this is a good one to use though, I'm getting pretty low frame rates with just 4 walls."


4 plains, 4 boxes, or 4 of your high poly walls?

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 16th Jun 2012 21:41
Well technically it's 10 plains, but just plains.
And a medium poly hand clutching a sword.
I'm as about as sure as I can be that it's the shader though, as it goes pretty fast in windowed mode, but gets slower and slower as I up the resolution.

http://mattsmith.carbonmade.com/
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 16th Jun 2012 22:05 Edited at: 16th Jun 2012 22:09
What are you putting the resolution at? I never go higher than 1024*768. Your textures should be 1024*1024, and repeat the brick layout as much as possible. Maybe 6 brick layouts. Whatever you do try to keep everything to a minimum. It's possible to alternate 10 512*512 brick layouts if you divide the walls into 4 parts.

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 16th Jun 2012 22:26 Edited at: 16th Jun 2012 22:29
I had the resolution at 1366x768, but even at 800x600 theres a drop in performance.

I just cut the textures to 64x64 and performance didn't improve, it's got to be the shader.

edit
It still looks fine if I up the camera movement and object speed, but I'm concerned that if I ever finish anything and someone with a faster system runs it, it would look like they were playing as the flash.
My pc's pretty decent, but there's always a better one.

http://mattsmith.carbonmade.com/
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 17th Jun 2012 01:36 Edited at: 17th Jun 2012 01:39
You use timer() to control the speed of the game. I have 8 year old games that still run at the same speed as before. Shame that it's slow, I was using it in a project as well. I tested it with only two plains though. I had fog, and 16 sphere, and alpha transparency, it was fast.

MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 17th Jun 2012 04:19
Quote: "1366x768,"


this told me right away that you are not using a GPU... but on a laptop however I could be wrong...

maybe thats the issue? are you using a netbook?

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 17th Jun 2012 19:57
Quote: "this told me right away that you are not using a GPU"

I'm not quite sure what you mean by that?
If you're asking about my system specs I'm working on a bottlenecked laptop, cpu @ 2.2 ghz, 4 gb ram, geforce gt 230m with 2.7 gb vram.

If that's not what you're asking, I have no idea what you're talking about.

http://mattsmith.carbonmade.com/
wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 17th Jun 2012 22:34
Would it be worth it to contact one of the devs about the set bump mapping on command? I'd still really like to use it if I could figure out how to use lights with it.

http://mattsmith.carbonmade.com/
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 17th Jun 2012 22:52 Edited at: 17th Jun 2012 22:56
Yes bump mapping works with lights. I just remembered that I used it for a planet, and the sun shone on the planet in the right position. I textured the planet with a PNG normal map first, it looked good.




wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 17th Jun 2012 22:58
Quote: "Yes bump mapping works with lights. I just remembered that I used it for a planet, and the sun shone on the planet in the right position. I textured the planet with a PNG normal map first, it looked good."

Really? I've tried making a light, using light 0, ambient light, setting the light position to the camera coords, etc but I haven't been able to see any difference. Do you have any example code or anything??

http://mattsmith.carbonmade.com/
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 17th Jun 2012 23:04
I just did it the easy way...



wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 17th Jun 2012 23:12
I meant with the lights. Here's what I've been trying:


Lighting only works on the box that isn't bump mapped.

http://mattsmith.carbonmade.com/
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 17th Jun 2012 23:30 Edited at: 17th Jun 2012 23:31
I have this at the beginning of the program...

set ambient light 100
set normalization on
set spot light 0,30,170
set light range 0,7000
Position light 0,sunx,suny,sunz
point light 0,0,0,0
color light 0,255,255,255

That however is planet sized lighting.

Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 17th Jun 2012 23:41
Quote: "Quote: "wow, this got me thinking about using shaders sooner than later..."
Not sure if this is a good one to use though, I'm getting pretty low frame rates with just 4 walls."

its more about programming actually.
by making your own engine with own object rules, you are able to work with those high quality bump mapping with high fps!
its about your game engine

Advanced Updater for your games!
wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 17th Jun 2012 23:45 Edited at: 17th Jun 2012 23:48
Well I don't understand why it won't work for me. Lighting only works if I rem set bump mapping on.


Quote: "by making your own engine with own object rules, you are able to work with those high quality bump mapping with high fps!
its about your game engine"

Yeah, well I'm working with dark basic. I don't know why you'd suggest that I code my own engine from scratch.

http://mattsmith.carbonmade.com/
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 17th Jun 2012 23:56
Quote: "Well I don't understand why it won't work for me. Lighting only works if I rem set bump mapping on."


How are you creating your Normal Map? I'm just wondering if you are trying to use a Greyscale map, because bump mapping used to be greyscale. Now it's more like Lime Green, and purple, and you create it with special programs.

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 18th Jun 2012 00:03 Edited at: 18th Jun 2012 00:07
I've been using the crazybump demo, it shouldn't be a problem..
Here's the diffuse and normal texture's I've been using if you'd like to give it a try.

Oh yeah, I'm planning on shrinking them once I get them working, so don't give me a hard time about the size.

http://mattsmith.carbonmade.com/
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 18th Jun 2012 00:18
But in your first post you say...

Right is Native Bump Mapping...

... and it has a light on it.


Anyway I just tested your download, and I get the same white light, so that's working.

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 18th Jun 2012 00:25
Quote: "Right is Native Bump Mapping...

... and it has a light on it."


That's exactly what I don't understand. The bump mapped objects appear to be reacting to some kind of light, but no matter what light I move or where I move it, it doesn't have any effect.

In the shader you provided, I can set the light to the camera coords and watch the objects react to the light as I walk around the map. With the native command, it doesn't matter if I set a light or not, it always looks the same.
It's almost as if the surface of every bump mapped object has been given it's own light.

http://mattsmith.carbonmade.com/
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 18th Jun 2012 00:48 Edited at: 18th Jun 2012 00:56
Quote: "The bump mapped objects appear to be reacting to some kind of light, but no matter what light I move or where I move it, it doesn't have any effect."


Try this Download....

Although I couldn't get the light to change colour, or intensity. You can see in my code that the light should be dark red, but is bright white.

It could be because of the jpg, maybe a PNG works better?

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 18th Jun 2012 01:06
So it seems to only works with spot lights I guess?
Thanks for that, I'm surprised to see it working.

Another thing that doesn't seem quite right in addition to the color though, the light just seems to be changing the specularity and not the diffuse texture. Hmm.

http://mattsmith.carbonmade.com/
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 18th Jun 2012 01:09
Could be the jpg though, as you might need alpha transparency like PNG.

Olby
22
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 18th Jun 2012 11:18
As far as I know behind the scenes set bump mapping actually uses the .fx file located in "compiler\effects\bump.fx" so if you don't like the way it shines just adjust it's code. Or better yet replace it completely with one of the Evolved's shaders. Just make sure you use the same variables and texture layers.


Intel Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, Windows Vista Ultimate SP2, PureBasic 4.61 + DarkGDK 2.0
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Jun 2012 14:32
Quote: "As far as I know behind the scenes set bump mapping actually uses the .fx file located in "compiler\effects\bump.fx" so if you don't like the way it shines just adjust it's code. Or better yet replace it completely with one of the Evolved's shaders. Just make sure you use the same variables and texture layers."


Thanks! Why on earth didn't I think of that?

Works beautifully.
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 18th Jun 2012 14:49 Edited at: 18th Jun 2012 14:51
Hmm sharing a game with the same fx file might be tricky. I suppose the exe will have to be used every time.

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 20th Jun 2012 21:06
Quote: "Just make sure you use the same variables and texture layers."

Just want to say, although I have no idea how to do something like this, I think it's an awesome idea.

http://mattsmith.carbonmade.com/
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 20th Jun 2012 21:52
Quote: "Just want to say, although I have no idea how to do something like this, I think it's an awesome idea."


Change the name .fx to .txt. Then you can open it in notepad, and edit it. Then change the name back to .fx.

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 21st Jun 2012 02:57
I mean I wouldn't know how to change the shader code to work right by just typing the normal set bump mapping on command.

http://mattsmith.carbonmade.com/
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 21st Jun 2012 08:39 Edited at: 21st Jun 2012 08:40
Quote: "I mean I wouldn't know how to change the shader code to work right by just typing the normal set bump mapping on command."


That's what my example does. Change bump.fx to bump.txt, then edit it, then change it back to bump.fx. Then the normal bump mapping command will be altered. But only on your computer, and only the exe will work on other computers. So posting code snippets will not be exactly the same.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 21st Jun 2012 14:34
Quote: "Change bump.fx to bump.txt"


Why? Just open it with NotePad - i.e. right-click, open with, etc.
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 21st Jun 2012 15:26 Edited at: 21st Jun 2012 15:28
Quote: "Why? Just open it with NotePad - i.e. right-click, open with, etc. "


I never thought of that. Now that you've told me, I'll pass it on to my brain.

Login to post a reply

Server time is: 2026-07-07 15:10:54
Your offset time is: 2026-07-07 15:10:54