Create normal maps for UnityIn my project, users can upload their own textures and also their own normal maps. But chances are, they will not upload an actual normal map and provide a regular image instead. So I need to generate a normal map from that image. Don't forget to have a look at my AssetStore packages: SimpleLOD - simplify meshes, merge meshes and create LODs SimpleOBJ - import ... read more |
|
How to combine meshes in Unity3DIn the Unity API you can find the function Mesh.CombineMeshes. It is almost useless. It will combine the meshes you pass to it into 1 mesh with the option to make a separate submesh for each of them. But when the original meshes already had submeshes this info is lost. I haven't tested it but the documentation doesn't mention anything about skinned meshes, so i think boneweights and bindposes are lost as well. So I wrote my own function instead. It combines all the meshes it finds in a GameOb... read more |
|
Converting to and from stringHere are some simple but handy functions. To convert a string into an int or a float there is of course the C# functions ToInt32() or ToSingle(), but they immediately throw an exception if the string is not correctly formatted. Personally, I hate this. It forces me to add a try {} catch{} block every time and often I don't even care if the string can be converted to an int or not. Very often a return value of 0 will do just fine in those cases. So here are the functions that I use for this... read more |
|
RectTransform extensionsWhen your head hurts after setting up a user interface with the new UI from Unity this is likely caused by the offsetMin, offsetMax, pivot, anchorMin and anchorMax properties that together defines the position and size of a user interface control. If you long for the days when you could simply position a button by telling it the Rect where it should be drawn, here's a little something to help. I wrote most of these functions when I build the ListBox package for the Unity3D AssetStore. All fun... read more |
|
Handy Unity3D C# functions (5. screenshots)Making a screenshot in Unity is easy. Just call Application.CaptureScreenshot() and it saves a PNG file for you. But what if you want to use the screenshot in your game or if you want to upload it to a server. You could read the saved file back in, but is a crappy solution. It's better to just do the screenshotting yourself and have complete control over the result. Have a look at my AssetStore packages: SimpleLOD - simplif... read more |
|
Handy Unity3D C# functions (4. alter textures)A texture in Unity can be accessed through the GetPixels functions if you made sure the import settings in Unity had the "Read/write enabled" flag on and the Texture type is non-compressed (RGBA32, ARGB32 or RGB24). We will use this to manipulate textures and create new copies from them. The functions below were written for the Unity3D AssetStore package Texture2D+. It adds functions to the Unty API for converting colors to and from Hex, convert colors between RGB and HSB. And allows you to p... read more |
|
Handy Unity3D C# functions (3. create textures)In the previous post we defined some functions for dealing with colors. Since an image is not much more that a collection of colors, let's expand our color functions to the Unity3D Texture2D. The functions below were written for the Unity3D AssetStore package Texture2D+. It adds functions to the Unty API for converting colors to and from Hex, convert colors between RGB and HSB. And allows you to perform basic image manipulation like scale, rotate, crop, contrast, etc on Textures. Feel free to... read more |
|
Handy Unity3D C# functions (2. colors)Unity has the Color structure to define colors. But it does not offer a lot of features by default. The functions below were written for the Unity3D AssetStore package Texture2D+. It adds functions to the Unty API for converting colors to and from Hex, convert colors between RGB and HSB. And allows you to perform basic image manipulation like scale, rotate, crop, contrast, etc on Textures. Here's the link to the Texture2D+ packa... read more |
|
Handy Unity3D C# Functions (1. compass angles)In the next couple of weeks I will be posting some handy code snippets for use in your Unity3D projects. Nothing spectacular, but some of the functions can be quite useful. This first post is about working with angles in degrees. As you may know, I am a sailor and when you make a boat in Unity, you need a few functions to easily deal with compass angles. Convert angle between 0 and 360 degreesWhen you have an angle in degrees, that you want to convert in the range of 0-360: |
|
FlexiGUIFlexiGUI is a toolkit for game developers that uses the popular game engine Unity3D. It makes setting up a GUI system for games easier and adds a lot of extra features. The flexible scaling options for screen size and DPI, together with the way user input is handled, enables game developers to create one game and deploy it on Web, PC, Phones and Tablets, without altering the code to deal with touch, gyroscope, mouse scrollwheel etc. FlexiGUI uses JSON files to configure your GUI and gives ... read more |
|
3d website toolsMake your own 3d website with our online build tool. Use it to create a virtual world in which website visitors can walk around and meet eachother. Or use it to create a 3 dimensional environment with cool effect like mirror floors and real time shadows. This service will be discontinued per December 1st, 2014. A new and better tool for creating 3D website will follow soon. Go to 3dbuild |