Wednesday, 1 November 2017

Hubble Telescope made with Unity 3d

Hubble telescope finished and ready to be downloaded from

Most of the textures are in 4096x4096 px format and all materials are PBR.
Screenshots below were not modified, it is direct screen from Unity 3d game engine.

Tuesday, 12 September 2017

Simple extension class in ASP.NET C# application

We are going to write simple extension class to automatically add tax and give us gross price for net price. Very common feature in most of applications that are dealing with accounting, finance, trading, e commerce etc.

Seing code like this in lots of different places in application is not uncommon.

decimal grossPrice = (etPrice * 0.20) + netPrice;

It is not the end of the world if you are using that only in one place of the application, but in most case this code might appear in many places. As a developer I hate magic number (0.20 in this case) and not using DRY (do not repeat yourself) approach.

There is very simple approach to this problem I like to use - using extension.

Let's get straight to the code.

Constant class
public static class TaxConstants
    public static decimal TAX_VALUE = (decimal)0.20;

Extension class

namespace AbDeveloper.Extensions

public static class PriceExtension
    public static decimal AddTaxToNetValue(this decimal price)
      return price + price * Constants.TaxConstants.TAX_VALUE;

We can now easily test the functionality in test project.

using namespace AbDeveloper.Extensions;

  public class PriceExtensionTest
    public void TestAddTaxToNetValue()
      decimal netPrice = 20;
      decimal grossPrice = netPrice.AddTaxToNetValue();

      Assert.AreEqual(24, grossPrice, "Expected gross price is incorrect. Check AddTaxToNetValue method in PriceExtension class.");

At this stage test will pass and grossPrice will be equal 24 with an input of 20. If however tax rate will change to 0.25 (25%) test will fail.

In order to use extension in class make sure you will add "using namespace" expression.

Wednesday, 30 August 2017

The Richest Man in Babylon - 5 rules of gold

The Richest Man in Babylon - Book written in 1920s by George S.Clason still holds wisdom in terms of investing, business, money -

One of the chapters explains 5 rules of gold that wise man should follow. Below is my short explanation of how to apply those rules in modern world.

1. Gold cometh gladly and in increasing quantity to any man who will put by not less than one-tenth of his earnings to create an estate for his future and that of his family.

Make sure to save at least 10% of your net earnings..

2. Gold laboreth diligently and contentedly for the wise owner who finds for it profitable employment, multiplying even as the flocks of the field.

You can invest in bonds, stocks, low cost index funds(my personal preference), investment funds, ISA stock(UK only as I am aware), gold silver, crypto currencies such as bitcoin, ethereum. By buying stocks, investment funds and indexes you can also benefit from dividends. Avoid investing in stocks that do not pay dividends.

3. Gold clingeth to the protection of the cautious owner who invests it under the advice of men wise in its handling.

Invest your money wisely, avoid high leverage, get rich quick schemes, if something is too good to be true it's probably scam. When you are investing make sure to diversify your portfolio by investing in different types of markets.

4. Gold slippeth away from the man who invests it in businesses or purposes with which he is not familiar or which are not approved by those who are skilled in its keep.

Avoid investing in business you do not understand. This is very simple rule that greatest investor Warren Buffet follow.

5. Gold flees the man who would force it to impossible earnings or who followeth the alluring advice of tricksters and schemers or who trusts it to his own inexperience and romantic desires in investment.

Well connected with 3rd rule but it is very important to follow. Again I will quote Warren Buffet -"The first rule is not to lose. The second rule is not to forget the first rule".

Thursday, 4 August 2016

Piano Room PBR - Unity 3d asset

PBR Piano Room package was released to Unity3d store.

Piano is the main of focus of this package. It is divided into few submeshes:
Piano Bottom Body : 702 tris
Keys : 2724 tris in total (separate keys - 7 octaves) 51 white keys, 36 black
Piano Note Reader : 154 tris
Piano Top : 872 tris
Piano Interior Details : 312 tris
Piano Wheels and Details : 4860 tris
Piano Name : 252 tris

