Saturday, August 6, 2016

Multiple Texture UV Mapping in Blender for Unreal 4

Multiple Texture UV Mapping in Blender for Unreal 4

That is quite a mouth full for a title but it is important for creating a large and efficient environment.

The current trend with texture mapping is to create 1 material per object. This allows you to do some very cool things with tools like Substance Designer. If you have a lot of objects, that is going to be a lot of textures in memory.

I am building a game that will have expansive landscapes / scenes. I need to be very performance conscious from the outset. This includes reusing textures and mapping multiple textures onto one object when necessary. This will allow me to have fewer textures in memory.

I am a bit rusty with Blender but it is coming back to me.

Here is a simple example of creating a cube with collision and 2 texture UV mappings. I can view the object in blender with the textures and in Unreal with the textures once imported.


STEP 1: Setting up Blender (One time setup)


Unreal has a different object scale than blender. We need to adjust blender to build objects to Unreal's scale. Set scale to 0.010


We also need change the view clip so it doesn't freak out with unusually large scaled objects:


Make sure the end value is 500m not 500mm.

I scaled up the default cube so it looked normal size.


STEP 2: Collision Mesh


I copied the cube, slightly enlarged the copy, renamed the copy to UCX_{object name}_{number}. I also changed the UCX to be wireframe. Note: You can have as many collision meshes for an object. Each collision mesh must start with UCX_{object name}.



Step 3: Add Materials


I used to do UV mapping without adding materials in blender. This worked for UDK. This does not work for Unreal...

Select your object and add a material:


With the material selected, click on the texture tab and load the texture:


Repeat this process for the second material/texture.

Step 4: UV Mapping


Before we do UV mapping, lets make sure the object will display the textures from the UV editor in the 3D View:


Now we need to UV map onto the material and simultaneously a texture with the UV editor.

Lets split the 3D view to include the "UV/Image Editor":


Select the cube, go into edit mode, be in face select mode, select 3 of the 6 faces (3 for 1 texture and 3 eventually for the other), press U for unwrap and select "Smart UV Project". Now open the texture in the UV mapping for the 3 sides:


Now to complete the mapping we need to assign it to the material:


Repeat this for the other 3 faces. In the end you will have an object that looks like the one in the 3D view above.

Step 5: Import into Unreal


Now export this to FBX. Don't adjust any settings.

Open Unreal and import the FBX. If everything went well, you will have a properly scaled object with collision and 2 texture materials mapped to it:


This will drop right into the level and works.

The end goal is to not load the textures/materials into Unreal since they should already exist. But for a quick Proof of Concept, this worked surprisingly well.

My only complaint is I have to make sure I have the textures selected in the UV editor or it won't display correctly in the 3D View. It will render, but that isn't very helpful when building/adjust the object.

Friday, August 5, 2016

Unreal Blueprint Research

Unreal Blueprint Work

I am starting to dig into blueprint. I do software development in Ruby and have done c++ and Java among other languages so programming doesn't worry me. 

I am trying to wrap my head around 3D specific concerns such as vectors, rotators, transforms, lerps, etc.

I created this cheat sheet I will tape to the side of my monitor for reference until I have the variable colors and types down cold:


I watched a few quickie blueprint videos from Unreal on creating a hovering object and slowing time until a character moved. Those were amazingly easy. 

I'm building a text file with a list of important functions as I run across them in tutorials. I will post the contents of it here. I will update a number in parens when I encounter the function multiple times. This will help me gauge the usefulness of the function.

========================================================================
UNREAL BLUEPRINT NOTES
========================================================================

---------------------------------------------------------------------------------------------------
Variable Types
---------------------------------------------------------------------------------------------------

https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/Variables/

Boolean (RED)

Integer (CYAN)

Float (GREEN)

String (MAGENTA)

Text (PINK)
 localization?

Vector (GOLD)
 3 floats (traditionally for XYZ or RGB)
 https://www.youtube.com/watch?v=WHGkLLIlz78

Rotator (PURPLE)
 group of numbers defining rotation in 3D space
 Ususally just interested in Pitch and Yaw

Transform (ORANGE)
 Cobines 3 attributes of an object:
 translatioon (3D location)
 rotation
 scale

Object (BLUE)

---------------------------------------------------------------------------------------------------
Terms
---------------------------------------------------------------------------------------------------

