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 / need a shader. normals.

Author
Message
Ermes
23
Years of Service
User Offline
Joined: 27th May 2003
Location: ITALIA
Posted: 5th Feb 2011 19:06 Edited at: 5th Feb 2011 19:21
hi, please help me.

in all this pile of shaders/junk.....

where i can find a basic normal shader??? no reflection, no crappy idiot things inside, only normal and a vector for the light direction.

thanks. Ermes.


Ciao facce da sedere!
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Ermes
23
Years of Service
User Offline
Joined: 27th May 2003
Location: ITALIA
Posted: 5th Feb 2011 19:19 Edited at: 5th Feb 2011 20:05
great.

but there is a thing "normal" is these example, you need a tutorial to understand the tutorial!!!

too much know how.... oh why why why.....

i know i'm zero with shaders, but really i can't find a point to start. MAKE IT EASY !!!!!

just a shader, two images, an object, a light direction.

no... grounds, matrix4, vector multiply, ecc ecc ecc

complaining complaining complaining.....


Ciao facce da sedere!
Ermes
23
Years of Service
User Offline
Joined: 27th May 2003
Location: ITALIA
Posted: 6th Feb 2011 00:51 Edited at: 6th Feb 2011 00:54
there must be something incredible hard betweem me and shaders.

in my life, only one has worked. but yes, a lot of examples (for nothing understandable) the all worked making my mind wondering.

now i'm going to try to simply use a normal map shader.

i've the object, i've the diffuse, i've the normal map.

with a simple example, i changed the texture of the example, ok good. really not, example are often too much flaunty, they are always top end of what you can do.

used the .fx file, copyed the example, used the vector4 for the light direction, and tada! the object is totally black. about the 50th attemp.

i'm the maker of ESF... i'm not so green, but shaders make me sick. hopelessy sick. some built in shaders with some flag to trim? no no no, too easy. i've dark shaders, used the normal shader, it says it need lights. but what lights damn the hell! the lights of my car? the lights of this lamp outside the window?

as ever, read a tutorial, need to read another tutorial on how use the previous tutorial, find the magic key under the stone near the dragon nest, then go to the magic forum when you learn how to fly on a broom, how to pass north cape with a dinghy but not how to use a simple shader, read tons of example writted in an incredible code (maybe a little more basic will be better for everyone, examples are for people who haven't understand how it work,not for an "A" on your report.) and again here, to try to use a simple, normal shader. hopeles.

again.... a simple normal shader with only diffuse and normal, plus a vector for light direction. and i think these shaders must be DBPRO builted in.


Ciao facce da sedere!
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 6th Feb 2011 01:39
oh... if i knew this much frustration you will get i would have never given you the advice of looking into them sorry

Always everybody's reaction to a graphical problem is "use shaders", as it was that simple.
Ermes
23
Years of Service
User Offline
Joined: 27th May 2003
Location: ITALIA
Posted: 6th Feb 2011 01:57
well, managed to do something.

no worry Quel, i was fighting with shaders since long time ago.

i found shaders unhandly for games, yes good effects but the most of the times only for showcase.

now i've a bump mapping working, but i say goodbye to hardware lights and ambient lights. must work only with shaders.

i repeat myself, too much fragmentation, no way to make bricks works together. if i use this shader on esf ships, i lose all the lights effects. or i need a different shader, and again, starting from zero.


Ciao facce da sedere!
dark coder
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 6th Feb 2011 08:54 Edited at: 6th Feb 2011 09:02
Here's an incredibly basic normal mapping shader that requires 2 textures and has 3 values(light direction, colour and ambient colour):



Ermes
23
Years of Service
User Offline
Joined: 27th May 2003
Location: ITALIA
Posted: 6th Feb 2011 10:27
great!

stage 0 for diffuse
stage 1 for normal

sorry but how to set the

float3 lightDirection;
float3 lightColour;
float3 ambientColour;

i think set effect constant n,"lightdirection",e

for the first, but for the colours?? thanks!!!


Ciao facce da sedere!
dark coder
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 6th Feb 2011 11:16 Edited at: 6th Feb 2011 11:22
You set them all the same way:



Remember that these are float colours, so 0-255 is 0.0-1.0, thus for white you'd set 1.0, 1.0, 1.0. You can set the 4th value to anything you like, because it's ignored by the shader, DBPro just requires that you use 4D vectors to set shader vectors.

Also, make sure the lightDirection you set is normalized(has a length of 1, i.e. sqrt(x*x+y*y+z*z) == 1.0), I do this in my example.

Ermes
23
Years of Service
User Offline
Joined: 27th May 2003
Location: ITALIA
Posted: 6th Feb 2011 14:32 Edited at: 6th Feb 2011 15:04
i see.


thanks dark coder, i will test it this evening.

edit: tested, and wow, it runs ok the first time i use it.

dark coder, thanks.

so, with the right instructions, i can do something. thanks again!


Ciao facce da sedere!
Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 7th Feb 2011 11:07
Yo, DC is in da house

Login to post a reply

Server time is: 2026-07-16 04:35:48
Your offset time is: 2026-07-16 04:35:48