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 Discussion / talking about a function

Author
Message
lidongheng
13
Years of Service
User Offline
Joined: 10th Jan 2011
Location:
Posted: 14th Jan 2011 20:12
Hello everybody I'm a new member I need you anwer me a question that about a function set matrix normal I can't understand the concept of normal I need somebody help me If somebody can help me
Please send me a email :LI_dongheng@live.cn

lidongheng
PrimalBeans
13
Years of Service
User Offline
Joined: 14th Oct 2010
Location: The sewer.... hunting alligatiors.
Posted: 14th Jan 2011 22:22
do you have the directx 9/10?/11? sdk?? If you look in the c++ programming guide (Im assuming thats what your using...) there is a secton that talks about normals and their relationship to shading. If your using something else then the best i can explain it they effect the value of shading on a surface relitive to the angle that the light source is pointing. A simple way of saying it a face that is 100% perpendicular to they rays of they light source receives the maximum amount of light it can at its perticular distance from the light source. As the face is rotated paralell to the direction of light the shade of the face is adjusted darker.

Thats it in a very simplified nutshell...

here is some reading... from M$..

http://msdn.microsoft.com/en-us/library/bb173380(v=vs.85).aspx

BiggAdd
Retired Moderator
19
Years of Service
User Offline
Joined: 6th Aug 2004
Location: != null
Posted: 15th Jan 2011 03:55 Edited at: 15th Jan 2011 03:57
Please post your DarkBasic questions in the DarkBasic board

I have moved this thread to the correct board.

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 15th Jan 2011 07:25
Remember back in Geometry how a line that was normal to something was perpendicular to it (intersects it at 90 degrees)? Same idea here. The normal is a line that comes straight out of the matrix and is perpendicular to the face itself (take a piece of paper and hold a pencil sticking straight up in the middle of it, the pencil is normal to the paper).

What does this mean to the program:
Unless you change certain settings, a normal dictates which side is visible. That is to say, if the normal is coming out the front of a face, and the camera is looking at the back of it, you wont see the face at all.

Does this make sense?

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
BiggAdd
Retired Moderator
19
Years of Service
User Offline
Joined: 6th Aug 2004
Location: != null
Posted: 15th Jan 2011 11:33
I'm seeing some good posts from you BN2 Productions! Keep it up!



lidongheng
13
Years of Service
User Offline
Joined: 10th Jan 2011
Location:
Posted: 15th Jan 2011 21:12
Thank you I understand something man but just one point I use this function can't change something set matrix normal I can't change something please give me asample example to help me thank you!

lidongheng
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 16th Jan 2011 17:52
you're gonna have to be a lot more descriptive with what you're talking about. 'i cant change something' is not helpful to us. If you're trying to say setting matrix normals doesn't appear to take affect, make sure you call 'update matrix' after you've changed the normals.

"Only the educated are free" ~Epictetus
"Imagination is more important than knowledge..." ~Einstein
lidongheng
13
Years of Service
User Offline
Joined: 10th Jan 2011
Location:
Posted: 18th Jan 2011 17:35
Hi body I was already use your methood to do this In this time I didn't find anything effects in My Eyes Body I really need a sample
Hi did you trying to help me i use like this:
set matrix normal x,y,1.0,1.0,1.0
update matrix 1

lidongheng
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 18th Jan 2011 19:25 Edited at: 18th Jan 2011 19:27
I believe that STE MATRIX NORMAL cares more about the direction than the actual numbers in the arguments (ie putting 100,100,100 would be the same as 1,1,1 would be the same as 50,50,50 and so on). Not sure, though, haven't played around with it yet.

That being said, I did get noticeable changes by creating a matrix, turning off wireframe, then using a FOR-NEXT loop to set part of the matrix normals to 1,-1,1. I lost my code though, so I am posting this from memory (haven't had a chance to test it yet but it should work).



Also, I noticed that you forgot the matrix number with SET MATRIX NORMAL in your post above. I assume its a typo, but if not, then the syntax for the command is:

SET MATRIX NORMAL [Matrix Number],[Tile X Coord],[Tile Z coord],[Normal X],[Normal Y],[Normal Z]

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
lidongheng
13
Years of Service
User Offline
Joined: 10th Jan 2011
Location:
Posted: 20th Jan 2011 18:39
I understand But I'm still can't understand How to use this command
really can't understand Please tell me How to find the effects about using this function somebody can help me Please answer

lidongheng
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 22nd Jan 2011 10:26
@lidongheng

Hello,

I'm adding a code snippet that demonstrates what setting a normal does to the lighting on a matrix. The code itself may be too complex for a beginner to understand but the point is to show you visually how setting a normal will change the shading on a matrix.

You will see a 5x5 matrix with little blue lines going up to a yellow square.

The lines are showing the direction that the normals are pointing for each vertex on the matrix. The yellow box helps to show where the end of the normal is and is also where you can LEFT LICK to drag the line and change the normal.

The controls are:
ARROW KEYS to move the camera forward,backward, left and right
Hold the RIGHT MOUSE BUTTON and move the mouse to rotate the camera view left or right, up and down
Hold LEFT MOUSE BUTTON on or near a yellow square and move the mouse to change the normals direction.

When you change the normal, you should see the area around the normal get brighter or darker depending on which direction you move the line.

At the top of the screen you will be told which vertex you changed on the matrix and the values of the normal at that position and how SET MATRIX NORMAL was used.

The light source comes from the left and slightly above the matrix and shines to the right so you can see the effects of changing the normals more clearly.

This example works in both DBC 1.13 and DBC 1.20 - though 1.13 is noticeably darker. Again, the point of this demonstration is to show you what the normals do to change how a matrix responds to light.



Enjoy your day.

Login to post a reply

Server time is: 2024-04-25 10:09:46
Your offset time is: 2024-04-25 10:09:46