Posts

Showing posts from May, 2019

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