I'm a professional game developer from Wakefield, England, working as a senior programmer for Rebellion North.
I'm a married father of five and I a also sometimes do Retroburn stuff.
Martin 'Bytrix' Caine
Father. C++ Games Programmer. Cyclist. Guitarist.
2013 3d alphalabs amazon apple archivirtual asynchronous battlefield bad company 2 ben 10 bepu beta blackmagic design blog blue marble bootcamp borderlands bsp calibration charity charvel childsplay comments competition content tracker counter-strike crash csgo css3 cycling dear esther deferred deus ex develop conference direct x discipline documentation doom 3 bfg dpi dr bott eidos elite force email deliverability eurogamer expo facebook focus fresnel game development game horizon game republic gamedev games gaming geoip girls make games global offensive grid guitar half-life 2 hawken hd7 hobbyist htc humble indie bundle imac indie indie trials indietrials intensity pro ip-countryside iron man 3 jamulus rift jquery kids kinect launch conference left 4 dead live lost mac mac osx manchester manhacks mass effect 2 matrox maya minecraft mirrors edge montreal morrowind movies museum of the microstar music mxo2 mini mysql nausea network networking nokia normal mapping obj oculus rift omnitrix ouya pedal for pounds php physics playstation suite port25 portal portal 2 positron posters powermta project aedra project euler promotion properties proton pulse ps vita ps4 psn racer reddit rendering retroburn game studios reviews rift racer riftracer roadkill roller coaster sdl2 shadow racers sharks shoct skyrifters snds space cadet spam trap star trek steam stencyl storage super stock sd1 fr superhot team fortress 2 tesselating tesselation texture editor thunderbird thunderclap ticktock games tiga track builder track bulder trials tv twitter uk ultimatrix usergroup vequencer video vireio visual assist visual studio vorpx voucher vr vr cinema war thunder warren web willow windows 8 windows 8.1 windows phone 7 workbench wp7 wp7dev xbla xblig xblig network xbox xbox live indie games xna xnaukug xperia play zombies on the holodeck
Email Deliverability
Thursday, May 27th 2010 / XNA

The Fresnel term

I've spent the last few days reworking some of the core shaders in my XNA games and in particular working on the shaders that render the cars in our racing game Shadow Racers.

I've managed to get it all working just as I want now except for the reflections and I've spent the last few days wondering how best to calculate and combine the reflection with the diffuse colour. This morning I was searching again and found some information about the Fresnel Term (and I had infact seen it in an XNA sample yesterday but didn't realise what it was).

Basically the dilemma I had was that the cars contain painted parts and black/grey parts (the windows) with a mask texture defining how reflective those parts should be.

I couldn't quite figure out the best way to combine the diffuse colour and the reflection but having now read about the Fresnel Term I think that should work.

Basically you take the dot product of your surface normal and your view vector then use that to lerp the diffuse and reflection maps. When done correctly, looking directly at the surface should yield no reflection and looking parallel to the surface should yield 100% reflectivity.

I'm going to have to see how this looks tonight but if it works then I think I'll finally be happy with the way the cars look and will get some screenshots ready for those who're interested.

If you found this post helpful please leave a comment below:
Tags:   fresnel   shadow racers   xna