normals [state]
is there a way to catch the state of normals? to know what direction they are facing?
if they are facing away from camera or not. im tring to writte a script that finds all objects who's normals are inverted. and make them point in the right direction. |
well, you could scan all normals and then take the dot product between the normal and the camera (which the normal of the camera would be a vector from the actual camera and the point it is rotating around, and then normalize that
then if the dot product was negative, then its facing outward, but if the dot product was positive then its facing inward then you flip the normals that the dot product was negative this might work, but I'm not sure |
you lost me at "dot"
what is that? is that a mel function? can u write a pseudo code on how youd hadle this. this sound like a logical approach. if i could get the state or the "dot" positive/negative of normals facing camera, i could easily write a mel that reverse them. |
I'm pretty sure there is an option, under normals, that will flip whichever normals are not pointing in the same direction as the majority of them.
|
i wish thre were,
but the option under normals>conform as i thought it was, really does nothing, so any mel savvy members can look into this, i have a model and a huge scene with many many parts im trying to set all their normals to face the camera. |
dot product, or scalar product, is a mathmatical operation done like this:
vectors c and n, c being camera, n being normal dot product = n.x*c.x + n.y*c.y + n.z*c.z |
i think youre way off matt
|
me too but I was just trying to help.
|
Quote:
|
Here's a copy-paste of my getFaceNormals procedure, which I wrote for my auto map script. It takes in a string variable containing the name of the polygon object and returns a vector array containing face normals.
Code:
// getFaceNormals by kbrown |
Re: normals [state]
Quote:
|
yea, the state [or directions] of my normals matter a lot.
im doing a lot of dynamics which requires normals to be pointed out to calculate. also some rendering issues i have with inverted normals. i did a lot of negative duplicates, so the normals get inverted [sometimes arbitrarily :confused: ] ill experiment with your code with some of the codes i already have for this. thankx. ill keep testing. this is harder than it seems. i dont know why alias hasnt made a tool for this yet. |
close enough:
"normalChecker; " of course since its from alias it only does half the job. Code:
// Copyright (C) 1997-2004 Alias Systems Corp. |
I'm going to look into this tonight. I know that one of my books explains how Maya can find and flip normals that aren't pointing in the same direction as the majority.
Question: If some of the normals are flipped, can't you just tell Maya to make your texture double sided? |
Well, I struck out. I can't find a way to flip the "odd" normals but one thing I don't understand is how you guys are running into situations where some of your normals are getting reversed. I've never had that happen,,, yet.
One thing I discovered is that if YOU reverse some or all of your normals using the reverse function, a node is created and you really can't unreverse those normals by hitting the reverse normals button again. You have to delete the node. I reversed some normals on purpose then went into the outliner and turned off DAG OBJECTS ONLY then went down to the node that was created; POLYNORMAL, and deleted it. By doing this, the normals that I reversed turned back around the way they originally were. I've yet to come across a situation that has made me want to reverse normals except sometimes when I import a model from Zbrush. Sometimes when I import the model, the normals are reversed. When that happens, it's the whole model and not just a few normals. I'm going to post this question in the Polygon modeling forum.. |
All times are GMT. The time now is 12:12 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018