Primitive Component
> any component we can apply physics to (ex: static mesh)

---------------------------------------------------------------------------------------------------
Notes
---------------------------------------------------------------------------------------------------

To make an object be able to move, must sure you change "Mobility" to Movable

You can drag blueprints onto objects in the component list to associate them
> example was a hover blueprint. Dragged onto a movable object, it made it hover
> scene component blueprints have this ability. Maybe others. Unsure

---------------------------------------------------------------------------------------------------
Functions
---------------------------------------------------------------------------------------------------

DEBUGGING .........................................................................................

Draw Debug Line
 draws a line between 2 points.

Line Trace By Channel
 Draws and erases a line every frame

Print String (USEFUL FOR DEBUGGING)
 Prints a string on the screen (great for debugging)

Get Display Name
 Lets you get the name of an actor
 Can be used to show the name of an actor you have hit with a vector
 This does not appear to work on static meshes

CONSOLE ...........................................................................................

Execute Console Command
 Example: slomo

EVENTS ............................................................................................

Event Begin Play
 When game play starts

Event Tick (3)
 Fired at every frame

ACTOR EVENTS ......................................................................................

Event Actor Begin Overlap
 When another actor overlaps this actor
 You can cast this to ThirdPersonCharacter

Event Initialize Component

VECTOR MANIPULATION ...............................................................................

Break Vector
 Allows you to manipulate each component (X,Y,Z)

Convert Vector into Linear Color
 Covert RGB into single value for "set light color"

Get Vector Length
 Get the magnitude/length of a vector (returns a float)
 Can be used to convert a vector into a useful float

Vector + Vector
 Adds 2 vectors

UNCATEGORIZED .....................................................................................

Break Hit Result
 Breaks out the result of a vector hitting an object
 Can be used to break out the result of "Line Trace By Channel"

Build String (Float)
 convert float to string with a prefix.
 Can be fed into "execute console command"

Get Actor Location
 Get the location of the actor

Get Control Rotation
 Rotation of the object

Get Forward Vector
 Can be used to convert a rotation into a vector
 > The length of the vector is 1 (XYZ values are decimals less than 1)
 > This produces a normalized/direction/unit vector (it always has a length/magnitude of 1)

Get Owner
 Actor a blueprint has been attached to
 > useful for doing work against the owner and inspecting it

Get Velocity
 Get velocity of object (vector)

Launch Character
 You can add a velocity to an actor

Map Range
 Convert 1 range of numbers proportionally into a different range
 Useful for coverting a large range to 0 thru 1 or vice-versa

Random Unit Vector
 creates a random vector (3 variable array)

Set Light Color
 Change the color of a target light

Set Timer by Event
 Allows you to create a looping timer that can trigger an event

Monday, August 1, 2016

Distance and VR

Distance and VR.



I played 15 minutes of "Call of the Starseed" yesterday for the first time.

I am immune to immersion in VR. I've spent way too many hours within VR for it to emotionally affect me. Because of this I immediately look for drawbacks in design.

I think this title, along with others, suffers from scale. I can see how far out the stars are and I feel enclosed within a large bubble. This may be done for performance reasons but it makes me feel like I am not in a world but on a stage.

Having an unending horizon is very important to me and I will be making it a high priority. I would rather the edge of perception be clouded/misty than give the feel that I am in a sphere.

One of my favorite games that deals with horizon and is amazing efficient is Blades of Brim by Sybo games.


I don't know how they do it but that game is amazing on an ipad. It even has portals! It is damn slick and an inspiration for me.

Sunday, July 31, 2016

Game Development for the Vive Begins

I've been thinking about what I want to make over the last 4 months. I have a pretty solid idea and now it is time to dig in my heals and start work.

I've been using Deepart as my poor man's art department.

This gives you a glimpse of what I am going for:
https://www.pinterest.com/seanrforeman/deep-art-best/

Here is a sample image:

It feels very different depending on the style applied via deepart.io:

Dark and moody:

Comical:

Psychedelic:

Idealistic:

My hope is to skin objects with different textures to maximize reuse and minimize effort on my part. I may need to use different distortions of the same object. If I build a scene only with programmatic logic it can automatically apply the appropriate texture and object variant without me lifting a finger. That is the theory.

Game development is not my job so I can only develop in the evenings and the weekend but I intend to focus a significant amount of spare time to developing this game (40+ hours per week).

