Posts

Developing my own little 3D Engine

Image
Developing my own little 3D engine is a dream that I had since I've played for the first time Quake II, my first first person shooter. Here's a quick video of what I came up with until now. And here the list of the incredible features my engine currently has 😂: Developed in C++ Uses just four dependencies: SDL 2.0 to get an OpenGL context, GLAD to load OpenGL extensions, GLM math library and SOIL to load textures. Runs on both Windows and Linux Arcball Camera OBB collision system Ray picking objectes selection Directional Light Directional Light Shadow Mapping Custom OBJ file parser

GLSL Shader in Maya Part 2: Textures

Image
Welcome to a new chapter in our experiment to make Maya work as a shader editor. I'm going to show you a simple shader to load textures using the second method I've shown you in the previous article. The code is pretty much self explanatory, look at the comments to find out more. basic_texture.ogsfx  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 // Tell included shaders to use OGSFX semantics and streams: #define OGSFX 1 //########################### UNIFORMS ########################### // Uniform parameter handling // Loads the uniforms from all shader stage files #define HIDE_OGSFX_UNIFORMS 0 #define HIDE_OGSFX_STREAMS 1 #define HIDE_OGSFX_CODE 1 #include "basic_texture.glslv" #include "basic_texture.glslf" //########################### ATTRIBUTES ########################### // Input stream handling: // Loads the attrib...

GLSL Shader in Maya Part 1

Image
Maya to act like an (expensive) shader editor There aren't many shader editors out there, not as many as it used to be in the early 2000s when AMD had RenderMonkey and Nvidia had FX Composer. They were pretty good softwares in my own humble opinion and it's a pity they have been discontinued. These days we have Shadertoy but to be honest I prefer native applications, yes I'm old school! I've always known that Maya supports HLSL and GLSL shaders in Viewport 2.0 so I've started to think that it would be really cool to use it like a shader editor. But it's not as simple as I would have expected, the documentation around the net is pretty sparse so it's a matter of trials and errors. Why GLSL and not HLSL? I have nothing against HLSL, in fact I use it extensively in Unity (well to be precise I use Cg which is NVidia version of HLSL). I've decided to go with GLSL simply because is more portable and I like to use Maya on Linux for my person...

Unity Shader: Spherical Mask Dissolve

Image
Spherical Mask Dissolve Shader This shader is the combination of the two previous shader, the Dissolve shader and the Spherical Mask shader to get a "reveal world" kind of shader, something like you have experienced in games like Beyond Eyes . If you remember, in the Dissolve shader we used a  _DissolveTexture  to get a dissolve_value . Because the dissolve_value is in the range of (0,1) we needed an _Amount value to be subtracted from the dissolve_value so that the clip() function can discard all the pixels that has a dissolve_value < 0. In the Spherical Mask Dissolve shader we don't have an _Amount value, instead we have to compute it! To compute the _Amount value (that in this shader is called amount) , we use the technique showed in the Spherical Mask Shader. In the Spherical Mask Shader we checked if a pixel was inside of the player radius of action, if it was we color it, if it wasn't we let it in grayscale. Here we use the same logic to define ...

Unity Shader: Spherical Mask

Image
I'm a big fan of Beyond Eyes game and the way the world takes form while the little girl walks around. Last time we looked at the dissolve effect this time we take a look at Spherical Mask effect. The two effects combined together will let us create a custom shader that emulates the Beyond Eyes effect. Let's begin! Spherical Mask The image above is pretty self explanatory, we have a player object that has a radius of action, every pixels inside its radius of action will be colored while the others stay in grayscale. Let's begin with adding two input propeties to our shader: 1 2 3 4 5 6 7 8 9 Properties { //...other shader properties //Spherical Mask properties _PlayerPosition( "Player Position" , Vector) = ( 0 , 0 , 0 , 0 ) _Radius( "Mask Radius" , Range( 0 , 100 )) = 0 _Softness( "Mask Softness" , Range( 0 , 100 )) = 0 } _PlayerPosition passes the player postion to the shader  _Radius is the player radius ...

Unity Shader: Dissolve Shader

Image
In this article I'd like to show you a quick and easy way to implement the dissolve effect. Mind you, the code is not optimized to make it easier (hopefully) to understand. Let's begin! The Dissolve Texture First of all we need a dissolve texture and we can generate it ourselves using Photoshop Cloud filter. Here's mine: The Shader Add a new Standard Surface Shader in Unity. Add two new input properties to our shader: 1 2 3 4 5 6 7 8 Properties { //...Other shader properties //Dissolve Shader Properties _DissolveTexture ( "Dissolve Texture" , 2D ) = "white" {} _Amount( "Dissolve Amount" , Range( 0 , 1 )) = 0 } _DissolveTexture is where we put our dissolve texture _Amount represents the progress of dissolving our object (0 = visible, 1 = disappeared) In the surf function is where the magic happens! We get the  dissolve_value by sampling the color of our _DissolveTexture using the...

Zbrush: My first attempt at sculpting a super villain mask

Image
Yeah I'm a programmer but I'd love to be a 3D Artist 😁 My girlfriend Giulia bought me a Wacom Intuos tablet bundled with ZBrush Core and in my spare time I've started learning this amazing software. Here's my first attempt at sculpting a super villain mask 😃 Please enjoy!