Go Back   Rage3D » Rage3D Discussion Area » Gaming and Computing Forums » General Software » Programmers Discussion Forum
Rage3D Subscribe Register FAQ Members List Calendar Mark Forums Read

Programmers Discussion Forum Use this discussion forum to talk about the art of programming. Everything from website development to 3D graphics programming should go in here.

Reply
 
Thread Tools Display Modes
Old Feb 28, 2002, 12:06 AM   #1
Advertisement (Guests Only)

Login or Register to remove this ad
pav
Radeon R520
 
Join Date: Feb 2001
Location: Israel Israel
Posts: 381
pav is still being judged by the masses


Default Dot Product! help!!

hi guys...
it's like this...
i know what a dor product is...an operation that
returns the angle between 2 vectors...right?

it's whether
A . B = Ax*Bx + Ay*By
or
A . B = |A|*|B|*Cos(angle)
so if i wanna find the angle between the vectors A and B:

Cos(angle) = (A . B)/(|A|*|B|) so the angle is the inverse of Cos(angle)..

this is all completely clear to me (same for Cross Product)

but what exactly is DotProduct3? or DotProduct4?
you know..the dp3 and dp4 in pixel shaders?

what do the 3 & 4 stand for, what do they mean..

thanx
pav is offline   Reply With Quote
Old Feb 28, 2002, 12:46 AM   #2
orrimarrko
Radeon R600
 
Join Date: Dec 2000
Location: United Kingdom The Shires
Posts: 623
orrimarrko is still being judged by the masses


Default

Is this Pixel shader code?

I honestly no 0.1% on pixel shader info when it gets down to it. but more than the average person whould know.

I think im completely wrong here, but could Dot 3&4 maybe be alternative info or options methods.

Its hard to explain, but Ill try too. Lets say we have a flat square. that wont roate in 3d space, and has only a x,y coordinate system. There is no Z ( tryin to explain best i can maybe )

Since all things are nromaly broken down into triangles. Ther are some instances, where it cant be broken into 3. Possibly Dot 4 is the relative angle coordinate or info that is directly relative to the last angle info. Dot 3 could be relative to angle 3 in a normal poly or 3 sided thing. And Dot 4, could be relative to your point of origin. Ill try and draw a diagram.


`````````````````````1
````````````````````/`\
```````````````````/```\
``````````````````/`````\
`````````````````/```````\
````````````````3________2

Ok, the triangle would not need a Dot 3 since all angles are calculated once 2 are.

...........1------2
........../````````\
........./``````````\
......../````````````\
......./``````````````\
......5````````````````3
.......\``````````````/
........\````````````/
.........\``````````/
..........\````````/
...........\``````/
............\````/
.............\``/
..............\/
..............4

here, we have something complex, but lets say we wanted the angle 5,1,2

Normaly, if it were a 3 S poly, youd get the info, and wed be on our way. But since this is 5 sides. My theory is that in order to compute this porperly, angles would be needed in absolute or relative coords to the angle 5,1,2.
Result I think would be 4,5,1 which would report a absoulte coordinate relative to angle @5,1,2 and not from the 0,0..
And Dot 4 would be likewise the other vertice which made your original angle, showing the rel/ abs coord of 1,2,3, @1,2,3 off the 5,1,2


Im trying to interpet what your saying, and I can only think of this as a use, and function for it. Ofcourse i could be out in left field, and i wish i was better at explaining things.

Hopefuly NitroGL or Humus will drop in, cause I myself would like to know, and I can only theorize what it could be with never using, or knowing much info on the subject anyhow.
orrimarrko is offline   Reply With Quote
Old Feb 28, 2002, 01:23 AM   #3
Boke
Near Dark
 
Join Date: Sep 2000
Location: Ohio, USA
Posts: 874
Boke is still being judged by the masses


Default

"what do the 3 & 4 stand for, what do they mean.. "

The dp3 and dp4 just multiply two vectors together and return a scalar which is the sum of the 3( or 4) multiplications. Just like you are describing.
dp3 does an xyz or rgb multiply between two 3 component vectors.
dp4 does an xyzw or rgba multiply between two 4 component vectors.

They can be used for many things.. but the main thing you'll see them used for is matrix multiplies to transform vertices.

In direct3d the m4x4 instruction is really just a macro.

So... m4x4 r0, v0, c0 expands to->
dp4 r0.x, v0, c0
dp4 r0.y, v0, c1
dp4 r0.z, v0, c2
dp4 r0.w, v0, c3

v0 is the vertex being transformed.
c0 is the first row of a 4x4 matrix.
c1 is the second row.
c2 is the third row.
c3 is the fourth row.
The result of the transformation is stored in r0.

Note:
The shader registers are made up of 4 numbers. You access the individual parts with modifiers... hence the r0.x, r0.y...
The c0 and v0 above, because they have no modifiers, are treated just as if you had typed c0.xyzw or v0.xyzw . ( I think I read that this will change with the 2.0 shader version... you will have to type in the modifiers )

One thing the dp3 instruction can be used for is to transform normals, since you don't need any translation or perspective applied to them you don't need the fourth row & column. ( I hope I don't have my rows/columns mixed up )

Last edited by Boke : Feb 28, 2002 at 01:36 AM.
Boke is offline   Reply With Quote
Advertisement (Guests Only)
Login or Register to remove this ad
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New product for men. bete Off Topic Lounge 2 Apr 13, 2007 07:48 PM
product key? Ebok Operating Systems 5 Dec 14, 2002 01:36 PM
USB TV-Wonder...anyone have this product? BoBVila AIW / Multimedia Discussion and Technical Support 2 Jul 16, 2002 06:58 PM
I will never get an ATI product again! PreacherBoy Legacy ATI Discussion and Technical Support 24 Jun 18, 2000 03:48 PM


All times are GMT -5. The time now is 06:56 PM.



Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
All trademarks used are properties of their respective owners. Copyright ©1998-2011 Rage3D.com
Links monetized by VigLink