COF Shader: How to differentiate faces?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/06/2003 at 08:44, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.100
Platform: Mac ;
Language(s) : C.O.F.F.E.E ;---------
Hi,I'm at a couple of plugins which need to create different values when the ray hit's a frontface or a backface.
How can I differentiate (in COFFEE) if the current ray is entering or leaving the object?
Any help is heartly appreciated!
CheersKlaus
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/06/2003 at 05:32, xxxxxxxx wrote:
If the ray comes from the outside, the angle between the face normal and the ray vector is smaller than 90°. So all you have to do is to calculate the angle between both vectors (which are both given by C4D).
There are some native usefull vector functions you can use.
hope that helped you somehow.
-zet
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/06/2003 at 06:16, xxxxxxxx wrote:
Yeah, that was what I thought. The dot product of td->ray und td->bumpn should give the cos of the angle between them, so a quick check against 0 should easily decide that question.
It doesn't work though... mh, just a question: both of these rays are normalized, aren't they?
Thanks
Kabe
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/06/2003 at 06:27, xxxxxxxx wrote:
uhm I don't know but it shouldn't be hard to prove that as the length of a 'normal' vector is alway 1.
0<=phi<=PI
cos(phi) = a0 dot b0
a0=normalized vector of vector a
cu
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/06/2003 at 06:33, xxxxxxxx wrote:
unfortunately I was not able to solve it that way. In fact the solution turned out to be much simpler (though I'm unshure if it also takes care of bump...).
Just check vd->cosc.
Kabe
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/06/2003 at 22:39, xxxxxxxx wrote:
Just an addition - when in doubt about [ray], which doesn't have a documentation in the COFFEE docs, thenk check the C++ SDK!
Kabe