Unreal Engine 4 and Blender – Skybox

So basically, how to create or how to bake skymap in Blender and use it in Unreal Engine 4. We are focusing more of unreal part in this tutorial. Plus we are going to use Photoshop but you can do it with Gimp too, you just need to get gimp cubemap plugin.

Project files:

Blender File 2.78 (11 Mb) – GoogleDrive

Backup – Dropbox

Blender file is setup with world material nodes, cube, materials and uv’s. You don’t really need it if you have decent amount of experience with Blender. It’s more for beginners to study.

You need Nvidia texture tools for Photoshop to able to save as cubemap.

https://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop

This is how we have set up baking cube in Blender.

Screenshot_35

Plane number 1 is pointing towards front ortho in Blender. If you rotate viewport counter clock wise around cube, we’re going through 2, 3, 4. Top is 5 and bottom is 6.

Note: number 2 should actually be front but we won’t get so good quality with that plan.

boxes2

We have 6 Materials they each control one texture, UV map is overlapped (all with same rotation).

To pack it as cubemap texture we need to import all images in Photoshop and match it like this:

boxescorrect_updated.png

Baking box/cube is in layer 1 and visualization planes are on layer 2. We only need the cube to do the baking job.

Blend file is packed so first you need to unpack it. Uncheck “automatically pack into .blend” and “unpack all into files”. We are using 2048 x 2048 texture resolution.

You might like to change render device to GPU, goes like 8-12 times faster.

Screenshot_34

Select your cube and set bake type to Enviroment and hit Bake.

Screenshot_37

Go to uv edit and save all images.

Putting it together with Photoshop

Create a new document. Width needs to be Resolution x 6.

Screenshot_2

File -> Place Embedded

Screenshot_3

You can rotate texture number one from the settings on top and get it in right place by changing X to 1024.

Screenshot_4

You can also use Move tool. Don’t leave any empty space, make sure you use every pixel.

Screenshot_5

All in place:

Screenshot_5.png

When you’re done save it as DDS file.

Screenshot_7

Screenshot_10

Make sure you got Cube Map. After saving don’t close Photoshop yet.

Screenshot_11

Unreal Engine 4 -> blank project -> remove sky sphere from world outliner.

Import it in Unreal Engine 4. This might take a while. 2k textures should finish in 20 minutes, 4k textures takes 50 minutes or even more. You can actually cheat it if you first import with 512 px and re import with 4k textures. Re import always takes about 3 or 6 minutes no matter of resolution.

Update: seems like it works faster with 4.15.

Screenshot_12

Texture Settings and Material

Double click cubemap texture in content browser. Change mip map gen setting: nomipmaps and texture group: skybox.

Screenshot_18

Now we need to create skybox material so add a new Material.

Screenshot_16

Open it and change couple things like shading mode, two sided.

Screenshot_1

Drag cubemap texture in your material and set up it like in picture:

Constant value is 8 if picture is unclear for you.

Screenshot_20

Skybox Blueprint

It’s much easier if we just add empty blueprint rather then edit the one located in engine content.

Add blueprint class -> actor.

Screenshot_21

Screenshot_22

Open it. Add Static Mesh and name it something like skydome.

Screenshot_23

Go to Construction Script. Add Set Material and Set Static Mesh and make it look like in picture below.

Promote public variables to “New Mesh” and “Material” (right click).

Screenshot_42

Note the eye in Variables list.

Screenshot_41

Now you can add your own Sky Material and Sky Sphere (from engine content).

Screenshot_43

Screenshot_3.png

Change settings in skydome mesh.

Screenshot_44

Screenshot_2

Quality

Make sure you use right compression settings. Or you might get something ugly.

Screenshot_26

So much better.

Why i added that arrow there… (haha).

Screenshot_27

Stars

We can actually add stars inside our material in unreal. But first we need to get rid of stars we have in Blender.

Screenshot_33

Bake it again and save all images.

Lets go back to Photoshop.

Right click layer and click Replace Contents.

Screenshot_31

Match the number and hit Place. Go through all layers. Export as cubemap again and reimport in ue4 (right click on cubemap in content browser).

Screenshot_32

Go back to sky material.

Add Texture Sample and change texture to T_Sky_Stars (engine content).

Screenshot_29

Add few more things like texturecoord, scalarparameter, multiply and lerp.

TexCoord settings are:

  • Coordinate index: 1
  • Utiling: 12
  • Vtiling: 12

ScalarParameter value is 0.1

And connect it all like in below.

Screenshot_30

Looking good but stars should be behind moon. You can probably figure it out though *wink*.

ScreenShot00005.png

