Planetside Software Forums

General => Terragen Discussion => Topic started by: claudius on August 25, 2020, 04:36:13 AM

Title: .obj import problem
Post by: claudius on August 25, 2020, 04:36:13 AM
Hello guys, as long as I import simple .obj I have no issues. When I import complex .obj made by Rhino I have this problems, some object's surfaces look kind of projected somewhere.

As it should be

(https://i.postimg.cc/XXRG0gC7/Screenshot-2.png) (https://postimg.cc/XXRG0gC7)

What I get after importing

(https://i.postimg.cc/8sJJ3Ys0/Screenshot-1.png) (https://postimg.cc/8sJJ3Ys0)

If I import .obj, even quite complex, downloaded from the web everything is ok. Is there something I am missing when I save the .obj, maybe?

Thank you for your time, guys.
Title: Re: .obj import problem
Post by: claudius on August 25, 2020, 05:03:44 AM
Ok guys, Solution (accidentally) found!

When saving the .obj (at least when you made it with Rhino) you  want to make sure you save it with "vertex completely UNWELDED".

Hope this would help others...
Title: Re: .obj import problem
Post by: WAS on October 23, 2020, 11:30:14 PM
I think a similar issue happens with exporting modeled stuff in Blender, requiring the same fix.
Title: Re: .obj import problem
Post by: DMFW on October 25, 2020, 05:28:05 PM
Just jumping onto this thread because I am also having obj import problems with a simple object I modelled myself. In my case, the object comes from Hexagon and imports absolutely fine into Vue but when imported into Terragen part of the geometry is lost altogether (a ring of dodecahedrons). I've tried a number of different export options from Hexagon, all of which seem to work when imported into Vue and all of which suffer from the same problem when imported into Terragen.

The screenshots below show my latest attempt which just tried to remove duplicate points and what happens in all three programs.

Export screenshots (https://photos.app.goo.gl/xoh7LEKaGTSnGJyaA)

Any ideas for other things I could try, either in Hexagon and the export or in Terragen and the import?
Title: Re: .obj import problem
Post by: David on October 25, 2020, 05:43:48 PM
A few months back I too was having OBJ export/import problems before Oshyan suggested I export my models from PoseRay, it's free. It seems that every 3D program has it's own quirky approach to OBJ's and mine, Lightwave, is no different. It took me ages to learn that it didn't export them properly unless the UV's were manually configured in the surface editor before saving. I'd wrongly assumed this to be automatic.

In PoseRay I find the key menus are under the groups tab. Hit the following buttons:
Recalculate normals
Weld vertices
Remove orphan vertices
Remove non-visible groups
Then go to the OBJ Output tab

I hope this helps.
Title: Re: .obj import problem
Post by: DMFW on October 25, 2020, 06:16:22 PM
I do seem to have a work around now :). Your post first prompted me to first try turning off UV export in Hexagon which I hadn't even thought might be an issue. My model isn't textured and I plan to use surface shaders on it directly in Terragen since I don't need complicated material zones or anything in this case (it'll all be shaded the same). Whilst that export option didn't work, the idea of using a secondary program for export has worked. I just thought before trying PoseRay (which I am now definitely going to get hold of) I'd just give the Vue export function a whirl to see if what it generated from the successful import would work better in Terragen. Lots more option switches available in Vue but the default seemed to do the trick in this case. Terragen reflects the correct geometry from the Vue export.
Title: Re: .obj import problem
Post by: sboerner on October 25, 2020, 06:30:12 PM
QuoteJust jumping onto this thread because I am also having obj import problems with a simple object I modelled myself. In my case, the object comes from Hexagon and imports absolutely fine into Vue but when imported into Terragen part of the geometry is lost altogether (a ring of dodecahedrons). I've tried a number of different export options from Hexagon, all of which seem to work when imported into Vue and all of which suffer from the same problem when imported into Terragen.

The screenshots below show my latest attempt which just tried to remove duplicate points and what happens in all three programs.
Just an educated guess: It looks like those shapes contain some n-gons (polygons with more than four edges). Terragen won't render n-gons; it requires triangles or quads. I don't know Hexagon but perhaps there is a way to tell it to export triangle meshes. Or maybe you can rebuild the shapes manually. 


Terragen's renderer is pretty strict when it comes to clean meshes. No n-gons, nonmanifold geometry, flipped normals, that sort of thing. The benefit is that it can handle anything you give it, regardless of the poly count or number of models in a scene. My scenes often contain hundreds of multi-million-poly meshes (counting populations) and it doesn't even blink.

I'd be happy to take a look at the obj file. (You can contact me via pm if you don't want to create a public link here.)


