| We hope you enjoy your visit. You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you are already a member please log in to your account to access all of our features: |
| Strange (?) shadows | |
|---|---|
| Tweet Topic Started: Mar 24 2009, 04:01 PM (483 Views) | |
| kapturzak | Mar 24 2009, 04:01 PM Post #1 |
|
Member
![]() ![]() ![]() ![]()
|
Hey, I've got a problem with this example of attaching a weapon to hand: http://forum.ultimate3d.org/topic/173239/1/ . Everything is working fine but now I've got a problem with shadows. When I stay in front of a light source, my character model has correct shadows, but sword and head (which I tried to attach to neck too ) have inversed shadows. I Dunno how to clearly explain this so here are few screenies (don't be afraid of my naked, test model) :![]() ![]() Edited by kapturzak, Mar 24 2009, 04:02 PM.
|
![]() |
|
| Dr. Best | Mar 24 2009, 05:58 PM Post #2 |
|
Administrator
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Find the flip normals option in the modeling software of your choice and apply it to the triangles, which look wrong. |
![]() |
|
| Satyr | Mar 25 2009, 08:08 AM Post #3 |
|
Captain Gobblecoque
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
NAAAAKEEEEDDDD, but yeah, it seems like the normals are off for either the head or the body, just try flipping the normals of either the head or the body, one of them is probably inverted. |
|
The feeling of homesickness never goes away when you return to your parents home from years of being away. same goes with the smell of ash and smoke from the day you set it ablaze. | |
![]() |
|
| kapturzak | Mar 25 2009, 04:12 PM Post #4 |
|
Member
![]() ![]() ![]() ![]()
|
Thanks for reply, but its not working :(. I think that problem is in that mathod of attaching models to bones (http://forum.ultimate3d.org/topic/173239/1/) because when i replace my character model with head model it receives shadows correctly. When i attach anything to a bone and when i stand in front of light source the attached model is getting bright on the wrong side. Have you got any ideas left? Please help me
Edited by kapturzak, Mar 25 2009, 04:17 PM.
|
![]() |
|
| Despellanion | Mar 25 2009, 04:14 PM Post #5 |
|
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
The head's normals has clearly been flipped incorrectly as Dr.Best posted (it's obvious by looking at the screenshot) so make sure you flip them correctly. You have probably failed to flip them right. Edited by Despellanion, Mar 25 2009, 04:16 PM.
|
![]() |
|
| kapturzak | Mar 25 2009, 04:46 PM Post #6 |
|
Member
![]() ![]() ![]() ![]()
|
Ah, no thats not it. Maybe on a first screen it really looks like normals of head are wrong flipped, but its only a color of shadowed skin.
Edited by kapturzak, Mar 25 2009, 07:05 PM.
|
![]() |
|
| Dr. Best | Mar 25 2009, 05:52 PM Post #7 |
|
Administrator
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Ok, I've got the reason for the issue. For several file formats (including *.an8, *.ms3d and *.x) Ultimate 3D uses bones with negative scaling to convert between different coordinate systems. If you use matrix functions to retrieve the transformation of a bone of such a model, this matrix will also contain a negative scaling. A negative scaling causes problems, because it flips the front sides and the back sides of the triangles (they are defined through the vertex order). This is why setting up the matrices leads to wrong backface culling in your case. Fixing this will be tricky. The normals of a model with negative scaling will never mach to the backface culling, because they are computed before the scaling is applied. For models for which Ultimate 3D uses negative scaling on purpose it corrects the normals by inverting them, but it does not do that if the negative scaling comes from a user specified transformation as in your case. The easiest and most efficient way to fix this would be to remove the negative scaling from the matrices before they are set up for attached models. To do so you would first mirror the attached models in your modeling software. Then you would create a matrix in Ultimate 3D, which undoes this mirroring (so this matrix would have a negative scaling). Finally you would combine this matrix with the transformation matrix you got from the bone and would set it up for the object. Since both matrices used to create this final matrix contain a negative scaling the resulting matrix will not have one. Minus times minus makes plus, you know ?The code for this could look similar to the following. Try to understand the meaning of undefined variables from their names:
|
![]() |
|
| kapturzak | Mar 25 2009, 07:16 PM Post #8 |
|
Member
![]() ![]() ![]() ![]()
|
Thank You So Much Mr. Best !!! You guys are really awesome rulez
|
![]() |
|
| « Previous Topic · Questions about Ultimate 3D · Next Topic » |





![]](http://z1.ifrm.com/static/1/pip_r.png)
) have inversed shadows. I Dunno how to clearly explain this so here are few screenies (don't be afraid of my naked, test model) :




?
rulez
4:40 PM Jul 11