If your scene is on planet this workflow doesn’t work well. Usually people wan’t more dynamic sky maps. But if your scene is in space then this is very good way to do it. But now you know how to work with sky maps in ue4 and that was the whole point of this tutorial.

Noise texture node in Blender made that white spot in textures. It helps you to see if bottom texture is correctly set though.

Thanks for reading!

Ubuntu Server – LVM with LUKS Encryption made easy 2017

How it works?

When you boot your server it asks for password (not your system user password) for getting the access to data on hard drive(s). You only need to enter decryption password for once in boot process.
LVM is made of logical volumes, volume group and physical volumes

  • Logical volume is place where the actual data is located.
  • Volume group is name for your group.
  • Physical volume is your hard drive.

Logical volume is the part where encryption and decryption happens

We can manage whole LVM setup with Webmin.

Hardware

1 server, monitor + keyboard
Desktop pc or Laptop with Ssh like Putty
usb stick (2gb) or empty dvd

Files

some files might take more then 10 minutes to download so consider starting the downloads right now.

Ubuntu server iso
Ubuntu desktop iso /kali linux (for verifying your data is safe)
Rufus/Unetbootin

https://www.ubuntu.com/download/server
https://www.ubuntu.com/download/desktop
https://www.kali.org/downloads/

https://rufus.akeo.ie/
https://sourceforge.net/projects/unetbootin/

http://www.putty.org/

Installing Ubuntu server with live cd/usb

screenshot_6

Make your language selections.

screenshot_1

screenshot_2

screenshot_3

Select No and select it manually from the list.

screenshot_5

screenshot_7

screenshot_8

screenshot_9

screenshot_11

screenshot_12

Select No.

screenshot_13

Choose guided use entire disk and set up encrypted lvm.

screenshot_15

Choose the disk where you wan’t to install the main system. Ignore all other disks for now.

screenshot_16

screenshot_17

Create another password for encryption.

screenshot_18

screenshot_19

You can manage empty space later on if you don’t like to use 100% of your disk.

screenshot_20

screenshot_21

screenshot_22

screenshot_23

screenshot_24

screenshot_25

screenshot_26

At least select openssh.

screenshot_27

If it shows you list of disks just select the one where you are installing right now.

screenshot_28

Now it’s time to reboot.

screenshot_29

And this is the part where you type encryption password.

screenshot_30

And after boot.

screenshot_31

Installing Webmin

Up to date installing instructions are located at:
http://www.webmin.com/deb.html
Go for the option:
”Using the Webmin APT repository”

Adding a hard drive in LVM

Login to Webmin. Look for Dasboard and expand Hardware and go to Logical Volume Management.

screenshot_1

Volume Groups
You don’t need to do anything here if you already have a volume group like in picture below.

sdfsdf

Physical Volume
Click: Add a physical volume to ubuntu-gv

ragrg

Select hard drive you wan’t to add, from list. If you can’t guess it from the list. Type in shell fdisk -l and type device name in the box located next to list. Device name like: /dev/sdc.

regerg

Logical Volume
Click: Create a logical volume in ubuntu-vg.

aergreag

Add name in Volume name… extend_1 …extend_2

Click Create.

screenshot_3

Click Logical Volume you just created.

screenshot_8

Now you need to format it, so select ext4 from the list and click Create Filesystem of Type:

screenshot_5

Continue by clicking Create.

screenshot_6

If everything worked out:

screenshot_7

How to format with shell command:

Use fdisk -l and when you find it do: mkfs -t ext4 /dev/mapper/ubuntu–vg-extend_2 (replace /dev/mapper/xxxxx with your version of course). Even tho it shows /dev/ubuntu-vg/extend_2 .. in the picture just use the version fdisk gives you.

Go back to your Logical Volume details and mount it. Example:

screenshot_9

Make sure you have it right in LVM logical volume and click Create.

screenshot_10

That’s the basics how you can manage it. If you wan’t to add more hard drives just shutdown your server and plug in a new hdd. You might even able to add it without shutdown if your motherboard allows it, just make sure you test that in the beginning when you drives are still empty. Now you can share it easily with Samba using the mount location: /home/xxxxxx.

Remember if you wan’t to remove hard drives and add them back later on, make sure you add comment mark # in /etc/fstab file.

screenshot_3

Blender – Shortcuts, Buttons and Tricks in one place

Most of the shortcuts for Object, Edit, Uv mode. This is more like to-get-things-done list and doesn’t represent everything. Took me about 10 months to learn all this, through hundreds of youtube videos and blender docs. So i hope you save some time.

Basic

