sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Level Import to UE4

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 4 Posters 1.4k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B Offline
      Bentet
      last edited by

      Hi.

      First of all, this is my first post in this forum. I've been a lurker for many years and now I'm getting my first hands on ruby development. This community has been very helpful to me these past few years. 😃

      Now onto the topic.

      I'm currently using sketchup as a development tool for a VR experience based in historical reconstruction in Unreal Engine 4. All the assets are then exported to max and given the proper treatment for realtime.

      Thing is, all the measurements and positioning of objects, mainly architectonical pieces are based off real world sizes and layout. Due to this, the level assembly inside UE4 becomes nigh impossible due to the oblique angles and no vertex snapping in repeatable pieces in the editor.

      To this end, I'm using sketchup itself as a level assembly tool. All objects are given an impostor component inside sketchup with the same pivot. I'm then exporting the whole thing to 3ds max and using a max script like this:

      rollout test "Copy to UE4"
      (
      
      	label packagelabel "Folder Path" style_sunkenedge;false width;180 height;20
      	edittext packagename "" width;180
      	label objectlabel "Object Name" style_sunkenedge;false width;180 height;20
      	edittext objectname "" width;180
      
      	button btnCopy "Copy" width;180
      
      	fn round_to val =
      	(
      	(floor (val + 0.5))
      	)
      	on btnCopy pressed do 	
      	(
      		
      		clipboardstring=""
      
      		clipboardstring += ("Begin Map")
      		clipboardstring += ("\n"+"   Begin Level")
      		
      		for obj in selection do
      			
      		(
      
      
      			clipboardstring += ("\n"+"      Begin Actor Class=StaticMeshActor Name=" + objectname.text + " Archetype=StaticMeshActor'/Script/Engine.Default__StaticMeshActor'")
      			clipboardstring += ("\n"+"         Begin Object Class=StaticMeshComponent Name=StaticMeshComponent0 ObjName=StaticMeshComponent0 Archetype=StaticMeshComponent'/Script/Engine.Default__StaticMeshActor;StaticMeshComponent0'")
      			clipboardstring += ("\n"+"         End Object")
      			clipboardstring += ("\n"+"         Begin Object Name=StaticMeshComponent0")
      			clipboardstring += ("\n"+"            StaticMesh=StaticMesh'" + packagename.text + objectname.text + "." + objectname.text + "'")
      			clipboardstring += ("\n"+"            StaticMeshDerivedDataKey=\"STATICMESH_34081786561B425A9523C94540EA599D_359a029847e84730ba516769d0f19427_08B81D3F4753513B93E720832A7E9708000000000100000001000000000000000000803F0000803F00000000000000000000344203030300000000\"")
      			clipboardstring += ("\n"+"            RelativeLocation=(X=" + obj.transform.position.x as string)
      			clipboardstring += (",Y=" + ((obj.transform.position.y) - (obj.transform.position.y) - (obj.transform.position.y)) as string)
      			clipboardstring += (",Z=" + obj.transform.position.z as string)
      			clipboardstring += (")")
      			clipboardstring += ("\n"+"            RelativeRotation=(Pitch=" + (round_to (obj.rotation.x_rotation) as integer) as string)
      			clipboardstring += (",Yaw=" + (round_to ((obj.rotation.z_rotation * -1)) as integer) as string)
      			clipboardstring += (",Roll=" + (round_to (obj.rotation.y_rotation) as integer) as string)
      			clipboardstring += (")")
      			clipboardstring += ("\n"+"            RelativeScale3D=(X=" + obj.transform.scale.x as string)
      			clipboardstring += (",Y=" + obj.transform.scale.y as string)
      			clipboardstring += (",Z=" + obj.transform.scale.z as string)
      			clipboardstring += (")")
      			clipboardstring += ("\n"+"         End Object")
      			clipboardstring += ("\n"+"         StaticMeshComponent=StaticMeshComponent0")
      			clipboardstring += ("\n"+"         RootComponent=StaticMeshComponent0")
      
      			clipboardstring += ("\n"+"         ActorLabel=\"" + objectname.text + "\"")
      			clipboardstring += ("\n"+"      End Actor")
      
      		)
      			clipboardstring += ("\n"+"   End Level")
      			clipboardstring += ("\n"+"Begin Surface")
      			clipboardstring += ("\n"+"End Surface")
      			clipboardstring += ("\n"+"End Map")
      			SetClipBoardText (clipboardstring as string)
      		)
      
      
      )
      createDialog test 200 160 fgcolor;Black
      

      This code from another user in the UE forums, generates the coordinates of all selected objects to clipboard and allows you to just paste it into UE4. I've made a few modifications to it, but it's still not ideal.

      The problem is this process gets pretty cumbersome after some time due to having to export the huge level to max each time.

      I'm currently trying to recreate this script's functionality inside sketchup. To simply select the objects you want to translate, and generate the text document for pasting in UE4.

      Can anyone give me some pointers on where I can start? I can write a few simple things in ruby, but this kind of functionality is somewhat beyond my scope at the moment. A tutorial link and a few pointers from more experienced developers would go a long way.

      1 Reply Last reply Reply Quote 0
      • K Offline
        kaas
        last edited by

        To keep the orientation and position of objects (groups) in UE just like in Sketchup, I just wrap them into a component with its axis set at the origin.
        Normally I end up with: 1 component (axis at origin) with all the terrain objects (groups) in it, 1 component (axis at origin) with all the exterior building objects and 1 component (axis at origin) for the interior / furniture.

        I use fbx export (selected) to get them directly into UE.

        Edit: maybe have another look if you really need every object to go through 3dMax as well. Only some objects I run through Blender for mapping but most of them are just plain Sketchup-> fbx ->UE

        1 Reply Last reply Reply Quote 0
        • B Offline
          Bentet
          last edited by

          I know what you're saying. But it's just impractical to have every object with the pivot at the origin. Not only this would cause precision errors due to scale, but I also have architectural pieces that are repeated literally hundreds of times. To make each one of those into a unique object with the pivot at origin would be a nightmare.

          About using it directly form sketchup to Unreal: I really would rather not do anything like that because i'd rather have precise control of all the UV channels for the best lightmapping possible. The auto generated lightmap UV's are beyond shitty and generate a boat load of light seams and other artifacts.

          There's also the point that I need MAX to make the LOD pieces. For performance reasons you'll always want to have LOD models for the most complex pieces in any medium to large scene. Especially for VR.

          Many of the pieces have organic parts sculpted directly in max or zbrush that would just be too impractical or tedious to do in sketchup, not to mention unrealistic results, It's best to combine them in max. Banal stuff like Corinthian Capitals are nigh impossible to do in sketchup in a poly optimized way.

          And last of it, Having the high poly version in max, means I can bake the normal maps into a more sensible versions for realtime while still maintaining a great deal of visual detail. Not to mention baking Ambient Occlusion and other specialty maps for increased visual quality for each object while maintaining performance.

          In the end, Its all about using different programs to their strengths. Sketchup is really great at precise modelling and level assembly. I use it to make every piece like facades, arches and other elements to be later worked on Max/Zbrush. But their generated meshes are in no way suitable for real time, they have no proper UV's and the low amount of control over edge loops, stray vertices and triangulation, makes it a nightmare for the actual game engine pipeline without the proper care.

          1 Reply Last reply Reply Quote 0
          • J Offline
            jaopedro
            last edited by

            Hey, Bentet, have you had any progress on it? I'm struggling with the same issues...

            1 Reply Last reply Reply Quote 0
            • Dan RathbunD Offline
              Dan Rathbun
              last edited by

              @bentet said:

              Can anyone give me some pointers on where I can start? I can write a few simple things in ruby, but this kind of functionality is somewhat beyond my scope at the moment. A tutorial link and a few pointers from more experienced developers would go a long way.

              --> topic: SketchUp-Ruby Resources

              Before you can use the SketchUp API with Ruby, you need to learn the basics of Ruby, including how to look up methods for the Ruby Base classes.

              I'm not here much anymore.

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement