Saturday, July 5, 2014

Learning Substance Designer : Part 1 : Prerequisites

 I am starting to working through the substance tutorials.

Why use Substance?
There are couple of things I liked from the videos I've seen so far:
1. Material nodes behave like photoshop. It uses familiar concepts like levels and transforms.
2. It treats connections for multiple parts of a texture node as 1 output (diffuse/normal/specularity/etc)
3. You can adjust the resolution and effects within UE4 when you are done. This looks awesome.
4. It has great tools for painting heighmaps onto simple meshes. You get a complex looking result without any additional vertexes.

Objective
I'm going to post what I learn and how to apply it to Blender and UE4.

Substance Workflow
Substance Designer assumes you already understand everything about modeling and texturing. This is the overview workflow for how Substance fits into asset workflow:



I have had no formal training in asset creation so that was a glimpse into professional game development. The first video in the tutorial covers this diagram. I recommend watching that first.

Substance Tutorial Prerequisite
Before starting the tutorial you need a mesh with 2+ textures UV mapped to it. I'm a little surprised they don't supply one that matches the tutorial so you can follow along but I think starting from scratch in Blender is a good exercise. I'm going to build one for my Oculus Tuscany UE4 port: The pot at the entrance.

It is a very simple mesh with 2 textures: pottery, metal base. I am going to keep the plant separate to allow flexibility in what plants are in the pottery



Materials 101
Before getting started it is good to cover the basics of good materials. This tutorial is a perfect place to start: http://www.blenderguru.com/tutorials/the-secrets-of-realistic-texturing

A good material has 4 components:
1. diffuse : your image
2. normal/bump : A bluish image that allows a texture to project into 3D space without any vertexes
3. specularity : This B&W image controls the glossiness of the surface. White=glossy
4. occlusion : This controls which parts of your image are dark

The recommended program for doing that is crazy bump. Substance has that built into its Bake process so I will just UV Map 2 diffuse textures onto the pottery mesh.

The Pottery Mesh
This pot is pretty simple. I have 7 meshes that I haven't joined yet. I haven't UV mapped anything either. I don't know exactly what Substance expects so I'm playing it safe. When doing research I think I found the pot this mesh was based off of. I searched google for "tuscan pottery" and it was towards the top.

Here is the Pottery in blender:

Here is the Pottery in Substance Designer:

This is what I want my texture to look like:

I browsed through cgtextures and found these two textures:

Pottery:


Metal Legs:

I brought these into photoshop and tiled them using the offset filter, hard-edge cloning and vertical transforms.

Pottery:

Metal:

I'm not a tile expert but these should work pretty well. Most of the sexy material effects should come from Substance. These just lay the ground work.

Update...
 I watched the second intro tutorial and played with Blender and Substance Designer as I went. I UV mapped the 2 textures onto the pottery:



A couple of observations:
1.  Using blender with Substance Designer is going to suck. The exports to fbx/obj do not carry all the information across. The names of materials and nodes are lost. I updated to the lastest version of blender (2.7.1). Same issues.
2. Substance can bake high resolution models into normal maps that you can apply to your low resolution models. That is really cool, except... I don't own zbrush. That is $800. I watched a video of folks using it. You can do some amazing stuff with it.
3. He generated a bitmap from a "vertex color map". I watched a 3 minute tutorial on vertex color maps in blender. That scared me. A lot. It was a time consuming mess. Dozens of clicks all over blender to get a couple of vertex colors in place. I am not doing that unless I have to.

This is going to be a huge learning process. I'm determined to use this tool

Installing the Substance UE4 Plugin


I recently bought the Substance Indie Pack off Steam. This allows you to build complex Materials for UE4.

More Here:
http://www.allegorithmic.com/products/substance-indie-pack

The rub is you have to rebuild UE4 from source to use the substance plugin. Expect this to take a few hours to sort through...

Here are my notes on how to do this:

Instructions for the non-substance/epic part:
https://github.com/EpicGames/UnrealEngine

