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: , ,
Aug 312016
 

Hello my lovely Devs!

Tired of hearing (read as reading) future customers and other developers say (write) “Looks like it’s made in Unity”, well, be tired no more!

By writing your own custom Screen Space effects, your game will look like no other game ever conceived! I mean just look at Eco Tales, have you ever seen a cuter character than our very own Lech?

Skinning clothes

Adorable

You may have guessed it! Today I’m kicking off a tutorial series on creating post effects inside of Unity using Shader Forge, if it becomes popular, I’ll continue. For now it’s just two introduction videos which should be able to set you off on your own adventures!

In part one we create the base of all screen space effects, the script needed on the camera to make the shader do it’s magic as well as a simple one color shader, just to see how simple it is to get into post process shaders inside of Shader Forge.

In part two we look at screen space UVs and manipulate these to create a simple distortion effect.

If you learned something new please consider tweeting 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: , , , ,
Dec 032015
 

Hello fellow devs, and Hi mom!

To not overload the blog and Facebook page we’re going to write weekly posts, which we update 7 times each, once per day.

Let’s get this done!

December 2nd

Technical artist Jona searching for the meaning of life in the lens of camera.

Today I took a few asset I’d made for Unreal Engine 4 and pushed them through my Unity pipeline, sadly, most of my original files had been lost so this took quite bit longer than expected.

I will need to edit the textures a bit to fit in with the rest of the game.

Additionally, adhering to the one object per day rule I also created the cherries seen in the image below.

Fat Eco Man Day 2

5 hours of work


Programmer Krister in a bad mood on the subway.

For me, the programmer had a nice one hour yesterday as well, we had a small base of code from last weekend so I improved upon that, working with the weapon system, cleaning up and improving the attack code a bit.

So far I am working with temporary graphics of course, with some from Jona and some programmer made visuals, I think it is safe to say that I am the better artist of KJ.

Programmer art is much superior

Programmer art is much superior

December 3rd

Technical artist Jona searching for the meaning of life in the lens of camera.

I created the base of a flan asset using Maya and started looking into a custom shader to change colors of it depending upon taste, I’ve not yet decided if this it the way I’ll go with it, but there’s time for iteration yet.

I also started and finalized the ecological chocolate bar seen in the image. Most time was spent looking into the Unity 5 Standard shader.

I’ve yet to decide if PBR is the right way to go for this game, it’s lacking something important, maybe the lighting will stick, as for the rest, big things are coming, I’m sure of it!

Eco Dec 3rd

The first consumables are ready, time for custom shaders perhaps?


Programmer Krister in a bad mood on the subway.

I went wholeheartedly into creating a system to handle settings and configurations with restore to default capabilities and also started looking into using cInput. So not a big update for me, nothing as fancy as sweet chockolates but I am a firm beliver of having a strong foundation of these general systems inplemented early as it will help during development, also since we don’t have all the concepts and ideas of the game done it is something to work on while we figure things out.

December 4th

Technical artist Jona searching for the meaning of life in the lens of camera.

Busiest day of the week, managed to get an hour in, however, I wasn’t even close to managing a blog update after, spent too long on this haha.

One hour of work

One hour of work


Programmer Krister in a bad mood on the subway.

After creating the basic system for handling settings in the game I continued with creating a settings editor just to avoid the hassle of having to deal with the XML file.

XML Settings in engine Editor for Unity3D

Settings Editor

December 5th

Technical artist Jona searching for the meaning of life in the lens of camera.

Today we went into full work mode, I worked on writing some shaders and started on some clothing, using a free trial of Marvelous Designer, it was a lof of fun, it’s prone to crashing but very powerful.

Marvelous Designer shirt

Marvelous Designer shirt


Programmer Krister in a bad mood on the subway.

This saturday we went full work mode and I took the time to improve upon the item and weapon systems as well as started working on the inventory ststem.

December 6th

Technical artist Jona searching for the meaning of life in the lens of camera.

I continued experimenting with Marvelous Designer, here are a set of pants I created somewhere around midnight and beyond, hopefully I’ll have the time for another update today.

These clothes need some nice textures, painting time!

Marvelous Designer Pants

Marvelous Designer Pants


Programmer Krister in a bad mood on the subway.

The last day of the firs week I spent some time cleaning up the code from yesterday, making som small improvements to the code.

 


Technical artist Jona searching for the meaning of life in the lens of camera.

I end the sunday with this, my current favourite shader iterations, which do you prefer? Send me a message on Facebook or twitter and let me know!

Shader variations

Shader variations

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: , ,
Oct 232015
 

What could be better than spending a Friday evening authoring a tutorial for the game developers of the world or as I like to call you, my Lovelies, with a capital L.

Maybe learning something new, this, I’ve already done today, I learned that the difference between a method and a function is that the method belongs to a class, exciting isn’t it!

Now then, as for the reason you came here, I know it, learning. Today I’ll show you a little trick in the Unity Engine, while Gizmos are valuable, they can sometimes get in the way, especially when working with art.

Drum roll if you please!

Go click and un-click the hell out of those Gizmo settings, another time, if I get even a single request for it, I’ll take you through writing a simple script which will allow you to toggle the Gizmos on and off with the tick of a box.

If this was useful, do give me a like and/or a subscribe, I do this so that I’ll feel like a contributing member of the development scene after all, me me ME!

With that, I’m un-clicking this with a //Jona, your dev in the dark.

 Tagged with: ,