Installation and getting the Vive working in Unreal

I may use 3D Studio Max. This is unclear. I first need to brush the cobwebs off my Blender knowledge and get the Vive up and running in Unreal. Once I have Unreal working I will move onto Unity.

1. Get Blender, Photoshop, Unreal installed on my Vive machine
> Blender (297 MB): https://www.blender.org/download/ (Free)
> Photoshop CS4 Extended (2 GB): (I bought this years ago prior to monthly subscriptions)
> Unreal 4.12.5 (18.56 GB): https://www.unrealengine.com/ (5% royalty. Free download)
> Notepad++ (13 MB): https://notepad-plus-plus.org/ (Free)

2. Get the Vive Headset working in Unreal
> Once Unreal comes up, the vive hardware turned on
> This worked flawlessly:
https://docs.unrealengine.com/latest/INT/Platforms/SteamVR/QuickStart/2/

3. Get the Vive Controllers working in Unreal
> I will be following this tutorial this evening:
https://docs.unrealengine.com/latest/INT/Platforms/VR/MotionController/

The meshes and textures are automatically available and updated by valve in this folder on your machine (one you install SteamVR):
Steam\steamapps\common\SteamVR\resources\rendermodels\vr_controller_vive_1_5

OK, this tutorial is giving me trouble:
1. I had to build a static mesh for the controller via blender and map a texture to it. I haven't played with blender in over 2 years but I stumbled through that.
2. I have never built a blueprint and they are leaving out important information. example: the blueprint is an actor blueprint. That may be obvious but it wasn't to me. I also have no idea where "view options" is in this maze of windows.
3. The tutorial appears to already be out of date with the latest version of Unreal.

I am going to need to punch through some Unreal tutorials before I can go further. I was hoping to avoid this but there is just too much going on and I need to wrap my head around it.

Unreal Tutorials:
Basic Tutorials
  UI Overview (Done)
  Blueprint Jump Starts (Starting Tonight)

This is going to take a few weeks...
I AM HERE...

This looks like a great tutorial:
http://www.tomlooman.com/getting-started-with-vr/

Lots of information on reddit:
https://www.reddit.com/r/unrealengine/search?q=vive&restrict_sr=on

4. Pipeline an object with a texture into Unreal


Monitoring and memory management
I will be procedurally building large portions of my game environment. I need to find out which engine is better at allowing me to add/remove objects and efficient use of LOD. I also need to see which engine "feels" better in the Vive.

1. Determine how to measure/monitor frame rate in both engines
2. Determine how to measure/monitor memory consumption in both engines
3. Add and remove objects via code in memory. Determine the threshold for object count in both engines.
4. Test effectiveness (memory/frame-rate) of LOD in both engines

That will keep me busy for a few weeks... I will update with information on each topic as I progress.

Thursday, April 14, 2016

Vive Game Punch List



Initial Game Punch List

Whenever I start a project, I need a to-do list. I've built a game before using Blender and UDK so I am somewhat familiar with what I need to do. Because I am switching tool sets, I will need to invest time into learning those. Attempting to run forward without footing in these would be foolhardy.

As I learn more, I will adjust the list, but this is my first go at it:

Unity:
[ ] install unity
    [ ] learn unity basics - digital tutors (62 hours)
        http://www.digitaltutors.com/software/Unity-tutorials
        [ ] Quick Start (3 hours)
        [ ] Indie Game Development Pipeline (29 hours)
        [ ] How to get started in Unity (21 hours)
        [ ] Programming in Unity (9 hours)
[ ] Get Vive working in Unity
    [ ] Setting HMD and controllers
        https://www.youtube.com/watch?v=LZTctk19sx8
    [ ] Vive VR Tutorial
        [ ] https://www.youtube.com/channel/UCiMlbeQWYRpajZhtRZH8UfQ (VR Dev School)
    [ ] Install Seam VR
        Version: 1.0.8 (Mar 07, 2016) Size: 3.8 MB
        https://www.assetstore.unity3d.com/en/#!/content/32647

3D Studio Max
[ ] start 1 month trial (about $185/mo after that)
[ ] learn basics - digital tutors (17 hours)
    http://www.digitaltutors.com/learningpath/105-Quick-Start-to-Modeling-in-3ds-Max
[ ] Creating game art in 3DS Max: (105 hours)
    http://www.digitaltutors.com/learningpath/82-Asset-Creation-for-Game-Development-in-3ds-Max
      
Maya (not using this)
The alternative to 3DS Max is Maya. It appears to be more powerful but more difficult to use. Since many games are made with 3DS Max, I'm going that route. If I went the Maya Route, it would look similar to 3DS Max:
[ ] start 1 month trial (about $185/mo after that)
[ ] learn basics - digital tutors (55 hours)
    http://www.digitaltutors.com/learningpath/59-How-to-Get-Started-with-Modeling-in-Maya

Teleportation
[ ] Study "The Lab" Teleport
[ ] Implement Teleport
    [ ] show (X) at teleport spot
    [ ] move position at press of button
[ ] Polish Teleport
    [ ] fade into new spot
    [ ] create arch to new teleport spot
    [ ] show current place space outline at teleport
    [ ] make arch into a 'tube'
    [ ] define a teleport boundary (X cannot go outside of it)
    [ ] define a teleport distance limit (arch cannot go beyond this from you)
    [ ] add sound to teleport

Flying Platform
[ ] circular platform
[ ] land below (approximately 10,000 feet)
    [ ] land should be grids that can be randomly put together
    [ ] land should slowly move under platform
    [ ] new grids added ahead and old grids delete behind
    [ ] each grid has different components
        [ ] farmland
        [ ] buildings
        [ ] roads
        [ ] rivers
        [ ] trees
    [ ] each grid should connect correctly with the neighbouring ones
[ ] clouds
    [ ] clouds move slowly
    [ ] clouds are fog volumes
    [ ] clouds have a shadow on ground
    [ ] platform has a shadow on the ground
    [ ] clouds below, at eye level, and above
    [ ] clouds obscure ground so add/remove of grids cannot be seen
[ ] day/night cycle
    [ ] afternoon/evening/night/sunrise/morning
    [ ] moon
    [ ] stars
    [ ] sun

Birds
[ ] Birds should fly by
[ ] Birds fly in a group
[ ] Birds land on and leave platform

Sound
[ ] put sound at a spot in space and hear it correctly
[ ] wind outside

Wednesday, April 13, 2016

HTC Vive Development

I got the HTC Vive last week.



I must say, it is everything they hyped it to be. Very immersive and there is no substitute for room-scale experiences in VR. Oculus has made a huge blunder not understanding this and designing for it from the get-go.

Anyway...

There are some cool experiences in the Steam store but I want more.

I am going to shift gears and use a different toolset for development. I would have loved to learn Source 2 but that is still not available. Valve has used Unity and has been happy with it so I am going to learn Unity.



I also experienced a lot of challenges with Blender in the past. It is a great tool but it requires a bit more effort for game development than 3DS Max.



I am going to spend this summer learning those two tools. 3DS Max comes with a hefty month fee (around $200/month). I am going to watch some videos on it first before forking out that kind of money.

I already have a game in mind. I've been thinking about it for a year or so. I want the hub of the game to be a flying house with a trophy room. My first goal will to be to build something like this:


That is what I want to experience in VR, so I'm going to build it. Not Howl's Flying Castle per-se, but something in this vein where you have a house on a flying platform with trees and grass on the patio.

I want to have clouds flying past and birds perching on the platform. I want to look over the railing and see a landscape slowly passing by below.

These images all capture the feel I am going for:




Wednesday, August 12, 2015

Windows 10 Start Menu

Windows 10 is everything I thought it could be:
a bit fat waste of my morning

You had ONE job to do with the start menu:
let me drop stuff onto it

When I drag stuff onto the start menu it says it will pin it. Does it pin it? Nope. This is my start menu:

Why? Why do you have to be like this?

Here is a quote from a forum on Windows 10:

wtf man?

Their best start menu was from windows 95:

Those were the days. You could control the size and contents and have cascaded menus.

Now it is full of crap "live icons" you have to get rid of and all you are left with is nothing. Nothing.

This is a perfect example of politics messing with my user experience. They want their crap on there and god forbid I can put my own stuff there.

I ended up downloading classic shell to replace it (again)
http://www.classicshell.net/

sigh...

Oh ... and the other windows 7 machine that crashed 2 weeks ago and I had to replace the graphics card... the windows 10 upgrade is gone and won't come back. Whatever...

Microsoft: you suck balls.