May 262017
K Hi there, time for a new Unity tutorial.

Now you might remember my old image map tutorial, well I remade it in video for your viewing pleasure.

This is basically usuable for raycasting an object and get the color of the pixel on the texture you hit. This can be used to create a color picker or an image map, where you have a texture with different hot spots.


If you like this post, then please consider retweeting it or sharing it on Facebook.

 Tagged with: , ,
Jul 272016

Hello fellow gamedev!

JAre you ready for a tutorial featuring Lech from Eco Tales?
Whatever the answer, here it is!

I’ve recently started to dabble into Houdini and to my surprise, there aren’t that many tutorials out there on using it for game development.

So, being totally in love with my own voice and an ex-teacher I figured, why not create some?

There are plenty of getting started tutorials out there so the ones I’ll be recording will mostly be around whatever I fund useful in my daily Unity and Unreal work.

First up is a short video on getting pre-fractured rigid body animations into Unity, check it out!

I accidentally cut out the FBX-export from that video, so here’s a Quick Tip on how to do that.

Using attributes doesn’t work with FBX-files, so in this video we look at how we add working material slots to the fractured mesh.

Here’s the link to the Houdini Gamedev Tools.

There is an outdated version on getting one into Unreal which I might create a new version of soon, unless the original author does, so make sure to subscribe to my youtube channel and write a comment if you find the thought alluring!

Tjipp och Hej as we say in Sweden

Also, If you like this post, then please consider tweeting it or sharing it on Facebook!

 Tagged with: , ,
May 122016

Hello everyone especially all of you students from Uppsala University, hope you enjoyed our little talks, I sure did.

Today we’ll be looking at creating a super simple shader which will make grass, or any object for that matter, maybe a flag or tree branches, flow in the wind, based upon a vertex paint and a single scalar value.

At the bottom of the post you will find a .rar file with a mobile (unlit) and a PBR version of the shader, ready to open inside of Shader Forge.

First up, a semi-short video where we look at vertex painting in Maya, 3Ds Max and Blender.

In part two we create the shader inside of Shader Forge.

Or if you’re in a hurry, here are the actual Grass Shaders!

 Tagged with: , , , ,
May 032016

eco tales sick of you villain

Recap 14 and you’re back? Guess the boys are more interesting to you than they are to me.

What they’ve been up to this week? Well Jona found 3ds Max 2017 and started boasting about knowing how the new UV mapping system works.

JOur Lech sure is a ray of sunshine, bet you can’t wait to meet him in game!
So what have I been up to? Well first of I’ve created this tutorial for the new 3Ds Max 2017 UV-mapping features.

It’s become quite popular as far as tutorials go, so why mention this here? It’s actually a part of our new marketing scheme, pushing out free amazing (we hope) tutorials which all reference Eco Tales in some way.

In this one it’s Lech himself being peeled by the new UVW scalpel, additionally there’s an ever present link to the blog, and once every so often I talk a little about Eco and tell people where to look for it.

In 72 hours it’s been viewed 750 times but there has not been any noticeable increase in traffic to any of our social media channels.

I also made this for Krister, I hope we’ll be able to show more of what this is soon!


Khas declined comment this week, I think what he did to my gcode has something to do with it.


Krister’s print.

 Tagged with: , , ,
Apr 092016

Hello everyone,

Today at work I wanted to setup my Maya to zBrush connection as I find collapse edges to be amazing… Not that you care about the reason if you’re here so, without further ado here are a few solutions.

Unable to install : First up, if you can’t install it for some reason, copy userSetup.mel from : C:\Users\Public\Pixologic\GoZApps\Maya to C:\Users\USERNAME\Documents\maya\scripts if there is one there already, add this eval(“source \”C:/Users/Public/Pixologic/GoZApps/Maya/GoZScript.mel\””); to any line in the file.

Unable to find Maya : If the reason was that you have Maya installed in a custom location, there’s another file in C:\Users\Public\Pixologic\GoZApps\Maya named GoZ_Config.txt open it and add your maya.exe path to the file, in my case this us what was written in the file when I was done : PATH = “E:\Applications\Autodesk\Maya2016\bin\maya.exe”

Now to the reason you’re most likely here.

// Warning: file: C:/Program Files/Autodesk/Maya2015/scripts/startup/rememberViewportSettings.mel line 43: Active stereo does not work with Aero enabled. Active stereo has been disabled. //
// untitled //
// Error: file: C:\Users\Public\Pixologic\GoZApps\Maya\GoZBrushToMaya.mel line 113: Plug-in, "Mayatomr", was not found on MAYA_PLUG_IN_PATH. //
commandPort -securityWarning -name commandportDefault;
// AbcExport v1.0 using Alembic 1.5.0 (built Jul 25 2013 11:21:20)
// AbcImport v1.0 using Alembic 1.5.0 (built Jul 25 2013 11:21:20)
// Error: file: C:/Users/Public/Pixologic/GoZApps/Maya/GoZBrushToMaya.mel line 113: Plug-in, "Mayatomr", was not found on MAYA_PLUG_IN_PATH. //
// Error: file: C:/Users/Public/Pixologic/GoZApps/Maya/GoZBrushToMaya.mel line 113: Plug-in, "Mayatomr", was not found on MAYA_PLUG_IN_PATH. //