Mouse Left Set 3D Cursor location
Mouse Right Select
Mousewheel hold Rotate viewport
-Hold Shift to move.
Tab Switch between object and edit mode.
G Move selection
  -Move in one axis, Y, X, Z.
  -Multiple axis, Axis → Shift + Axis (works with Scale and Rotato too)
S Y, X, Z
  -Level/Flatten Selection, Axis → 0
  -Flip, Axis → Minus Button → 1
R Rotate
  -Y, X, Z.
Alt + S Shrink/Fatten
  -S or Alt For even thickness.
Z Wireframe
A Select/Deselect All
L Select Islands
C Select with circle
  -Scale with mouse wheel.
E Extrude
Ctrl + B  Bevel
Shift + Tab Snapping
Shift + D Dublicate
Alt + D Linked Dublicate
H Hide
Alt + H Unhide

Menus (Edit Mode)

X Delete
  -Del works too but X is closer.

screenshot_5

W Specials
  -Your favorite.

screenshot_6

Ctrl + Alt + Shift + C Set Origin/Pivot

screenshot_7

Ctrl + F Faces

screenshot_8

Ctrl + V Vertices

screenshot_9

Ctrl + H Hooks

screenshot_10

U Unwrap
-Start unwrapping so you can paint textures.

screenshot_11

Screen Layout

screenshot_16

T Left Panel
-If you wanna find a solution with your eyes

screenshot_12

N Right panel
-Object scales, viewport settings.l

screenshot_13

Shift + A Add meshes

screenshot_14

P Separate
-Separates selection into another object.

screenshot_15

Render, render layers, scene, world, object data, constraints, modifiers, mesh data, material, texture, particles and physics.

screenshot_17

If you don’t remember just click the Mesh text, you can see in the pic below:

screenshot_18

Menus (Object Mode)

Ctrl + A Reset, Location, Scale

Camera/viewport (num pad)

, (comma) Focus on selection
0 Swith between viewport and camera (if it’s added)
5 Perspective/Ortho
   
7 Top Ortho, Z axis
3 Right Ortho, X axis
1 Front Ortho, Y Axis
9 Bottom Ortho
   
4 Rotate Left
6 Rotate Right
8 Rotate Up
2 Rotate Down
   
Shift + C Reset distance and 3D Cursor location (only in object mode)

Advanced

Ctrl + R Loop subdivide
  -You can’t live without this.
  -How pros use it: https://youtu.be/xFZazwvYc5o?t=25m23s
K Knife Tool
  -Add edges wherever you like.
Menu → Mesh → Bisect  
  -Cutting tool.
Recalculate Faces Ctrl + N
  -Flips drawing surface(s) in correct direction. Won’t always do perfect job though.
Triangulate Faces Ctrl + N
  -For Cleaning n-gons.
Faces menu Tris to Quads
  -Quads are always better then tris.
Smart Uv Project U
  -When you don’t have time for manual unwrapping.
  -Always uncheck ”Stretch to uv bounds”, it will ruin it. Rather use pack islands.
Pack Islands Ctrl + P (uv edit mode)
  -Margin settings goes to mesh edit window (left panel) for some reason but you can get the settings panel out it with F6 on uv editing window.
Get Rid of Gridfloor N → Display → Grid Floor
Better start up setup Start up fresh new Blender window. Delete camera and cube, then just go to: File → Save Startupfile.
Bridge Edge loops Specials menu
  -Best way to fill empty space between edges. F should be like the last option.
Smoothing Specials menu
  -If it’s a ball, add. If it’s a cube, don’t.
Slide Ctrl + V -> Slide
  -When you wan’t to move something along angled path.

Modifiers you should know about

Boolean – make holes, combine or just interact with another object.
Remesh – Rebuilds your whole mesh with quads.
Decimate – Less faces/vertices.
Array – Dublicates your object in desired axis.
Mirror – If you need to build something like human face, so you only need to model half of the face.
Subdivision Surface & Multiresolution – Adds more geometry/faces to your mesh and so makes it look more detailed. It’s pretty quad based.

Clean up Procedure, before you unwrap

1. Remove Doubles ( W )
2. Reset Rotation & Scale (Ctrl + A)
3. Fix Faces Direction (Ctrl + N)
4. Fix Pivot Location (Ctrl + Alt + Shift + C):

For rendering in Blender do origin to geometry.
Exporting for game engines, substance softwares other rendering platforms do: Origin to 3D cursor → Geometry to origin. Ctrl + C for resetting the 3D cursor if it’s not in zero place.

If you are doing something messy, better do this before “Remove Doubles” option: Mesh → Clean Up → Fill Holes.

Fbx export options you can find on my other tutorials.

Blender and Unreal Engine 4 – Going Commercial

