[SOLVED] Irregular lighting at Triangulated Edges. (Wrong Import of Vertex Normals from Sketchup?)

MOUSY

Resource contributor
#1
Hi all,

Geometry imported into Blender seems to have the following problem.
Irregular.JPG

Irregular lighting at the edges of triangulated geometry. (Imported from SketchUp into Blender and then exported and displayed in MCX)

I've tried a Limited Dissolve to reduce the number of triangles, but that just produces larger faces with the normals still facing the wrong direction.
Has anyone experienced this and found a solution?
 

dave hoeffgen

Resource contributor
#2
I'd recommend to do the "remove doubles" step to remove duplicate vertices, then recalculate the normals (CTRL+N) and finally add an "edge split" modifier.
Please give feedback if it helps
 

MOUSY

Resource contributor
#3
Thanks for the suggestion.
I saw that posted on another Blender forum but nope, no luck with that.
 

MOUSY

Resource contributor
#5
This was before the cleanup, normal recalculate and edge split modifier.
Irregular.JPG

This was after.
Irregular 2.JPG

The normals look like they were corrected, but still show up incorrectly in MCX.
I have checked and unchecked write normals on export and have seen no difference.


P.S: How does one "apply scale"? I have no scaling in my model from Sketchup, nor Blender.
 
#8
In fighting a similar issue as speak on 3d airport vehicles customised for FMEE (St Denis Reunion). I'll try and bring down yours tomorrow and see if there is anything I can come up with. Just to ask a daft question. Have you up loaded the same straight out of SU in to MC X without migrating through blender first. I've noted very similar oddities on simply low poly DAE,s passed through SU to blender. Seems blender throws higher triangular edges in imports. I've tried the same process you mentioned but still hit the results. In the end I next removed the verts and rebuilt the section, aligned the texture and added in a simple prayer
 
Last edited:

MOUSY

Resource contributor
#9
When you press CTRL+A select "scale" from the list.
Thanks. No Difference.

Have you up loaded the same straight out of SU in to MC X without migrating through blender first.
That is my usual method and the issue does not occur this way. Which is why I'm positive it is something in blender. I usually use the OBJ format over DAE as I have experienced issues with retaining textures when importing and exporting, but I can confirm the same issue occurs.

Blender is a great tool despite having a steep learning curve. Its baking and lighting tools have allowed me to greatly improve my texture work while simultaneously improving performance using the Texture Atlas tool. I've already invested so much time in learning it that I'm almost unwilling to move on to something else despite this glaring issue.
 

Otavio Bonomi

Resource contributor
#10
Hello everyone
Can I give you an opinion?
Similar types of problems often happen to me in sketchup. It may come from the alignment of the object with respect to the Y and X axes. When they are misaligned, that can affect the object and centering of the texture.
Before texturizing I create a group or component of the whole object and realing.
Try to align your object in sketchup as best as you can respecting the red and green lines and leaving the blue line right in the middle of the object.
In your case, as it is already textured, try to align the center of the object with the blue line and export the DAE again, see if it changes.
In the last case realign and redo the problematic wall.

Cheers,
Otavio.
 
#12
Mousy
Id Dl'd your blender file
In blender it looks fine and I and see the added geometry that SU puts in (from the inside view) As is normal with the imports

I exported as a DAE from Blender for MCX and the textures just went all over the place as was expected - no change with that

I exported as an Obj file - in MCX the orientation of the model went 90 degrees and dropped through the grid - but texture appears fine with no anomalies

I exported again using 3ds out of blender and imported in to MCX - again all the textures showed and I couldn't see geometric deviation as you saw (in your posted shot)
TWR_MCX_1 shows what I saw and it was textually consistent all around - However, note that the wall light objects on tower exterior are missing from the shot - its the same in the blender file so I assume that you didnt use that version for the zip.
I then played about with the MCX lighting and produced a similar, but not exactly the effect to the one you have in the first shot (TWR_MCX_2)


My only issue was the orientation in the Obj export out of Blender > to MCX. (TWR_MCX_3) you'll see the buildings below the grid - this is the same on all imports and the shadow function turned on . else everything is set to default in MCX.

Based on my messing about with the MCX light functions - have you tried (1) altering them initiall to see if teh geometry still shows deviation.

(2) exporting from Blender in another file type that MCX will accept like 3ds just in case.

These are just suggestions to eliminate .

I have also exported out of MCX as a DAE in to blender .................... That was fine as well. Have you considered testing the TWR as an exported MDL file in fsx, place it using ADE as a building at an airport and "walking around" to see if it looks right?
 

Attachments

Last edited:

MOUSY

Resource contributor
#13
Hi gfxpilot, thanks for taking a look. The initial geometry does not contain any deviations. Yes I removed the lights as they were part of another object. Yes the same lighting problems occur in sim as in MCX.

I have not tried exporting to another format but I will try now. In my experience the 3DS format has issues with long file names, but I will see how I can deal with that.
 
#14
Mousy, I love a good mystery.

