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 / My ignorance to shaders!

Author
Message
LightningSky
16
Years of Service
User Offline
Joined: 22nd Feb 2010
Location:
Posted: 9th Jun 2010 05:15
Well, I'm trying to create a planet with a bump map. I use NVIDIA's tool to create the bump map, use the SET BUMP MAPPING ON with the object, and find out that not only does the object not reflect any "bumping" but now the whole object is lighted. Search through the forums find out I should be using shaders FX commands for this. So, I download the Ultimate Shader Pack and dive into playing around with it. My problem is, with the BumpMapping.FX effect when I set the light color, light range, and light position along with setting the two textures that I need to get the bump map effect it works. HOWEVER, when I rotate the planet the light rotates with it. I have set a light vector to a fixed position in space, however once the light is applied to the object, the lighted side of the object starts to rotate. For whatever reason it's not acting like I have a stationary light source. I know I'm doing something wrong, but I just don't know what that something is.



The more I learn, the more I realize I still need to learn. I greatly appreciate anyones assistance on this. Forgive me if this is the wrong channel for such a post.

Thanks in advance!

- A man from nowhere, prophesized to fail, blazed beyond the brightest of them all.
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 9th Jun 2010 10:53
I'm not an expert on shaders mate, but I think you've answered your own question.

You say the light source appears to rotate with the object? In which case I would guess that the sunlightvector effect constant needs to be updated every loop. DBP probably doesn't know which shader variables to update itself, since shaders could do any of a hundred things, so internally, the DBP won't know what variable does what, and won't change that vector. It is probably a vector representing a local rotation, so rotating the object won't change how it receives light.

All guess work, but I would try updating that constant and reapplying the effect each loop. If that doesn't affect FPS, then you have your solution. If it does, then back to the drawing board!

Radical hamsters skipping furiously into the blue ether, questioning their very existence while breathing out the bitter fog of smoked haddock.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 9th Jun 2010 14:24
I don't think you are doing anything wrong - there's a fault in the shader. I assume you are using this one from EVOLVED:



I'm sure EVOLVED has fixed that issue in his more recent shaders which you can download from his site http://www.evolved-software.com/shaders/advlighting.html (although it seems that some of the links on his site don't work properly any more ).

If you're still stuck I'll see if I can fix the code later today - the fix should be straightforward.
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 9th Jun 2010 18:15 Edited at: 9th Jun 2010 18:16
Also, if you want to try the non-shader commands again try this.

SET BLEND MAPPING ON Obj, 0, BumpImg, 3, 24

With no other textures applied, that should give you a nice bump mapping.

However, it does look a lot better with the shader from Evolved. I have one for planets that Green Gandalf and I have modified a bit here and there. Keep the questions coming if you need more help.

It's hard to see the surface on this planet, I think because there are 2 other semi transparent spheres between the camera and the planet surface, but the clouds use the same shader, and you can see their bump pretty clearly.


LightningSky
16
Years of Service
User Offline
Joined: 22nd Feb 2010
Location:
Posted: 9th Jun 2010 19:39
Hey thanks eveyrone for answering so quickly. I'll give it a try when I get home tonight.

Fallout, I did originally have the set effect commands within the main loop, but they seemed to have no effect on the image. If there is an issue with the shader then maybe that's the reason. Althought I'm rather much more inclined to say it's an issue with me rather than the code

Gandalf, thanks m8. That is exactly the shader I am trying to use. I'll download the latest shader and give it a go.

I also noticed something as well. In the forums it's stated not to use a grey scale image for bump mapping (as well as in the DB documenation), however, when I took what NVIDIA's tool created (which was blue scaled) and grey scaled it, the "bumping" appearance looked alot sharper, more present.

KISTech, I'll try that command as well, thank you. I would like to see the basic statements work, or I mean I'd like to understand why I can't get them to work. But if the shaders are the way to go then I'd rather focus on what makes the best product.

Again, thank you very much everyone for this assistance.

- A man from nowhere, prophesized to fail, blazed beyond the brightest of them all.
LightningSky
16
Years of Service
User Offline
Joined: 22nd Feb 2010
Location:
Posted: 11th Jun 2010 02:13
KISTech, I tried the blending command but the light stays messed up. The object ignores the scene lights when I use either the BUMP command or the BLENDING command.

Gandalf, I download the new shaders from EVOLVE sites. Do I have to include that program "AdvancedLighting..." in my program in order to use any of the shaders? Is there documentation on any of the shaders? There are alot of examples, but I'm fuzzy on a lot of what I'm looking at. I guess time and study will get me there.

I also purchased DARKSHADER but haven't played with it. I'm digging into that as well now.

If there is any valuable documentation or books out there that would help my in my studies of shaders and how to use them, I'd love to know what they are.

- A man from nowhere, prophesized to fail, blazed beyond the brightest of them all.
LightningSky
16
Years of Service
User Offline
Joined: 22nd Feb 2010
Location:
Posted: 11th Jun 2010 07:52
Unfortunately my ignorance is getting the better of me. I'm really trying hard to understand what EVOLVE is doing with his shaders but I am at a loss. There is zero documentation on his AdvancedLighting stuff, and I guess I don't understand why the regular commands with DBPRO don't work.

Would someone be kind enough to layout a simple code example that would use either the shader package or the straight DBPRO commands on how to apply a bump map and then light it properly? I'm not asking for someone to write my game for me, I just need something that will give me that "AH HA,now I get it.." feeling with these shaders, or with the DBPRO commands.

Thanks in advance!

- A man from nowhere, prophesized to fail, blazed beyond the brightest of them all.

Login to post a reply

Server time is: 2026-07-25 16:22:04
Your offset time is: 2026-07-25 16:22:04