Instructions that include substance are in this forum:
http://forum.allegorithmic.com/index.php/topic,1223.0.html

01. Install git
    > I already have git installed. You can find it here: http://git-scm.com/downloads

02. Install Visual Studio 2013 Express for Windows Desktop (you'll need it to compile this)
    > http://www.microsoft.com/en-us/download/details.aspx?id=40787 (3.2GB space used)

03. Link your git account to your UE4 account
    > https://www.unrealengine.com/settings
  
04. Download Allegorithmic's source code from their github page
    > fork the Allegorighmic UE4.2 version: https://github.com/Allegorithmic/UnrealEngine
    > NOTE: If you get a 404, it means you didn't properly link your unreal account to git
    > Substance (4.2.0.1)
    > Here are my repositories: https://github.com/{github username}?tab=repositories
    > clone it
      > open Git GUI
      > Repository Clone
      > Source Location: https://github.com/{github username}/UnrealEngine
      > Target Location: {git parent dir}/git/ue42 (don't create the ue42 directory... clone will do that)
      > I had to key my userid/password 3 TIMES

05. Download the 2 dependency packages
    (Required_1of2 and Required_2of2) from Epic's UE4 Github page.
    > UE4 current version is 4.2.1 (https://github.com/EpicGames/UnrealEngine)
    > extract these into your {git parent dir}/git/ue42 directory

06. Download Substance's required files
    https://github.com/Allegorithmic/UnrealEngine
    > SubstanceRequired_1of1.zip
    > extract this into your {git parent dir}/git/ue42 directory (it will overwrite 1+ files)
    > you should now have 3 directories: Engine, Samples, Templates
  
07. Navigate to the ue4 git root folder ({git parent dir}/git/ue42)
    > where you'll find the "GenerateProjectFiles.bat" and ".command" files

08. Run the GenerateProjectFiles.bat

     This create Visual Studio solution files

09. Double click the .sln file to open it in Visual Studio. 
   Wait for it to load everything.
    > this takes a while (10-15 minutes)

10. go to Build -> Build Solution in the menu
   This will start compiling the Unreal Engine.
    > this takes a while (10-15 minutes)
   
Congrats, your build is complete. Now to run it...

OPTION 1 : Running UE4 within Visual Studio (you plan on writing c++ code)
   
01. Set your start up project in Visual Studio to UE4
    > On the right in the "Solution Explorer" pick UE4
    > On the Project menu, choose Set as StartUp Project

02. Press F5 to start UE4 (Debug -> Start Debugging)
    > When I did this I got a dialog: This project is out of date: "UE4 - Development_Editor x64"
    > I said no to rebuilding it.

OPTION 2 : Running UE4 from an Exe (You just want to use Substance)

 Open the editor by navigating to the /Engine/Binaries/[YourPlatform] folder and
 open UE4Editor.exe. Then just enable the Substance plugin in the editor's plugin
 manager and restart the editor, and you're golden.
 > my editor = {git parent dir}\git\ue42\engine\Binaries\Win64\UE4Editor.exe

This fires up the launcher which can be very confusing. I didn't dig that.

OPTION 3 : Associate your unreal project files with your new UE4 executable

 1. Double click on Engine\Binaries\Win64\UnrealVersionSelector-Win64-Shipping.exe
    > this pops up a dialog "Configure this directory as an Unreal Engine Installation? (click Yes)
    > Response: Registration successful
 2. Find any unreal projects you want associated with the new executable
    > right click on the uproject file and select "Switch Unreal Engine Version..."
    > pick your custom Executable
 3. Fire up the launcher
 4. Go to the library tab and pick your project

 If it starts recompiling your shaders you know it is working
 > You can also verify it is working by firing up the Task Manager and seeing where UE4Editor.exe is running from.

VERIFYING THE PLUGIN IS INSTALLED

1. Within the editor pick "Window:Plugins" from the menu
2. Pick "Editor" and scroll down. You should see "Substance"

Thursday, July 3, 2014

Project Tango


Project Tango

Official Page:
https://www.google.com/atap/projecttango/#project

What is it?
According to Johhny Lee (the guy that did cool stuff with the wii): "The goal of Project Tango is to give mobile devices a human-scale understanding of space and motion"

For the Layman:
It is a camera that captures your surroundings. Think of it as a mobile kinect. You can use this data to construct 3D Textures & Shapes but it does NOT do this out of the box. Any demo you've seen (below) are software written by developers using this device.

When will it be released?
Sometime this summer

How many will be released?
200 of the original "peanut" phones were released. 4000 Tangos are planned to be released.
more info here

What does the new dev-kit look like?

Here are 2 images. (The device is 7 inches wide)

front

back

Here is a video of it:


What can I do with this thing?

Latest video of it in action:


What did the old dev-kit look like?

How does it work?
"It does this with the motion sensing and multiple cameras without the aid of GPS, Bluetooth or Wi-FI. Two cameras (one traditional and the other fish-eyed) recreate a human’s peripheral vision while a Depth Sensor sees shapes instead of colors. The entire package currently has an error and drift rate while mapping of one percent."

What does the software look like?
I get the impression this thing is making data available for software to process. I don't think it does the visual mapping you see in the above videos. You have to write that. This fellow is referenced in the above video: Matt Klingensmith. He uses a technique called Voxel Depth Carving.
So... this device may not be as awesome to the average game developer without that software.

The software used in the video is from Matterport.

Is there an API reference guide somewhere?
It is here but you need to own a Tango to have access to it.

How do I get a dev kit?
Go to their page above and sign up to be notified when it become available.
You need to be a "professional developer". The last time I tried to sign up for this they required a company identifier. So... you may need an s-corp to get one. I do part-time game development but I haven't made an llc/s-corp because of the trouble. There are websites that simplify this process for you. Expect a tax headache and to spend $100 or more a year to keep it up-to-date.

If you get one of these, expect to do some hardcore c++/Java development to get something useful out of it.

How much will the developer kit cost?
$1024 (2^10)

What are the specs?
size: 7"
processor: NVIDIA Tegra K1 processor 
memory: 4GB
storage: 128GB
motion tracking camera (120 degree)
integrated depth sensing
WiFi
BTLE
4G LTE
operating system: KitKat Android OS
KitKat Android operating system
KitKat Android operating system
KitKat Android operating system

What is ATAP?
Advanced Technology And Projects group
"All ATAP projects last for two years. It’s a quick-moving system designed to accomplish in months what usually takes years"

More stuff from the ATAP team here:

History of the prototype design:
http://www.engadget.com/2014/07/10/designing-project-tango/

Want to read more? Here you go:
anandtech article
nvidia blog
article on Matterport's room
ATAP team presentation summary

Bonus:
Disney has been working on similar tech. Here is a video of it:
https://www.youtube.com/watch?v=Vf12mepOqNY#t=24

Alternate:
Autodesk's 123D catch 

Wednesday, July 2, 2014

Oculus Tuscany Reference Images

If I'm going to rebuild Tuscany in UE4, I needed reference images from the original. I spent a few hours tonight grabbing screen captures and then cropping them in Photoshop. I left the distortion in place because fixing would reduce the quality of the image.

A couple of observations:
1. None of the materials have normal/bump/etc. They are very plain.
2. This demo easily runs at 60 fps. That will be hard to match in UE4 when I'm done
3. Wall textures are single full images that have been hand crafted. There is no melding of textures in a complex material. That is what I'm going to do.
4. The wood beams looks really good
5. The stone wall around the yard can use some improvement

Overall, this demo has a really nice feel to it even though it is a bit primitive. It will be a challenge to replicate the look of it.

Substance Indie Pack
I bought the Substance Indie Pack when it was 50% off on steam. It is a tool for building materials quickly. I will be learning that as I build this scene. I will probably need to spend a few weeks learning that tool before diving into this project.

Reference Images:


































Tuesday, June 24, 2014

Learning by Replicating - Part III

Part 3 in an ongoing series to replicate a scene by evilmrfrank.

----------------------------------

I adjusted lighting more to remove errors
> increased Environment Intensity to 5 (this brightened scene considerably)
> adjusted radius of each light to not overlap

From this point out I'm only going to note things of interest

Add fog actor (BP_FogSheet) on the left, right & center
> he adds a lot of fog

I adjusted ceiling rocks to show off more of the above area and the fog within it

transparent selection: quick settings:allow-transluscent-selection

he adjusts the post processing volume
> scene color: source color tint: H15,S.238,V.69


------------------------------------------------
6/25/2014
------------------------------------------------

@ 7:45:05 : added 4 flowing water volumes:
M_Mod_WaterFlow_DCL_Master
> originally copied from default cave demo

He add BP_GodRay
> light rays coming straight down (pretty cool)
> radiates out from rotation point
> he goes to a lot of trouble to put it on the statue and then whacks it.
  > it is very finicky and only shows up at certain viewing angles.
> I kept mine in the cavern, increased intensity and left it animated

rift check : looks good

adds another ceiling rock on upper right: I didn't do that
adds GDC2012_Throne_Interior_Chain_05 on left & right (sc 2.5)

adjusts lighting on far right of cave to highlight rocks

I increased the intensity of my back interior lighting from 2000 to 6000

add 2 ivy copies on to upper left part of closet beam
add 2 ivy (SM_Cave_Ivy_01d) on left bottom side
add 2 ivy on right covering brick-rock & rock it sits on
add 1 ivy on lower left covering brick-rock

add 4 buried bricks (various small scale & meshes) in ground left of stream

add 2 colums at back and add rocks to cover top edges

@ 9:23:14 : man that is looking great




add ivy on left in bricks

he starts adjusting lighting in back of cavern. I'm happy with where I'm at.

add dust particles in god light
> Effects/Particles/Dust/PGPU_Dust_Vec_Large (sc 3 - he was 2.5)

add water falling into stream
> Effects/Particles/Water/P_Drips_Splash_Ripples
> I scaled to 1.3 and put right behind beam as if it is falling off of it
> I slowed it down a bit as well

At this point he add fire on the left. I'm not digging that.

I spent about an hour tweaking it so it looked good in the Rift

Done for the day


@ 9:49:00

I copied fire, sound and rocks round it from the Cave Demo
> I brightened up the light a bit
> I changed the color of the fog on the left by the fire to be orange

I added sound to the dripping water and ambient cave wind sound

He plays with the atmospheric fog
> start distance: 15000 -> 100

He plays with light source
> adjusts color to be slightly orange (H23,S.18,V1)
> lighting needs rebuilt
> this is like a warming color filter in photoshop.
  I toned it down to a saturation of .07. I didn't want to blow out
  the blues we work so hard on

Adds an exponential height fog outside of cave.
> he adjusts it a while and then whacks it

copies fog by fire and puts in outside cave
> scale it up. increase noise, brightness and panning speed to .01

adjust a few rocks and add vines on the left

@ 10:55:16


Comparing these last 2 images, it feels like a step backwards a bit. I think the adjustment to atmospheric fog lightened the scene too much. I need to revisit that later tonight.

6/27/2014

I adjusting fog and lighting to get the scene back to the prior look while keeping some of the new changes. This was the result:


Having done a ton of photography I've come to stray away from warming filters and to strive towards greater depth in lighting variation. The orange is a little too intense so I need to tone that down a bit.

 I neutralized the open area color and darkened the back area:


Yea, that's just about right. Off to work...

@ 10:55:16

add more rocks and grass on both sides
adjusts lighting
he grabs a god ray for the ceiling from the cave demo but I have one already
add a sword & fog from below outside
add another vine on the left and call it a day!

Here is the final scene

full screen

rift view

I will add movement to this in a week or so and post it as a mini demo for people.