If you are interested in working with Blender like building Levels, Props or anything, and make it work in Unreal Engine 4, plus sell it. There are some things you need to know, before you can sell it to the World. Your mesh may look just awesome in Cycles but when you import it in Unreal Engine 4, that’s the point where your life comes crashing down. Though you can’t really compare Cycles and UE4, picture render and game engine cause it literally is day and night.

Get rid of N-Gons

screenshot_7

Plugin that will show you n-gons
https://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Mesh/Face_Info_Select

Uv Mapping

wwwwwasdas

Before you Export

0006

Checklist – Before you sell

asdas

  • No n-gons. Only Quads and tris, more quads more better.
  • Perfect light maps.
  • PBR (Requires Substance Painter).
  • Smoothing everywhere (no hard edges).
  • Real World Scales.
  • Clean names.
  • Mesh can take Subsurface Modifier and keep its geometry, Suzanne is a good example.
  • Vert count as low as possible (low poly).

Have some LODs. If your object is designed to be used only once, in one level and it has less then 5000 verts then you don’t really need LODs.

200k vertices in one level is good, 1mill vertices is bad. But it all matters how much your graphic card is currently handling.

What i get with gtx 660: 100k = 120fps, 500k = 60-90fps, 1mill = 30fps.

Sometimes mipmaps can give you these white or black edges. It gets worse with large textures and there’s always some with 8192 and 4096 textures.

If you paint with Substance Painter it usually deals great with them and you don’t need to worry about it.

If you paint with photoshop or gimp always expand/grow base colors over uv island.

screenshot_7

How much you should expand:

8k textures = 16 pixels

4k texture = 8 pixels

And so on…

asfafasf

Pivot Location

Keep pivot in 3D cursor spot and mesh located close to it (shift+c -> ctrl+alt+shift+c -> Origin to 3D Cursors).

screenshot_8

Almost same thing with multiple objects but you need to be able to scale whole packet together, so set pivot according to that.

screenshot_7

Let’s say if you have a car. Body has its own object and wheels + suspensions are another object and pivot for both objects are in same spot it will scale fine. But if pivot is located center of geometry for both objects, they will scale wrong.

Pivot in same spot:

screenshot_9

Pivot in different places:

screenshot_8

I cheated there little bit cause Blender doesn’t care much about pivot, it will scale it correct anyway, but the picture shows you the result you get in UE4.

If mesh is far away from zero spot it will import, but you may never find the mesh in ue4 after you drag it in level.

Screenshot_10.png

List is very big, but give it couple months and it will be drilled down into your brain.

You should also check out UE4 Marketplace Guidelines.

If you are planning to build a game then this is perfect thing for you, you will avoid several problems.

Believe it or not but you are now ready to make saleable-games, assets and so on.

Please check out: Texel Density tutor on Artstation by this awesome Ubisoft guy.

 

 

Legend:

  • LOD = Level of Detail
  • Vert = Vertice
  • UE4 = Unreal Engine 4
  • PBR = Physically based rendering
  • Smoothing = Smooth Shading
  • Mesh = Static mesh / Object
  • Suzanne = Monkey from add object list (shift+a)
  • Zero Spot = Location 0,0,0

From Blender to Unreal Engine 4 – Workflow and Project Set up

I’m going to show you how you can speed up things when working with Blender and UE4.

I faced some problems while making this tutor and i didn’t go back and redo it, cause it was important to show you how to fix them. Someday you’re going to face same problems too.

Let’s start with Creating New Project in UE4. Create new project -> first person.

Softwares used in this tutorial

Substance Painter 2.4.1

Unreal Engine 4.14.3

Blender 2.78

Blender setup

Now while UE4 is loading in background you can start Blender and make some shortcuts. Plan is that you can export with just a couple buttons instantly, you are going to use export fbx option so many times.

Select: File -> Export -> FBX (right mouse) and Add Shortcut.

screenshot_6

Go into Export -> FBX and do the same with “Export FBX” button located in right top corner.

screenshot_7

If you have a gaming mouse it usually got some extra buttons so what i did, i set up couple buttons from my mouse to these export choices.

Make sure you have Units set up as Metric.

Object

First i added Cube.

screenshot_6

Then i went into Edit mode and Selected all -> Mark Seam.

screenshot_7

U -> Unwrap

screenshot_8

Uv Edit mode -> Select all -> UVs -> Pack Islands

screenshot_9

Change island margin to 0.03

screenshot_10

Object mode -> Add Subdivision Surface modifier

screenshot_11

Set view up to 4 and Apply.

screenshot_12

And this is how it looks like in Uv mode now.