QuoteI think a similar issue happens with exporting modeled stuff in Blender, requiring the same fix.
I've never had any issues with exported obj's from Blender.
Title: Re: .obj import problem
Post by: WAS on October 25, 2020, 06:54:40 PM
Quote from: sboerner on October 25, 2020, 06:30:12 PM
Quote from: undefinedJust jumping onto this thread because I am also having obj import problems with a simple object I modelled myself. In my case, the object comes from Hexagon and imports absolutely fine into Vue but when imported into Terragen part of the geometry is lost altogether (a ring of dodecahedrons). I've tried a number of different export options from Hexagon, all of which seem to work when imported into Vue and all of which suffer from the same problem when imported into Terragen.

The screenshots below show my latest attempt which just tried to remove duplicate points and what happens in all three programs.
Just an educated guess: It looks like those shapes contain some n-gons (polygons with more than four edges). Terragen won't render n-gons; it requires triangles or quads. I don't know Hexagon but perhaps there is a way to tell it to export triangle meshes. Or maybe you can rebuild the shapes manually.


Terragen's renderer is pretty strict when it comes to clean meshes. No n-gons, nonmanifold geometry, flipped normals, that sort of thing. The benefit is that it can handle anything you give it, regardless of the poly count or number of models in a scene. My scenes often contain hundreds of multi-million-poly meshes (counting populations) and it doesn't even blink.

I'd be happy to take a look at the obj file. (You can contact me via pm if you don't want to create a public link here.)


Quote from: undefinedI think a similar issue happens with exporting modeled stuff in Blender, requiring the same fix.
I've never had any issues with exported obj's from Blender.

My friends been exporting his Eevee scenes and they need to be non-vertex welded to work in TG. Simple checkbox he said. He's only been learning Blender so he's been working all within house but was curious how his stuff looked in a environment.
Title: Re: .obj import problem
Post by: DMFW on October 25, 2020, 07:09:22 PM
Ah, the n-gon issue would probably explain it! I've attached the obj file as exported from Hexagon to the end of this post just for interest but I did use a built in dodecahedron which does not have triangular faces and then extruded the "spoke" from one of those faces at the very point where the geometry goes missing. The spokes do not join to the central ring in the original model, by the way. They hold the ring in place with forcefields or some such handwaving until/unless I go on to enrich the model! This was an early stage test at integration with the Terragen scene and there is going to be more work on the model later but I'm pleased to have identifed this issue now, rather than later when I've built something more complicated I can't import. I guess my work around with the Vue export modified the faces in the way Terragen likes. I think Hexagon has tools for refactoring surfaces and it may be that there is some way I can make a similar change there before exporting which would obviously be a simpler work flow. I am neither an expert modeller nor an especially experienced Terragen user so I'll need to investigate that further but it could well be that there is an answer in Hexagon now I know that's the issue I'm looking for.

GreatHammer.zip
GreatHammer.zip
Title: Re: .obj import problem
Post by: DMFW on October 25, 2020, 07:16:14 PM
I've found a button in Hexagon called "triangulate non planar faces". Looks like that will make the model safe for export  :)
Title: Re: .obj import problem
Post by: sboerner on October 25, 2020, 11:24:46 PM
QuoteI've found a button in Hexagon called "triangulate non planar faces". Looks like that will make the model safe for export  :)
Excellent! And yes the dodecahedrons are made of five-sided polys. Vue may be triangulating them on import.


Let us know how things work out. And welcome to the forum, by the way. When you have some renderings, please share in the images section.
Title: Re: .obj import problem
Post by: Dune on October 26, 2020, 02:31:50 AM
I had trouble with more than 4 sided polys as well. Now export from Lightwave, import in Poseray. PR does not triangulate automatically, so I have to do that in LW. I also used to have issues with UV when not unwelding, so now I unweld everything, export as lwo and import in Poseray, weld and recalculate normals for every part as it needs to be, then save as obj.
Title: Re: .obj import problem
Post by: DMFW on October 27, 2020, 05:07:55 AM
Just confirming that when I applied a fix to triangulate the faces in Hexagon, the exported obj worked perfectly in Terragen (although as it happens in my final image I chose to sink the model into a crater where the success of the import isn't so obvious. But it did work!)

In case anyone using Heaxgon ever reads this, here's a quick screen shot of how to find the relevent button and what it does:-

TerragenPreExportFix.png