Wednesday, February 21, 2018

Inheritance

public interface iBaseClass {
  void BaseClassMethod;
}


public class BaseClass : iBaseClass{
   // equivalent to private
   protected internal float accesibleToDerivedFloat = 0f;

   protected virtual void PrivateBaseClassMethod (){
      accesibleToDerivedFloat = 1f;
   }

   public virtual void BaseClassMethod ( //empty ) {}
}

====================================================

public interface IDerivedClass : IBaseClass{
}

public class DerivedClass : BaseClass, IDerivedClass{
   public override void PublicBaseClassMethod (){
      accesibleToDerivedFloat += 1f;
   }
}

Tuesday, February 13, 2018

Blender Sculpting Shortcuts


  • F = Adjust Brush SIZE
  • Shift + F = Adjust Brush Strength
  • Ctrl = Switch Between Add/Substract

Monday, August 14, 2017

Dependent Texture Reads

Not dependent:
float3 nonDependentTextureRead = tex2D(_MainTexture, input.texcoord).xyz;

Dependent:
float3 DependentTextureRead = tex2D(_MainTexture, input.texcoord.zw).xyz;
float3 DependentTextureRead = tex2D(_MainTexture, input.texcoord.yx).xyz;
float3 DependentTextureRead = tex2D(_MainTexture, input.texcoord*2.0).xyz;

==========================

struct v2f{
 half2 uv : TEXCOORDn; //pass uvs direcly
 half4 packed2uvs : TEXCOORDn; //afraid of dependent texture read, avoid packing 2 uvs into 1 varying
 half4 packed4Scalars : TEXCOORDn; //for general purpose scalar packing
}

tex2D(_Texture,i.uv); //good, fastest
tex2D(_Texture,i.uv.xy); //afraid of dependent texture read, depends on driver?. avoid
tex2D(_Texture,i.uv.zw); //afraid of dependent texture read. avoid

Saturday, May 20, 2017

Tuesday, March 28, 2017

Substance Designer/Painter Usages

Type Identifier Usage
Ambient Occlusion ambient_occlusion ambientOcclusion
Anisotropy Angle anisotropyangle anisotropyangle
Anisotropy Level anisotropylevel anisotropylevel
Base Color basecolor basecolor
Color ID id colorID
Curvature curvature curvature
Diffuse diffuse diffuse
Height height height
IOR ior ior
Metallic metallic metallic
Normal normal normal
Position position position
Reflection reflection reflection
Roughness roughness roughness
Specular specular specular
Specular Level specularlevel specularlevel
Thickness thickness thickness
Transmissive transmissive transmissive
User 0 user0 user0
User 1 user1 user1
User 2 user2 user2
User 3 user3 user3
User 4 user4 user4
User 5 user5 user5
User 6 user6 user6
User 7 user7 user7
World space normals world_space_normals normalWS

Wednesday, March 8, 2017

Unity Shader Property Names

Legacy

  • _MainTex (Texture, diffuse color in the RGB channels, transparency in the A channel)
  • _Color (Color, diffuse color tint. This is multiplied by _MainTex)
  • _SpecMap (Texture, specular map)
  • _SpecColor (Color, specular color tint)
  • _Shininess (Value or Slider, controls glossiness)
  • _BumpMap (Texture, normal map)
  • _TransparencyLM (Texture, rgb channels define colored transparency)
  • _Illum (Texture, for emissive materials. This will be a mask of _MainTex * _Color)

Standard

  • Albedo  (diffuse color)
  • Normal (tangent space normal, if written)
  • Emission
  • Specular (specular power in 0..1 range)
  • Gloss (specular intensity)
  • Alpha (alpha for transparencies)

Physical (metallic)

  • Albedo (base - diffuse or specular - color)
  • Normal (tangent space normal, if written)
  • Emission
  • Metallic (0=non-metal, 1=metal)
  • Smoothness (0=rough, 1=smooth)
  • Occlusion (occlusion - default 1)
  • Alpha (alpha for transparencies)

Physical (specular)

  • Albedo (diffuse color)
  • Specular (specular color)
  • Normal (tangent space normal, if written)
  • Emission
  • Smoothness (0=rough, 1=smooth)
  • Occlusion (occlusion  - default 1)
  • Alpha (alpha for transparencies)