screenshot_13

Add Material. When working with UE4 you should use form like this when naming your materials: “M_NAME” so just add M_ at the start. Name your static meshes like this SM_MyMesh.

With personal projects i only add _M end of the material name and leave meshes without SM_, like this:

screenshot_21

https://wiki.unrealengine.com/Assets_Naming_Convention

Settings

This is how you should save Blender file.

Documents -> Unreal Projects -> MyProject:

screenshot_19

And add Folder “Meshes” right here

Documents -> Unreal Projects -> MyProject -> Content:

screenshot_20

Save your Blender File:

In Blender Folder.

saveblenderfile

Export Settings in Blender:

screenshot_16

screenshot_15

Export it in “Meshes” Folder you created like 5 seconds ago.

Now when you hit “Export FBX”, jump to UE4 and you should see this:

Check “don’t ask again” and press import.

screenshot_17

Import settings. Uncheck some things like Auto generate collision and Generate Lightmap UVs, Combine meshes.

screenshot_18

Unreal Engine 4

And it should look like this:

screenshot_22

One thing i forgot to add was…

screenshot_28

Shade Smooth but that is like 3 second job

screenshot_29

Now Export it with your shortcut buttons, for me it was just two clicks with my mouse.

It gives you message when it reimports it automatically, all you need to do is just export it in Blender.

screenshot_25

Looking really good.

screenshot_30

Lightmap

So since we didn’t generate uv map for lights (that button you unchecked in ue4 import settings), we need to make it in Blender.

Select your mesh and go to mesh settings. There you’ll find UV Maps and just press plus button to add a new one.

screenshot_23

In Uv edit mode you can take a look at it (follow red arrows):

screenshot_24

And how you find it in UE4 (double click the mesh in content browser):

screenshot_26

Change “Light map coordinate index” to match channel number:

Note: if you import with 2 uv maps it selects “Channel 1” automatically. In this tutorial we imported with 1 uv map so it selected “Channel 0”.

screenshot_27

Q&A

Q: Why should i build lightmap myself and not use “generate lightmap option”?

A: It’s a very unprofessional way. After all it’s almost as much work as turning that option on in import settings. Once you start knowing how lightmaps work in unreal engine with different shapes, you can find the max quality of your work easily and avoid the error of clusterf*cks coming on your way.

Q: If i edit my mesh in Blender, do i need to re-unwrap lightmap as well as texture uv map?

A: Yes you need.

Lightmap Problem

It may look fine but when you build lighting then you usually see some problems:

lightmapproblem1

So first what i did. I increased Pack Islands margin:

lightmapproblem2

Looks fine after Reimport.

lightmapproblem3

But when i build lightning. It comes back again.

lightmapproblem4

So i ended up doing this:

  • First i cleared old Seam
  • And made seam in middle
  • Unwrapped
  • Manually moved them in nice places

lightmapproblem5

lightmapproblem6

lightmapproblem7

After lightning build, it was perfect.

lightmapproblem8

Painting/Texturing

So i opened Substance Painter and made something like this with it:

  • Fill Layer
  • Material -> Painted Steel

screenshot_6

Export Settings:

screenshot_7

If you’ve been using Import button before, you know exactly how awesome feature this is:

screenshot_8

Material node setups.

screenshot_9

Where i saved the file.

screenshot_10

Well it didn’t do perfect job, some seams are visible.

screenshot_11

It was looking fine in this picture though.

screenshot_12

That could be fixed by doing the same thing like with lightmap uv. But it’s just extremely hard to paint with any tool, cause of stretching. Changing the UV Projection to Tri-planar in Substance Painter fixes it too.

So what i recommend for the best workflow:

  1. Create project with UE4 – 1 Minute
  2. Build mesh with Blender – All the time you need
  3. Add Material – 10 Second
  4. Add Uv Map for textures – 10 sec – several hours
  5. Add Uv Map for lights – ^
  6. Export in FBX – 10 Seconds
  7. Import mesh into UE4, which it does automatically after first import
  8. Setup Basic Material, just white. – 10 Seconds
  9. Drag & Drop mesh into Level – 2 Seconds
  10. Build Lightning – 2+ Minutes
  11. Check and fix errors – Minutes… Hours…
  12. And you are ready to paint textures

Trust me you could do much worse without the auto import in Unreal Engine 4, 90% of the people who work with these two applications don’t even know about it this. And always test the mesh or whole scene in the game engine before you start texturing.

There’s addon for Blender which does all this work, Google for “blender ue4 tools”. Tho i’m not sure if it works cause it was made like 2 years ago and import settings seem to have changed a lot on unreal since that.