Each submesh material contains 4 textures(albedo, normal, ambient oclusion, metallic).
Normal maps are baked from very high poly(over 600k tris).

Room interior scene included:
Wall Lamp
Wall Details
Wooden Floor

Additional features:
Set time of a day dynamically
Set glowing background for exterior

Future planned release : 

- Map all keys to Midi output
- Play songs from tab notes
- Enable VR

Get the package here.

Thursday, 28 July 2016

Getting enum values to list of string List<string> C#

So you created an enum and you want to extract all the values to List<string>?

Example enum:

public enum FilterTypeLookup {
Textbox = 1,
Standard_Dropdown = 2,
Extended_Dropdown = 3,
Normal_Dropdown = 4,
Link = 5,
Label = 6,
Checkbox = 7,
Dropdown_with_Textbox_and_Button = 8,
Textbox_with_text_before_and_text_after = 9,
Radio_Button = 10,
Date_Picker = 11,
Month = 12,
Year = 13,
Customer_Dropdown = 14,
AutoComplete = 15

Probably the easiest way to do it is to use GetNames method on Enum.

return Enum.GetNames(typeof(FilterTypeLookup )).ToList();

If we want to make it more generic we can write helper method.

 public static List<string> GetNamesForEnums<T>()
            //Type type = t.GetType();
            return Enum.GetNames(typeof(T)).ToList();

Wednesday, 20 July 2016

PBR Wood Textures Pack

Recently I released PBR Wood texture for Unity 3d store. Each material will contain at least 4 textures(albedo, normal, ambient oclusion, height). Some material will also contain gloss and metallic texture. All textures are seamless and at least 1024x1024 px.

You can grab them at Unity store

For last 2 months it is top paid wood texture pack.

Monday, 18 July 2016

Adding multiple appSettings to webConfig file and getting value in ASP.MET MVC

Let's say we want to add few app settings file to a webconfig file, so if we have to change value of the key on the server, IIS does not have to recompile the whole application leading to better client/customer experience.

1. In webconfig add new section.


<section name="DatabaseConfig" type="System.Configuration.NameValueFileSectionHandler, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089">

2. Create new config file in solution, let's call it CodeBasedOnReferer.config.
3. Add new key

    <add key="" value="Google_123"></add>

4. To obtain the code in aplication in controller:

NameValueCollection settings = (NameValueCollection) ConfigurationManager.GetSection("DatabaseConfig");
string code = settings (Request.UrlReferrer.Authority);

5. You can test your application using for instance fiddler. To create request open fiddler. Just in case you do not have it :

6. Your code should be Google_123.

Wednesday, 11 May 2016

Reading content from dll - c# or vb

So you ever wanted to read code from dll regardless if it was written in c# or vb?

There is very good free tool on the market provided by JetBrains.

1. After installation open application.
2. Shortcut ctrl + O, or click on first left icon under Assembly Explorer and choose dll.

3. Double click on class to see the code.

Wednesday, 17 February 2016

Solar System version 3.0 update - [Released]

I decided to improve one of my top assets in Unity 3d store. Added new UI, planets info, atmosphere shader, 5 types of Sphere meshes (super low, low, medium, high poly, super high), realistic day/night transition for planet Earth. Info for planet is being read from txt file which can be very easily modified.

Current version of Solar System :

Wednesday, 3 February 2016

Solar System Unity 3d Asset Used In Asteroid Challenge Game Exclusive For Nintendo Wii

Solar System project that is available has been used to create Nintendo Wii exclusive game - Asteroid Challenge -

I am really glad too see that my project have been used in successful commercial environment.

I am working currently on new release of Solar System that will include new shader that will give realistic atmosphere for planets, better UI, 5 different Meshes(Super Low(400 tris), Low (1000 tris), Medium(5000 tris), High(20000 tris) and Super High(120000 tris)) and mobile shader for Sun.