This simply means that you need to have MentalRay for Maya installed, you can find it here : Maya 2016. After you’ve installed it, make sure it’s active as well, just follow these steps.

  1. Install mental ray renderer, using the installer.
  2. In Maya, select Windows > Settings/Preferences > Plug-in Manager.
  3. In Plug-in Manager, set Mayatomr.mll to Autoload.

There another solution (I didn’t try it out myself) but according to a user at Polycount you can edit the file GoZBrushToMaya.mel which can also be found in C:Users\Public\Pixologic\GoZApps\Maya\.

Starting on line 109 you’ll find this.

// ------------------------------------------
// GoZBrushToMaya requires Mental Ray plugin.
if (`pluginInfo -query -loaded -name "Mayatomr"`==0) 
 loadPlugin "Mayatomr" ;
 //setCurrentRenderer mentalRay;

Just add // in front of every line or replace it with this code.

// ------------------------------------------
// GoZBrushToMaya requires Mental Ray plugin.
//if (`pluginInfo -query -loaded -name "Mayatomr"`==0) 
// loadPlugin "Mayatomr" ;
// //setCurrentRenderer mentalRay;
 Tagged with: , , ,
Oct 252015

Hello Friends of Carlotta (<- Movie reference).

I just had a long day accompanied by a headache so intense that my day felt slightly askew, so what better remedy than working with Unity?

Not really having any direct train of thought I stumbled upon this in the Unity documentation describing how to get the pixel of the texture on the material where you clicked with the help of the texture coordinate.

Thinking back this is what I used to do when doing 2D games for point & click adventure games or top down games where I could bake in information in the level and react on it, for example if a car drove over a yellow field in the map it would get a speed boost.

First we need the image we want to display in the game, that is easy enough and I chose this one here from when we were visiting a conference that Swedish Game Awards were hosting back in April, then we also need the hot spot image, you basically copy the original image painting over any hot spots with a unique color leaving everything else white, transparent or whatever is to your liking, just remember to so you do not accidentally use it as a hot spot color later on.

KJ and S visiting SGA Conference

KJ and S visiting SGA Conference











Hot spot map

Hot spot map










Texture Settings

Texture Settings

Importing these assets into Unity you need to apply some settings to the map texture. You need to make it read/write enabled, I also changed compression type to RGB 16 bit so that my colors did not get compressed and modified (this reduces the amount of colors you can use but still should be more than enough).

After creating the material you put it on your mesh and you need to add a collider to that object so we can use raycast on it, that collider MUST be a mesh collider otherwise we will not be able to get the texture coordinate, something we must be able to do to get this to work.

On to the code, the way I set it up was that when you press the left mouse button it will make a raycast if it hits a mesh collider with the selected layer it will take the texture coordinate and translate that into a pixel which you use to check on your map texture and retrieve the color.

Create a script that you will later place on your mesh object.

using UnityEngine;
using UnityEngine.UI;

public class ImageMap : MonoBehaviour
   public Text textbox;
   public float rayDistance = 50f;
   public LayerMask layer;
   public Texture2D clickTexture;

   public Color[] colors;
   public string[] texts;

So I will get the color the user clicked, find the corresponding string connected to that color and set the text of my textbox to that value. I will start by implementing the method that finds the index of the color in my colors array so I can use that in my string array to find the correct text.

private int FindIndexFromColor(Color color)
   for (int i = 0; i &amp;amp;lt; colors.Length; i++)
      if (colors[i] == color)
         return i;
  return -1;

Now we are ready to get to the part where we get the color from the image map from where we clicked.

void Update()
   RaycastHit hit;
   if (Input.GetMouseButtonDown(0) && Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, rayDistance, layer))
         Renderer renderer = hit.transform.GetComponent<MeshRenderer>();
         Texture2D texture = renderer.material.mainTexture as Texture2D;
         Vector2 pixelUV = hit.textureCoord;
         pixelUV.x *= texture.width;
         pixelUV.y *= texture.height;
         Vector2 tiling = renderer.material.mainTextureScale;
         Color color = clickTexture.GetPixel(Mathf.FloorToInt(pixelUV.x * tiling.x), Mathf.FloorToInt(pixelUV.y * tiling.y));
         int index = FindIndexFromColor(color);
         if (index >= 0)
            textbox.text = texts[index];

So I basically check to see if the user just pressed down the left mouse button and if the raycast hit anything of interest, I placed all my Image Map objects into a special layer just for them in this example.
If I did click a valid object I find the texture on it and check what texture coordinate the user pressed, calculate that into a pixel on the texture and check tha corresponding pixel on my texture map “clickTexture” taking into account the scale of the material (that way it will still work if you have tiled it).

The result

Hotspots result

Hotspots result

And that is it, my headache is gone, my energy is up so good luck and I might see you after my refreshing stroll in our refreshing autumn weather we are having here in Sweden today.

// Krister

 Tagged with: , ,