Blender – How to texture rocks, round objects

I’m sure you’ve seen some youtube videos with pretty dumb workflows and result is terrible, sphere projection -> minimize stretch… nope.gif

This is not what you want:

screenshot_7

Well answer is pretty simple, instead of working hours with complicated UV Map and trying to get the map fit over one cubic image and do that without any stretching, just like some kinda Master Wizard of 3D world with super magical wand. We can simply just use smart uv mapping and paint your object with single texture or multiple textures (in 3d viewport), all that just with the tools inside Blender. This way you can create whatever shape you want and let the computer be the wizard for once.

This workflow works with all kinds of round objects, rocks, trees, cliffs and everything where uv map is just a total mess. You could probably paint your object in Photoshop too if you  import your mesh in 3d mode and know how to use brushes in there, but whole job is so effortless in Blender once you just figure it out.

Sculpting a Rock

Remember to turn Cycles Render on

Add Ico Sphere

If you are a beginner with sculpting then you should always start with ico sphere, if you want some cliffs then start with cube.

screenshot_8

Switch to Sculpt Mode

screenshot_9

Enable Dyntopo

Turn Mirroring off

screenshot_10

Go all around the object with it, just one round. Till it looks like this:

screenshot_11

Next step imagine that you are trying to make it look like a cube. Look it from this angle:

screenshot_13

Just go one round around it.

Don’t go here (upside):

screenshot_12

And just make those corners come out little bit.

After that switch brush, select F Crease:

screenshot_16

You need to change some settings

  • Dyntopo Detail 5px
  • Subtract on
  • Auto smooth around 0.5
  • Brush strength 0.25
  • Brush size 35px

screenshot_15

Stay on same distance and just go one round again, all around object, till it’s something like this:

screenshot_17

Now you can use Flatten Brush

screenshot_18

Just go in random places, wherever you like and add small flat areas:

screenshot_19

And that’s it!

  • Switch back to Object mode ->
  • press tab (edit mode) ->
  • press W, make sure everything is selected ->
  • select Shade Smooth:

screenshot_20

UV Map

Switch to UV Editing

screenshot_21

Make sure you are in editing mode on right viewport and you have everything selected:

screenshot_22

Press U (on right viewport), select Smart UV Project:

screenshot_23

Island Margin 0.03 and OK:

screenshot_24

Result (left viewport):

screenshot_25

Now we need to check stretching, press N to open Display Settings and select Stretch:

screenshot_26

Click UVs, and Minimize Stretch (picture below). Blue means it’s not stretched, every other color means stretching and how much. It might go worse or better, you just have to decide yourself but if you have red or yellow parts and they disappear with this option then you should use it but blue to yellow is ok, yellow to red is bad. Hit Enter to stop Minimize stretch. Go back with ctrl + z and select minimize stretch again and look all around the map, you might need to do it for few times till you see everything.

I only used minimize stretch for once, Smart uv project does its job very well.

screenshot_27

Texture and Painting Setups

Object Mode

Lets add Material to our object.

screenshot_30

Click plus on right first and then New:

screenshot_28

screenshot_29

Now it might be a good time to Save your project cause it might crash or just lag for too long.

Go to texture, pointed out with arrow. Make sure you have Brush:

screenshot_31

Add New texture and Open:

screenshot_32

Now it’s time to choose texture you want to use on your rock object. You can go hunt your own or use this:

rock_by_shadowh3

Before you can start painting go back to uv editing and add New Image:

screenshot_35

Set your material, Color -> image texture

screenshot_38

Vector -> UV

screenshot_37

And select image you created:

screenshot_36

screenshot_39

Painting

Now you should be ready to Rock (literally):

screenshot_40

Just in case.

Checklist:

  • Material
  • Uv map
  • Image
  • Brush texture
  • Paint Mode
  • Project saved
  • Coffee (or your choice) 😀
  • Artistic Imagination

Let’s go over some settings:

Brush strength should be full for first round, after that reduce it to 0.8. Keep Blend mode on Mix whole time.

Set Size, x and y to 0.1

screenshot_41

Keep viewport distance same whole time. Now just paint it for first round.

If you see some stretching:

screenshot_42

Aim your viewport at it and wipe it with brush:

screenshot_43

Look for more stretching:

screenshot_44

If you want some parts to look different:

screenshot_45

Just move your viewport little bit and paint the area again:

screenshot_46

Check out the result on uv edit:

screenshot_47

Now that is pretty awesome compared to result of shitty youtube videos, right? 😀

You can add more textures:

screenshot_48

screenshot_49

screenshot_50

And Paint with it:

screenshot_51

screenshot_52

