Go Back   AC3D Forums > General > AC3D General
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 8th July 2018, 09:29 AM   #1
SpitForty
Junior Member
Member
 
Join Date: Jan 2018
Posts: 24
Default Generated AC3D objects - normals problem

I hope someone can help with this as its baffling. I'm making some AC3D objects programatically but when I load them into AC3D some of them don't work. I've followed the info about AC3D file structure but nothing seems to talk about this problem. By "not work" I find that if I texture them in AC3D some surfaces don't take the texture. I seem to be able to fix broken ones by doing lots of "flip normals" and "change vertex orders" but why should that make a difference?

I've attached 2 examples. One works one doesn't. The working one is actually almost identical to the broken one but I reordered the vertices very slightly.

Broken Poly: https://www.dropbox.com/s/lqdz0bor0z...broken.ac?dl=0

Working Poly: https://www.dropbox.com/s/76jl4rnsx8...-works.ac?dl=0

All the objects I'm making have a top & bottom with matching polygon shape and sides composed of multiple simple rectangle surfaces. When texturing these objects the simple rectangles always texture correctly but the top/bottom poly shapes often don't.

Help please !
SpitForty is offline   Reply With Quote
Old 8th July 2018, 04:23 PM   #2
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 4,563
Default Re: Generated AC3D objects - normals problem

Your file generation looks great. From a quick look, I think the problem is that the first three vertices of the complicated polygons are an obtuse angle compared with the other vertices.This is forcing the normal calculation to be not what you want.


If you use Surface->change-vertex-order and then resize/undo to force normal recalculation (must fix the change-vertex-order code to recalc normals...) that should bring color back to those surfaces.


Alternatively, triangulate, or divide up the large polygons.
Andy is offline   Reply With Quote
Old 8th July 2018, 04:28 PM   #3
SpitForty
Junior Member
Member
 
Join Date: Jan 2018
Posts: 24
Default Re: Generated AC3D objects - normals problem

Quote:
Originally Posted by Andy View Post
Your file generation looks great. From a quick look, I think the problem is that the first three vertices of the complicated polygons are an obtuse angle compared with the other vertices.This is forcing the normal calculation to be not what you want.


If you use Surface->change-vertex-order and then resize/undo to force normal recalculation (must fix the change-vertex-order code to recalc normals...) that should bring color back to those surfaces.


Alternatively, triangulate, or divide up the large polygons.
Great. Thanks Andy. I was closing in on something related to normals.
SpitForty is offline   Reply With Quote
Old 8th July 2018, 05:43 PM   #4
SpitForty
Junior Member
Member
 
Join Date: Jan 2018
Posts: 24
Default Re: Generated AC3D objects - normals problem

Quote:
Originally Posted by Andy View Post
Your file generation looks great. From a quick look, I think the problem is that the first three vertices of the complicated polygons are an obtuse angle compared with the other vertices.This is forcing the normal calculation to be not what you want.


If you use Surface->change-vertex-order and then resize/undo to force normal recalculation (must fix the change-vertex-order code to recalc normals...) that should bring color back to those surfaces.


Alternatively, triangulate, or divide up the large polygons.
I'm trying to modify things to avoid the obtuse angle. Can I just check something? Vertices need to be anticlockwise to keep the normals right but wouldn't something simple and regular like an octagon always have an obtuse angle when traced anti-clockwise?
SpitForty is offline   Reply With Quote
Old 9th July 2018, 08:19 AM   #5
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 4,563
Default Re: Generated AC3D objects - normals problem

Yes - a convex polygon is fine. When you get a concave polygon, that's when the problem you saw can occur.
Andy is offline   Reply With Quote
Reply

Tags
.ac file

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -4. The time now is 11:48 AM.


AC3D Forum
(C) Inivis Limited 2020