exarhos2003 Posted November 3, 2003 Share Posted November 3, 2003 if im taking the dot product of the following vectors (1,0,0) (1,1,0), shouldnt' it produce a value of .707. I want this as the diffuse value. It shows to work in the Shop viewer but does not appear to show on geometry. Quote Link to comment Share on other sites More sharing options...
edward Posted November 4, 2003 Share Posted November 4, 2003 The dot product of (1,0,0) and (1,1,0) is (1*1 + 0*1 + 0*0) = 1. The dot product is a simple operator. The math I posted not too long ago in the vex forum even. The dot product of the *normalized* vectors between said vectors is 0.707... That's because if you normalize them, you get (1,0,0) and (0.707...,0.707...,0) which will result in 0.707.... Looking at your picture, it looks like your lighting model is probably modifying the 0.707... value. Try connecting the output of the floattovec1 vop into Cf directly. Quote Link to comment Share on other sites More sharing options...
exarhos2003 Posted November 4, 2003 Author Share Posted November 4, 2003 i dont know whats going on, the reason i normailzed it is because later i need to extract the angle it produces. ill post the file later, does anyone know if the value the dot produces is in rad or degrees? the acos VOP has rad for input.. thanks, christopher. Quote Link to comment Share on other sites More sharing options...
Marc Posted November 4, 2003 Share Posted November 4, 2003 moved this to the VEX forum with the other topic. Quote Link to comment Share on other sites More sharing options...
tallkien Posted November 4, 2003 Share Posted November 4, 2003 Duh... what's an acos VOP sorry missed the Trig functions vop. your value acos(x) should be in degrees (outside vops). In vops add a rad2deg after trig Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted November 5, 2003 Share Posted November 5, 2003 i dont know whats going on, the reason i normailzed it is because later i need to extract the angle it produces.ill post the file later, does anyone know if the value the dot produces is in rad or degrees? the acos VOP has rad for input.. Edward already answerd all your questions, but maybe a little more explanation will help.... 1) Yes; you *do* need to normalize the two vectors that you feed to the dot product VOP -- or rather, you need to normalize if and only if what you're interested in getting as a result is the cosine of the angle between the two -- which is the case here This is because the dot product between two vectors A and B is actually defined as: dot( A, B ) = length(A) * length(B ) * cos(theta) {where theta is the angle between A and B } So if A and B are normalized, then their lengths are 1, and the above turns into: dot( A, B ) = 1 * 1 * cos(theta) = cos(theta) 2) The cosine of an angle is neither in degrees nor radians -- it is simply a ratio, and describes a geometric relationship. Just think of it as a "quantity", a "scalar", anything but *not* an angle. 3) To get the actual angle from the cosine-of-the-angle, you need run it through the inverse operation, which, for cosine, is called arc cosine (and often written as cos^-1). In Vex, you'd use the function acos(). And in VOPs, you'd use the Trigonometric Functions VOP, and select Arc Cosine as the function. All trigonometric functions in VEX that either take, or return, or otherwise manipulate angles in any way, express said angles in RADIANS. This is true in most (all?) trig libraries -- Houdini's expression language is an exception, where the user is likely expecting everything to work in degrees and so would be more intuitive to express things that way; but this is definitely not the rule. And just to preempt some possible headaches, note that the inverse of the cosine function is *not* 1 / cos() , but a completely different function -> acos() !! 4) As Edward mentioned, If you want to see (as in "visualize") the result of all this, then you'd feed it directly to Cf, and not to the "Diffuse Color" of the lighting vop. The reason is that the lighting vop will then weigh your input by the diffuse reflectance (BRDF) function (something like dot(L,N) if set to Lambert diffuse), which is likely not what you want at all. However! ( ) ... given that the cosine of an angle (or the angle itself if using acos(angle) ) can be either positive or negative, you might want to take the absolute value before passing it to Cf. Cheers! Quote Link to comment Share on other sites More sharing options...
edward Posted November 6, 2003 Share Posted November 6, 2003 2) The cosine of an angle is neither in degrees nor radians -- it is simply a ratio, and describes a geometric relationship. Just think of it as a "quantity", a "scalar", anything but *not* an angle. To be even more complete yet cryptic: SOHCAHTOA Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted November 6, 2003 Share Posted November 6, 2003 To be even more complete yet cryptic: SOHCAHTOA I'd forgotten all bout that! I remember hearing it when I first came here -- didn't know what the heck they were talking about! It's definitely not used to teach trig identities in Argentina. Quote Link to comment Share on other sites More sharing options...
meshsmooth Posted November 6, 2003 Share Posted November 6, 2003 i have considered tatooing Soh-Cah-Toa on my arm ... i just cant get it to seem to stick in my head. Quote Link to comment Share on other sites More sharing options...
stevenong Posted November 7, 2003 Share Posted November 7, 2003 Try "Toa-Cah-Soh". In a dialect I speak, it means "Big Foot Lady". Cheers! steven Quote Link to comment Share on other sites More sharing options...
exarhos2003 Posted November 10, 2003 Author Share Posted November 10, 2003 thanks for the input everyone. is their a way to see my color values in the spreadsheet when using a shader? christopher Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.