Have Fun! Thanks for reading the whole tutorial. And hope you learned something new today.

From Blender to UE4 – Material and Texture

To end the struggle of Googling this subject and watching pointless videos which may help in last decade but not today. We are going to look how  you can import your mesh you build in Blender to Unreal Engine 4 with materials and UV maps.

Blender

Switch to Cycles render.

Screenshot_1

Select Edit mode (Tab) and open UV editor.

Screenshot_8

Screenshot_3

Make sure all vertices are selected and then press U over your cube. Then hit Smart UV Project.

Screenshot_4

Change Island Margin to 0.03 (by clicking the right arrow once)

Screenshot_5

By doing this we can save us from a lot of trouble in Unreal Engine. And it’s easier to photoshop/paint UV maps when everything is not glued together.

Check out UE4 Lightning Trouble Shoot Guide:

Make sure that your UV islands have at least a 2 pixel spacing between them to prevent light bleed. Account for this based on the target resolution of your lightmap.

Result:

Screenshot_6

Switch back to Default view.

Screenshot_7

Go to material editor on the right and press Use Nodes.

Screenshot_9

Press the button pointed out in picture below and select Image Texture.

Screenshot_10

Then just leave it like this:

Screenshot_11

It won’t import pictures with FBX so you need to import them manually in UE4. Another thing you should know is that you need to UV map all your materials/vertices, if you have multiple materials and not just one area  to paint, if you don’t then result might look stretched in UE4 and it can even give you lightning problems.

Now you are pretty much done in Blender so export your mesh into FBX file.

Screenshot_12

Name it whatever you like and press Export FBX. Then you can save/close Blender.

 

Unreal Engine 4

New Project -> First Person

Press Import in Content Browser and locate your FBX file.

Screenshot_13

Uncheck Auto Generate Collision, click that small arrow pointing down:

Screenshot_14

Uncheck Combine Meshes. Make sure Import Materials is selected and then you can click Import.

Screenshot_15

Drag and drop your Blender cube from Content Browser to viewport.

Screenshot_16

Import the picture you want to add on your cube, im using some wooden floor texture found from google. Double click the material you made in Blender, it should be in Content Browser or if not then you can just click Add New -> Material  and when you are done with material you can just drag it straight to your cube in viewport.

Screenshot_17

In material node editor, move Material little bit right so you can see the color box (it’s called Vector Parameter) under it and then select color box and delete. Drag the picture from Content browser to material node editor.

Screenshot_18

Drag the line from Texture Sample to Base Color just like in picture below:

Screenshot_19

Press Apply and close material node editor. Now you should see it building the shaders for about 5 seconds or more.

Screenshot_20

And final result:

Screenshot_21

Extras

To make your material look much better you need to make Normal map and AmbientOcc map from your texture, you can use online generator for that: http://cpetry.github.io/NormalMap-Online/

When you’ve downloaded and imported both pics, drop them in material node editor and from Normal map: “top white -> Normal” and Ambient map: “red -> Roughness and Green -> Ambient Occlusion”

Check out the video for a lot more (1:05:03):

Check out my another tutorial: From Blender to Unreal Engine 4 – Workflow and Project Set up (2017)

Unity 5 2D Animation Tutorial

A game without animations would be really dull thing to play and probably wouldn’t be popular, who would want to watch sprites flying all over the screen?
Lets learn (in 5 minutes) how to make animation in Unity 5, so you don’t need to watch those 1 hour tutorials which are pure torture 😉

First you need sprites, lots of sprites in one image so i made this animation with gimp, you can probably look for something better but lets use this for now.

(right click -> save…)

spaceman

 

Start by opening Unity, choose 2D and hit Create project.

Screenshot_4

Now you need to import our png image. Select Assets -> Import New Asset. And choose the png image.

Screenshot_5

Now you need to select our image in Assets and then you should see Inspector. In inspector select Sprite Mode -> Multiple and Apply. Now hit the Sprite Editor.

Screenshot_6

In Sprite Editor select Slice and Slice once again. That should make boxes around our images. And then press Apply and you can close Sprite Editor.

Screenshot_7

Now  you need to press small arrow in Assets where our cropped sprites are. Arrow opens up bigger preview of them and then select them all (ctrl + mouse left) and drag them into Scene, it should automatically ask you to save it.

screenshot_8

Now go to Window -> Animation.

Screenshot_10

Just select our spaceman in Scene and then press Create button in Animation window.

Screenshot_11

Now you should have your animation ready, if you press play button in Animation window you should see our spaceman walking super fast. If you double click one of the blue cubes you can adjust the timing or change Samples to 30 to make it walk slower.

Screenshot_12

