BumpMap triangles blacked out

Software: Away3D 4.x

gcs_dev, Newbie
Posted: 05 March 2013 08:58 PM   Total Posts: 7

I’m new to Away3d (HaxE port) and am having an issue with applying BumpMaps to models created with Sketchup Pro and loaded as .OBJ.

I’m loading the model with a Loader3D and adding to the scene on RESOURCE_COMPLETE at which point I also start the render enterFrame loop.
I set the lightPicker and the bumpmap on ASSET_COMPLETE.

The screenshots attached show the issue:
with a bumpmap applied, some of the triangles are drawn but are completely blacked out. I’ve tried changing the model and re-exporting the OBJ but the problem persists. It’s always the same triangles which don’t get rendered.

 

   

Avatar
Fabrice Closier, Administrator
Posted: 05 March 2013 10:01 PM   Total Posts: 1265   [ # 1 ]

It can be geometrical issue. Use MeshDebugger or any other tool to display/inspect the normals of geometry, if there are no double faces etc…
Can be a mapping issue, map issue… Its hard to say from what you posted.

   

gcs_dev, Newbie
Posted: 06 March 2013 03:27 AM   Total Posts: 7   [ # 2 ]

Hi Fabrice.
Thanks for your answer and for the heads-up about MeshDebugger, I hadn’t come across it yet.

All the normals look correct (all face outwards) and the triangles aren’t double-sided, or at least, seen from behind, nothing is drawn.

You mentioned map/mapping, to which map were you referring?

   

Avatar
Fabrice Closier, Administrator
Posted: 06 March 2013 10:48 AM   Total Posts: 1265   [ # 3 ]

actually its not the normals that matters, but the vertexnormals (the one at each corners of each faces). Chances are the obj was saved without normals, and away calculated them automatically. But this process doesn’t take in account the diffs between surfaces. This means that in your house at each vertices where the roof, the side wall and front wall meet, that they are possibly averaged. as a result their direction, which is used in shader, possibly doesn’t reflect the expected front wall for the 2 upper faces that are used in your front wall.

A possible fix is to isolate the front wall and make a mesh of it in your editor, ensure that all normals and vertexnormals point to perpendicular direction. where value (based on your pict) should be something like 1,0,0 if aligned on X AXIS. You export like you do now, and merge once parsed/loaded. During merge vertex normals are kept as is. So the resulting mesh will likely be lighted propperly.

As about maps.
Regarding mapping, if the uv coordinates are pointing at “blanks” or overlappings on map, you may get artefacts. Make also sure the normalmap is of tangent type, not objectspace.
Also because normalmaps may encode a light direction not perse suitable for your application. It is best practice to first light your model using a simple colormaterial. Once the color values per face are the expected, then you can move on to texturematerial diffuse and add normalmaps.
Working gradually, would help you to spot the potential lighting source of error without guessing.

   

gcs_dev, Newbie
Posted: 06 March 2013 04:22 PM   Total Posts: 7   [ # 4 ]

First let me thank you Fabrice for taking the time to answer. I see that you are the only person who answers threads in this forum and I’d like to say that I do appreciate your help.

I took your advice on isolating the problem section of the model and gradually building up to using normalmapped surfaces and have discovered that:
ColorMaterial = Perfect lighting
TextureMaterial = Perfect lighting
NormalMap = Broken

The VertexNormals seem properly numbered and all seem to point in the correct direction, HOWEVER…

I put the model through Prefab to see if it would help and found that upon import, Prefab tells me:

“Some anomalies were found on (1) buffers and corrected where possible.

Prefab checked 13 faces.
One or more normals buffers were either empty or unvalid (1). The normals buffer was rebuilded.”


Seems promising, but then I exported to OBJ and the model now crashes my program upon compilation with an “out of range” error on TranslateVertexData.

Exporting to AWD2 produces more interesting results in that the program works and when debugging vertex normals, I can see that two are missing. So how do I go about re-creating these missing normals?

   

Avatar
Fabrice Closier, Administrator
Posted: 06 March 2013 05:02 PM   Total Posts: 1265   [ # 5 ]

Thank you for the kind words.

There obvioulsy something wrong with the geometry.
One way to fix would be to explode and then weld, but using 80Prozent’s “WeldByAngle.as” class when you can pass a threshold for normals. What it does is looking at angle of faces normals. Then do share and average or not based given threshold. It is very usefull on lowpoly models such as yours are wrong lighting may affect a big part of exposed surface while would not even be noticable on model with high polycount.
It will be part of next Prefab release, but in meanwhile you can find it on this forum if you search.
Of course you can fix in your editor by exploding and saving your house in more meshes, then group each “house” to get an ObjectContainer per house. Then using Merge, merge each container after its loaded. Because they are not heavy meshes, exec time will certainly be acceptable online, prob lower than a sec.
I would avoid obj, because I suspect from your msg that it doesn’t include the normals and away generates a new set automatically, causing again the lighting issue no matter what you would do in your editor.

   

gcs_dev, Newbie
Posted: 06 March 2013 05:36 PM   Total Posts: 7   [ # 6 ]

I think you got it with your suspicions about OBJ files!

I get good results by exporting from Sketchup as a 3DS file (which fixed the normals problems but produced out of range UV values) then importing to Prefab and exporting as AWD2 (fixed the UV errors).

Not only does this produce good normal and UV values, but the bumpmapping is even much better visually than before.

Many thanks again for your patience and help.

I’m sure I’ll be back soon with all new problems grin

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X