Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 29 Feb 2012
Offline Last Active Mar 16 2016 04:00 AM

Posts I've Made

In Topic: Making gaussian blur more blurry

25 July 2015 - 12:52 AM

If your goal is just to make it "blurrier" you really don't need multiple passes (well not more than 2) but you can space more the samples you fetch.

Supposing you want a gaussian blur with 7 taps:


This is not actual code, is just to give an idea. 

const float weights[7] = {0.006, 0.061, 0.242, 0.382, 0.242, 0.061, 0.006}; // This would be equivalent to a gauss blur with std dev 1 
const int offsets[7] = {-3, -2, -1, 0, 1, 2, 3};

float2 width = direction*gaussWidth*pixelSize;   // Direction is (0,1) or (1,0) based on vertical or horizontal
for(int i=0; i<7; i++){
    OutColor += TextureSample(sceneColor, sceneColorSampler, UV + offsets[i]*width)*weights[i];


Increasing gaussWidth will increase the amount of blur. 


This will introduce visible artefacts if you chose a very high width, but works well for reasonable blurs. 

In Topic: Portfolio feedback request

15 December 2014 - 04:11 AM


(Note, in the CV section all the personal data info, apart from the name, are eliminated as I am still unsure if I am up to having them public)

I think you should at least make your email address public. After all it might happen that someone stumbles across your page and want to contact you.
To prevent spambots from reading the email address you can use a mix of javascript and <noscript>. I use the following code on my homepage and did not get a single spam mail so far (but there are tons of bots on the website).
<script language="JavaScript" type="text/javascript">
	var string1 = "mail";
	var string2 = "@";
	var string3 = "domain.com";
	var string4 = string1 + string2 + string3;
	document.write("<a href=" + "mail" + "to:" + string1 + string2 + string3 + ">" + string4 + "</" + "a>");
</script><noscript>mail [at] domain [dot] com</noscript>

Thanks for the script, I will use it! However when sending the page for application I will make it public for sure. It is just now that the page is not yet used for its purpose.

In Topic: Perpendicular vectors on mesh starting from screen space

13 August 2014 - 02:20 AM

From currPixel and currPixel + (0,1) you can compute another vector that is approximately tangent to the mesh. Now use the Gram-Schmidt procedure to make the two vectors perpendicular, while still spanning the same plane. That should do.

Thank you very much! I don't know why I didn't thought of Gram-Schmidt. 

In Topic: BRDF gone wrong

22 April 2014 - 05:33 PM

The most common cause of NaN in a shader is division by 0. In your case you will get division by 0 whenever NdotL or NdotV is 0, since your denominator has those terms in in it. To make that work with your current setup, you would need to wrap your specular calculations in an if statement that checks if both N dot L and N dot V are greater than 0. However in many cases it's possible to write your code in such a way that there's no chance of division by 0. For instance, take your "implicit G" function. This is meant to cancel out the NdotL * NdotV in the denominator by putting the same terms in the numerator. So in that case, it would be better if you canceled it out in your code by removing the implicitG function and then also removing the N dot L and N dot V from the denominator. 


Also I should point out another common mistake that you're making, which is that you need to multiply your entire BRDF by NdotL. If you look up the definition of the BRDF, you'll find that it's the ratio of lighting scattered towards the eye (which is the value you're computing in your fragment shader) relative to the irradiance incident to the surface. When you're dealing point lights/spot lights/directional lights/etc. the irradiance is equal to LightIntensity * LightAttenuation * Shadowing * NdotL. In your case you don't have shadows and you don't seem to be using an attenuation factor (which is fine), you 'll want to multiply your specular by (uLightColor * NdotL). A lot of people tend to associate the NdotL with diffuse, but really it's not part of the diffuse BRDF. A lambertian diffuse BRDF is actually just a constant value, the NdotL is part of the irradiance calculations.


Oh thank you very much! I indeed re-wrote everything (that snippet is an extract) so to  avoid division as much as possible and it now works like a charm. As for the NdotL issue thank you for pointing out, I did know that on back of my head but I probably got confused by what was in a old piece of code of mine! 

In Topic: Experience after uni before landing into industry

12 April 2014 - 02:27 PM

Job hunting can be a slow and long process, so probably good to start as soon as your studies are done - or even while you're still studying if a good opportunity arises, e.g. If you see an ad for a junior / entry-level graphics programmer!

Your SSS work will be good portfolio material. Make sure to explore a few different trade-offs and/or different techniques. If you can, use code samples from that project in your portfolio.

Other gfx work that you could do to practice could be
- if you're interested in API design, make a wrapper around one or more other APIs, such as a d3d/GL portability layer, or a high level renderer on top of either d3d or GL.
- do more post processing work, such as DOF, bloom, HDR tonemapping, lens flares, color correction, etc.
- implement a few different lighting systems and the ability to switch between at runtime, e.g. Forward, deferred, light-pre-pass, inferred, forward+, clustered deferred, etc.
- implement a few different shadow systems, e.g. Cascades, omni lights, spotlights / filters like PCF, ESM, VSM, etc.
- implement some different material models (BRDFs) like Lambert, Phong, Blinn-Phong, Cook-Torrence, GGX, Ward, etc.

P.S. Don't worry about the impostor syndrome. Everyone will have low expectations of a new graduate, and will expect them to learn a lot on the job. As long as you're capable of continually learning, you'll be fine. Also, a lot of people working in the industry are of an average skill level, not everyone is a rock star coder ;)

P.p.s. Gfx programmers are really in demand right now, there's lots of advertised positions. Join some of the game jobs groups on LinkedIn so recruiters can find you. Describe yourself as a graphics programmer on there too ;)
I don't often see junior gfx programmer jobs listed, but because demand is so high, some companies may be willing to hire one anyway, because they can't find any senior/intermediate candidates.
I personally started in gameplay, then tools, then transferred internally to graphics, then effects, then engine... But you might get lucky and find a good gfx spot right away.



An enlightening reply! Thank you so much! I'll try some of the things you cited.

As far learning is concerned I'm always extremely eager to learn!


Again, I sincerely thank you a lot for this answer!