Phpvirtualbox for Ubuntu 16.04 Server – Install Tutorial 2016

Install VirtualBox

Login as Root and install virtualbox

sudo su

apt install virtualbox

Lamp Server

We need to install apache and php7, you can remove mysql-server from the list if you don’t want to add it right now.

apt install apache2

apt install mysql-server php7.0 libapache2-mod-php7.0 php-xml php-soap

Make a new directory and modify apache DocumentRoot

user = your login name

mkdir /home/user/public_html

chmod 777 /home/user/public_html

nano /etc/apache2/sites-available/000-default.conf

change DocumentRoot to this:

DocumentRoot /home/user/public_html

and add this, just like in image:

<Directory "/home/user/public_html">
Require all granted
</Directory>

screenshot_9

Add json and soap extensions to php config file

nano /etc/php/7.0/apache2/php.ini

scroll down till you see extension list and add these, and then just restart apache:

extension=json.so

extension=soap.so
/etc/init.d/apache2 restart

PhpVirtualBox

Now we need to download phpvirtualbox

wget http://downloads.sourceforge.net/project/phpvirtualbox/phpvirtualbox-5.0-5.zip

And get it out of zip file, so install unzip

apt install unzip

unzip phpvirtualbox-5.0-5.zip

If the link is not working you can get it from here: https://sourceforge.net/projects/phpvirtualbox/ 
You need to click Download and copy Direct link

Modify phpvirtualbox example config file

Change if you need: vbox = username for your virtualbox config

cd phpvirtualbox-5.0-5

nano config.php-example

var $username = 'vbox';
var $password = 'mypassword';

var $location = 'http://localhost:18083/';

scroll to the bottom of file and add this: ?> if it doesn’t exist already

then save it as ”config.php

Move phpvirtualbox dir to your apache directory

cd ../
mv phpvirtualbox-5.0-5 public_html/phpvirtualbox
cd public_html

chmod 755 phpvirtualbox

chown vbox:vboxusers phpvirtualbox

Make a new user and usergroup

useradd -m vbox -G vboxusers

Edit virtualbox config file

nano /etc/default/virtualbox

This goes at the end of file:

VBOXWEB_USER=vbox

VBOXWEB_HOST=localhost

If you can’t login through phpvirtualbox webapp, then you can try to add this:

VBOXWEB_AUTH_LIBRARY=null

It should point out you in the right way finding out the problem.

One more thing, we need to add vboxwebsrv app in the boot process. Edit custom boot list:

nano /etc/rc.local

Write this: sudo -u vbox vboxwebsrv. Make sure that the file ends with: exit 0

Then reboot your system if you don’t want to start it with screen command

And its working! Or not?

Screenshot_1

16.10 Users

Login on phpvirtualbox website with admin:admin -> File -> Change password.

Replace:

VBOXWEB_USER=vbox with VBOXWEB_USER=root

And

Type your system login names in config.php file:

var $username = 'user';
var $password = 'password';

Or create another account with different name, set password with passwd user. “Vbox” is not allowed in config.php file.

Type top in shell to see if “vboxwebsrv” is running. If not, you need to play with “/etc/default/virtualbox” file or just start it manually. There’s a service script which should start it at boot but it never works, especially if you have Samba on your system.

Config.php user settings and with what account vboxwebsrv is launched needs to be same.

How to fix vboxweb service file and add it in boot process (tested in 16.10):

vboxweb service file location: /lib/systemd/system/vboxweb.service

Edit permissions:

chmod 755 /lib/systemd/system/vboxweb.service

and check if it’s just not empty file:

nano /lib/systemd/system/vboxweb.service

Incase it’s empty, add this:

[Unit]
Description=VirtualBox Web Service
After=network.target

[Service]
Type=forking
ExecStart=/usr/bin/vboxwebsrv --pidfile /run/vboxweb.pid --background
PIDFile=/run/vboxweb.pid

[Install]
WantedBy=multi-user.target

Now Enable it:

systemctl enable vboxweb.service

now reboot and see if you can login on phpvirtualbox website without starting vboxwebsrv manually

If it didn’t work you might wan’t to edit:

nano /etc/systemd/system/multi-user.target.wants/vboxweb.service

or use Webmin:

screenshot_9

And add User and usergroup right here:

[Service]
Type=forking
ExecStart=/usr/bin/vboxwebsrv --pidfile /run/vboxweb.pid --background
PIDFile=/run/vboxweb.pid
User=(username you use in /etc/default/virtualbox file, make sure it got password)
Group=(usergroup ^)

Some people say it might ruin virtual disk file with root user, when you resize it. So check it out before you do anything important.