I ve suggestion. Ive just tried to rename the file and a DAE, placed it on my Desktop and then launched it (forgive the pun in a flight sim forum) in MCX - Its coming up as expected without the taxures and all they "chequer points" look good, I used the MCX materials editor to add in the texture in the defused section. all came up fine this end . Do you want to pm me your email (only if your happy ) and Ill send you the dae and then the texture png. That way there's no issue of zipping causing any issues as well.

Try importing that into MCX - This end Ive done it multiple times with differing names and the file looks right no issues anywhere - have also pulled in the same dae into blender and added some more lighting and its there as well no geo issues showing at all. Im wondering is there an issue with the 3 way import across SU, Blender and MCX reading your file .
 

Pyscen

Resource contributor
#15
Just wondering....

Has anyone tried using the Blender2FSX/P3D toolset within Blender - alleviating having to go from one application to another and then another (just from SketchUp -> Blender and the Toolset?)
 
#16
I gave it a go a while ago. Added it in to blender as per spec but it didnt work - haven't tried it again since - but when all else fails - Go to the Pub!
 

MOUSY

Resource contributor
#17
Are we using the same version of Blender? I am on 2.79b.

I exported as a DAE from Blender for MCX and the textures just went all over the place as was expected - no change with that
I can get textures out of Blender correctly using DAE by setting the export options to UV textures as opposed to Materials. However the normals are still incorrect.

I exported as an Obj file - in MCX the orientation of the model went 90 degrees and dropped through the grid - but texture appears fine with no anomalies
I used Blenders default OBJ export options, which causes the orientation change, but the normals are still incorrect, as expected. The orientation can be fixed by changed by the axes to X-Forward and Z-up.

I exported again using 3ds out of blender and imported in to MCX - again all the textures showed and I couldn't see geometric deviation as you saw (in your posted shot)
How did you get the correct filenames out of Blender using the 3DS format? The export gives no options for textures/materials and, as expected the file names are either too short or too long. (For example Terminal_Windows_Doors_Front.png becomes Terminal_Win.000 and RS_Clutter_1.png becomes RS_Clutter_1.000) This will result in me having to manually correct each texture in MCX which I have been trying to avoid.
However, the normals are now correct.


Has anyone tried using the Blender2FSX/P3D toolset within Blender - alleviating having to go from one application to another and then another (just from SketchUp -> Blender and the Toolset?)
The toolset gives the same results on export as the normals are set incorrectly on import.
 

MOUSY

Resource contributor
#18
I have found the culprit. Some research has lead me to believe that Sketchup's OBJ exporter gives custom normals which are incorrectly interpreted by Blender.
These have to be cleared from the mesh using the Properties Toolbar > Object Data > Geometry Data > Clear Custom Split Normals
Capture.JPG


I have also written a script which clears the custom split normals for all selected objects (just in case you hate repeating the same clicks over and over again).
Python:
import bpy

objects = bpy.context.selected_objects

for obj in objects:
    if obj.type == 'MESH':
        if obj is not None:
            bpy.context.scene.objects.active = obj
            if bpy.ops.object.mode_set.poll():
                bpy.ops.object.mode_set(mode='EDIT')
                if bpy.ops.mesh.customdata_custom_splitnormals_clear.poll():
                    bpy.ops.mesh.customdata_custom_splitnormals_clear()
                bpy.ops.object.mode_set(mode='OBJECT')
Thanks to all for your help.
 
#19
GOOD NEWS!

Glad youve got that sorted - its a learning curve for us all and one to remember

On the point of the exported Obj file. I had already exported the file as a dae, the textures came across on the consolidated sheet. When I imported the obj in to MCX I went to the materials editor, selected the checkered TVSA_Tower, scrolled down to the defuse texture, opted to select the texture file in the location I had it and it populated perfectly. Because all the texures are burned to the one sheet it brings over the coordinates
 

dave hoeffgen

Resource contributor
#20
I have found the culprit. Some research has lead me to believe that Sketchup's OBJ exporter gives custom normals which are incorrectly interpreted by Blender.
These have to be cleared from the mesh using the Properties Toolbar > Object Data > Geometry Data > Clear Custom Split Normals
View attachment 43677


I have also written a script which clears the custom split normals for all selected objects (just in case you hate repeating the same clicks over and over again).
Python:
import bpy

objects = bpy.context.selected_objects

for obj in objects:
    if obj.type == 'MESH':
        if obj is not None:
            bpy.context.scene.objects.active = obj
            if bpy.ops.object.mode_set.poll():
                bpy.ops.object.mode_set(mode='EDIT')
                if bpy.ops.mesh.customdata_custom_splitnormals_clear.poll():
                    bpy.ops.mesh.customdata_custom_splitnormals_clear()
                bpy.ops.object.mode_set(mode='OBJECT')
Thanks to all for your help.
Pretty interesting. I wasn't aware of that one as I'm not used to import stuff into Blender.
Thanks for sharing :)
 
Top