OpenGL Shader Programming Resources Round-up

16. May 2014

 

The following is a collection of modern shader programming resources.  I intend to improve my knowledge of shader programming and intended to gather all the current resources I could access together in one place.  This resource (mostly) ignores HLSL ( Direct3D ) and custom implementations, like Unity3D.

Please note, this resource is only about shader programming only.  There exist tons of resources that are about OpenGL programming, which as a subset includes GLSL.  I covered many of these resources in my previous Modern OpenGL Resources round-up.  So if you are looking for tutorials, samples and books on OpenGL programming, you should start there.

 

Sites

 

Kick.js Shader Editor

Online shader editor tool with realtime preview and samples as well as error console.

 

Shadertoy

An absolute must visit.  Think of it as the gitbhub for shaders.  Create, share and view hundreds of others shaders.  The site is awesome, but a warning.  It will absolutely kick the crap out of your browser, as the home page, somewhat dumbly, opens dozens of shaders at once. 

 

Shdr

Online GL shader editor/validator/preview similar to Kick.js.  Open sourced MIT license.

 

GLSL Sandbox

Another site for discovering and sharing shaders, including a simple editor.

 

For tutorials links see the Modern OpenGL Resources round-up.

 

Tools

 

nVidia Nsight / CUDA Toolkit

Among other functionality, Nsight provides a GLSL/HLSL shader editor and enables shader debugging.  For Mac/Linux it’s available for Eclipse, but on Windows it’s a Visual Studio plugin.  Unfortunately, Visual Studio 2013 isn’t supported yet and Express versions do not support plugins, so I have not tried it yet.

 

AMD GPU PerfStudio

AMD’s GPU toolset.  Includes a shader editor and debugger, but sadly it’s currently HLSL only.  Worse, its DX11 only, meaning the converter probably wont work.

 

AMD GPU ShaderAnalyzer

Tool for analysing shader performance, doth GLSL and HLSL.

 

GLSL Hacker

Cross platform tool for 3D prototyping.  Load a 3D object and see your shader in action.

 

HLSL2GLSL

Convert DirectX9 HLSL shaders to GLSL.  Was originally released by AMD, then forked by someone on the Unity team.  Useful if trying to support both renderers, or using a tool that exports only HLSL shaders.  It’s open source and apparently the source is pretty awful.

 

nVidia FX Composer

nVidia’s shader IDE.  Abandoned, doesn’t directly support GLSL. :(

 

Rendermonkey

AMD/ATI’s shader IDE.  Also abandoned, a long time ago. :(

 

ShaderDesigner

GLSL IDE.  It’s old but seemingly was updated last year.  Didn’t run due to need to install component that required a license server.  I hate installing license servers to my machine.

 

Apple OpenGL Shader Builder

Apple include a development environment for developing and testing GL shaders.  It is however OS/X only and you need to log in to their developer portal to download.  The Guide is available without logging in.

 

qshaderedit

An open source, cross platform shader editor inspired by Apple’s Shader Builder.

 

Shazzam Shader Editor

First off, this exports HLSL to GLSL ( see HLSL2GLSL above ) and is aimed at XAML/Silverlight developers.  It does however include a shader editor and the ability to preview the results.  Last updated July 14th, 2012.

 

Glman

A simple tool for learning shader programming.  Includes the course work the tool is meant to supplement.  Last updated Dec 7, 2011.

 

GLShaders for Eclipse

Eclipse plugin for developing shaders ( vertex and pixel ) inside the Eclipse IDE.  Provides syntax colouring and error/warnings.

 

Books ( Shader specific )

 

GLSL Essentials

Dec 2013, Packt

SafariLink

116 Pages

 

OpenGL 4 Shading Language Cookbook 2nd Edition

Dec 2013, Packt

SafariLink

394 Pages

For some reason, Safari version is Second Edition, while on Amazon I can only find the first edition published in 2011.

 

Graphics Shaders: Theory and Practice, 2nd Edition

Nov 2011, CRC Press

SafariLink

518 Pages

 

OpenGL Shading Language, 3rd Edition

July 2009, Addison-Wesley

SafariLink

792 Pages

Once again, the above are simply books *dedicated* to shader programming and GLSL in specific.  Any modern OpenGL text will have a great deal of content on shader programming.  In fact, if it doesn’t you probably shouldn’t touch it, as it is heavily out of date.

Programming




Trying to run our C++ tutorial on a new Visual Studio version and getting a MSVCR100D.dll missing error

14. May 2014

 

I’ve had a few users run into this error when trying to run the GameFromScratch C++ Game Dev tutorial:

 

image

 

The program can’t start because MSVCR100D.dll is missing from your computer.  Try reinstalling the program to fix this problem.

 

Fortunately this can be pretty easily fixed, simply download and install the Visual Studio 2010 runtime redistributable.  You can download it here.

 

However…

 

The binaries I include with the SFML tutorial of SFML 1.6 are compiled for Visual Studio 2010 and aren’t compatible with Visual Studio 2012/2013.  Normally this is just a matter of recompiling SFML 1.6 in the newest version of Visual Studio, then linking against those Lib/DLL files.  However this process certainly isn't straight forward as the SFML 1.6 code base was actually targeting for Visual Studio 2008 and amazingly enough, depending on some external libraries compiled for Visual C++ 2005!

 

To be honest, if you are running through this tutorial series, by far the easiest solution is to install Visual C++ 2010 Express.  It can be installed side by side with newer versions.

 

If there is enough demand, I can try to make 2013 compatible binaries that you can include with your project.

Programming ,




An “Unreal” week for game developers

10. May 2014

 

First off, sorry for the horrible pun… I wont do it again… at least not today.

 

That said, Unreal may have just flipped the industry on it’s head… or may have just dropped a cleaver marketing gimmick.  By now you have probably heard that Unreal Tournament development will be done in the open.  At least for Unreal Engine subscribers it will be.  Basically if you subscribe to Unreal Engine for 19$ a month, you get Unreal Tournament for free.  The biggest part of the announcement is you get access to a Github repository, so you can watch the game develop, or perhaps even get involved!

 

In Unreal’s own words:

 

HERE’S THE PLAN:
  • We’ve created a small team of UT veterans that are beginning work on the project starting today.
  • From the very first line of code, the very first art created and design decision made, development will happen in the open, as a collaboration between Epic, UT fans and UE4 developers. We’ll be using forums for discussion, and Twitch streams for regular updates.
  • If you are a fan and you want to participate, create a free account and join the forum discussion.
  • All code and content will be available live to UE4 developers on GitHub.
  • The game will be true to its roots as a competitive FPS.
  • Development will be focused on Windows, Mac and Linux.

 

SO WHAT’S THE CATCH?
  • It will take many months until the game is playable by gamers. This is real development from scratch.
  • When the game is playable, it will be free. Not free to play, just free.
  • We’ll eventually create a marketplace where developers, modders, artists and gamers can give away, buy and sell mods and content. Earnings from the marketplace will be split between the mod/content developer, and Epic.  That’s how we plan to pay for the game.

 

So why do I find this move so impressive?  There are a couple reasons…

 

First I was wondering if I would maintain my subscription.  If I am not actively developing in Unreal Engine, was there any point in paying 19$ a month?  I, and many others, wondered if Unreal would keep a stream of content coming that would keep developers paying.  To actively open up a potentially AAA game’s development process is certainly a good hook to keep me watching.  ( Plus, they’ve done a pretty good job keeping the content coming… more on that in a second ).

 

Second, quasi-open sourcing a game could be a brilliant strategy.  Indie developers get to contribute to a large project, probably beyond the scope of what they would otherwise be able to participate in.  Unreal of course gets a ton of free development effort, but retains dictatorial control that large scope games need.  Of course they will have to be selective about what they commit to their main trunk and may bruise some egos, so this could be a bit of a balancing act and will require additional resources on their end, but the trade-offs are probably worth it.  I would generally think this would be mostly a read only process, basically just Unreal developing a game and the community watching.  However they have recently accepted a number of community fixes into the Unreal engine base, so I don’t think this is just marketing.  If nothing else, many indie game developers get the opportunity to eavesdrop on a AAA game’s development, including developer discussions and twitch streams, for a price tag of 19$ a month.

 

The Unreal Tournament github repository is now online:

image

Of course, this is a from scratch project, so have very little expectations for now!

 

 

Finally and perhaps most disruptively “create a marketplace where developers, modders, artists and gamers can give away, buy and sell mods and content. Earnings from the marketplace will be split between the mod/content developer, and Epic”.  This point is MASSIVE.  Basically Unreal are releasing a F2P title where the microtransactions come from the community.  This is a powerful concept, enabling artists and coders to actually get paid for their work, using the exact same tools and process as the parent.  Just as artists and programmers can make a living providing assets to the Unity store, in the future, they will potentially make a living contributing to a game.  A game they potentially helped create.

 

 

Oh, remember earlier where I said Unreal would have to keep a pretty steady stream of updates to keep people subscribed?  Well, impressively enough, they have been.  Since the 1.1 patch ( adding XBox One and PS4 support ) there have been a half dozen new tutorials added, covering topics such as Localization, skeletal meshes and Blueprint complexity management.  Additionally they added a SciFi hallways level:

SciFi Screenshot 1

 

The marketplace is quickly being populated with professional quality examples to work from.  You can read more about the design process here.

 

I have to say Unreal are impressing the hell out of me.  They are taking bold risks and truly are throwing their resources at this, it’s not some half assed indie release like CryEngine or prior UDK releases… this is a slick well supported product and most importantly a thriving community.  Unreal are willing to try some very disruptive strategies and we should applaud them for it.

 

I for one will be keeping my 19$ a month subscription going.

 

Oh yeah, and on that topic, they’ve also laid out a blueprint ( ugh, bad accidental pun! ) for future Unreal development.  You can check it out here on Trello.  This transparency is certainly a good thing.  You can also vote and comment on features that are most important to you, a nice feedback loop with subscribers.

News, Programming ,




GamefromScratch just moved… literally

10. May 2014

 

Sorry for the quietness in these parts of late, I recently purchased a new place and have been taken off line for most of the last week as a result.  This explains the lack of posts here on GameFromScratch.com.  Fortunately things should get back to normal starting early next week.

 

On the bright side, I have MUCH more space than before and for better or worse, I now have natural light where I work.  Perhaps I will no longer burst into flames when coming into contact with the stuff!

 

Below is ground zero for GameFromScratch, or at least 90% there, still some unpacking to be done.  Although reality is, I still spend the majority of my time on the move.

 

1

 

2

 

3

 

I really need a good solution for cable management.  For now I am just going to use black twist ties, but that always gets annoying.  I am also in the market for a small side table with wheels, as I’ve got a couple machines still wrapped up and unusable for now.  Nice to not be completely cluttered for now though at least.

Totally Off Topic




Version 3.0 of the Torque2D game engine released

4. May 2014

 

Last year the Torque2D was open sourced under an MIT license by GarageGames.  Torque2D is a cross platform 2D game engine.  Originally it only targeted Windows, OSX and iOS.  Now fortunately support for Android, Web and Linux have been added with the release of version 3.0.

 

From the release notes, here is what’s new:

What’s New in 3.0


The following is a summary of the major changes and additions:


Android, Linux, and Web Support

The major focus of this release brings several additional platform publishing options for your game or application. T2D truly delivers on cross platform support, making it easy with one codebase to reach many different audiences on many different devices.

64-bit Applications

In addition to the standard 32-bit support we’ve always had, the engine can now compile as a native 64-bit application for platforms that support it.

Named Image Cells and Frames

Until now, image frames have always been referenced using a numerical index. Now, developers have the opportunity to give explicit ImageAsset cells specific names. Those names can then be used with all SceneObject derived classes that consume ImageAssets.

<ImageAsset 

  1.     AssetName="soldierWalk"
  2.     ImageFile="@assetFile=soldierWalk.png">   
  3.     <ImageAsset.Cells> 
  4.         <Cell RegionName="walk1" Offset="2 2" Width="103" Height="66"/> 
  5.         <Cell RegionName="walk2" Offset="179 100" Width="37" Height="35"/> 
  6.         <Cell RegionName="walk3" Offset="2 70" Width="65" Height="31"/> 
  7.         <Cell RegionName="walk4" Offset="161 137" Width="36" Height="41"/>         
  8.     </ImageAsset.Cells> 
  9. </ImageAsset> 
  10. <AnimationAsset 
  11.     AssetName="soldierWalkAnim"
  12.     Image="@asset=ToyAssets:soldierWalk 
  13.     NamedAnimationFrames="walk1 walk2 walk3 walk4"
  14.     AnimationTime="1" /> 

Skeletal Animation

We are pleased to announce that an initial implementation for skeletal animation is now available. The first format supported comes from the animation program Spine.
t2dtutorials.com/img/SpineToy.png
Leap Motion Controller

The Leap Motion controller takes input from hands, fingers, and small tools that are moved just above its surface and provides their absolute position and rotation through the Leap SDK. Torque 2D offers built in integration and now includes a demo toy to show off how it works.
t2dtutorials.com/img/LeapToy.png
Xbox 360 Controller

Gamepad support has always been part of the engine, but now the necessary code to use an Xbox 360 controller with T2D has been added.

JSON Format for TAML

Joining XML and binary, developers can how serialize their game objects and scenes in the JSON format, with the engine being able to read-in or write-out this format as easily as the others.

 

  1. "Sprite": { 
  2. "SceneLayer": "31", 
  3. "Size": "100 75", 
  4. "BodyType": "Static", 
  5. "BlendColor": "SlateGray", 
  6. "Image": "@asset=ToyAssets:highlightBackground", 
  7. "Frame": "0"
  8.     } 

ConsoleMethodWithDocs

A major undertaking in the codebase, the vast majority of TorqueScript binding methods and global functions have moved into their own header files. This makes the engine code much easier to read and allowed us to further integrate Doxygen support for a comprehensive reference guide available in the wiki.

ScriptObject Behaviors

Behavior support was added to the ScriptObject class. If you enjoy writing behaviors, now there is an engine class outside of the Scene and SceneObjects which can use them.

Polar Coordinate Changes

One of the few changes made that would break any of your existing scripts - polar coordinates have been standardized throughout the engine to follow the typical polar axis convention where 0 degrees is horizontal and to the right.

New Sandbox Toys

A few more toys were added to the Sandbox, giving new users even more practical examples to learn from. These include AudioToy, AngleToy, LeapToy, and SpineToy.
t2dtutorials.com/img/AudioToy.png

Change List


Below is a list of all changes that have been made to the development branch of the Torque2D repository since the 2.0 release and have now been pushed to the master branch and tagged as Torque 2D 3.0.
TAML supports reading and writing in JSON format
Batch renderer now works exclusively with triangles instead of quads
Fixed SceneObject.applyForce and applyLinearImpulse
Added signum convenience function (PR #56)
New Gui Object: GuiGridCtrl (PR #9)
Added missing TorqueScript methods to ParticleAsset/Emitter/Player, renamed a few static fields for consistency (breaking change) (PR #68)
Fixed ImageAsset typo - image width and height were swapped (PR #70)
All picking modes for CompositeSprite are now functional (PR #69)
TextureManager fix - replaced call to use expandPath (PR #83)
ParticleAsset creation fix - now writes out correctly to TAML (PR #84)
ParticlePlayer play and stop functions now correctly pause and unpause emitters (PR #85)
Added functions to get the explict width and height of cells to ImageAsset (PR #88)
Fixed AABB size in ImageFont (PR #97)
Fixed TAML bug with ImageFont (PR #99)
Fixed TAML bug with ShapeVector (PR #104)
Added Mac OSX 10.6 support (PR #101)
Added linear interpolation and smooth step functions, SceneWindow now uses these (PR #95)
OpenAL streaming audio fix (PR #106)
OpenAL pause and unpause audio fix (PR #115)
OpenAL shutdown fix (PR #114)
PointForceController getPosition definition fix (PR #110)
SimXMLDocument crash fix (PR #113)
Replaced most ConsoleMethod (and functions) with ConsoleMethodWithDocs for easier Doxygen reading, moved most console methods into their own ScriptBinding.h files. (PR #116)
Behavior support for ScriptObject (PR #121)
Angle/polar coordinate issue fixes (breaking change), AngleToy added to Sandbox (PR #123)
Input bug fix for OSX (PR #125)
Fix assert conditional in consoleNamespace.cc (PR #126)
Android platform support added
Xbox 360 controller support (PR #136)
Leap Motion controller support, LeapToy added to Sandbox (PR #137)
Added missing Mutex to StringTable::lookupn (PR #127)
Asset support for named cells and frames (PR #139)
Bugfix for SceneObject::getContacts (PR #142)
Fixed deleting a clone of an object breaking the original object (PR #143)
Fixed bug that prevented scene controllers from being read by TAML (PR #145)
Initial implementation of Spine support, SpineToy added to Sandbox (PR #146)
Doxygen file cleanup (PR #148)
Fixed some Xcode compiler warnings (PR #150)
64-bit platform support (PR #154)
Fixed GUI object namespace issue (PR #152)
Fixed crash when executing FileDialogs (PR #153)
Linux platform support (PR #138)
AudioToy added to the Sandbox
Exposed method CompositeSprite::getSpriteLogicalPosition in TorqueScript (PR #155)
Emscripten platform support (PR #157)
Fixed TAML binary writer crash (PR #158)
Fixed compile errors and warnings resulting from the Xcode 5.1 update (PR #159)
Windows platform fixes (PR #168)
SkeletonObject now respects scene layer depth settings (PR #171)
Named cell and frame improvements (PR #172)
Fixed iOS7 bug with audio not playing (PR #175)
Arm64 support (PR #176)
Removed PVRTexTool files (PR #177)
Android platform fixes (PR #174)
Visual Studio 2013 solution files added (PR #182)
Behavior Connection bug fixes (PR #183)

 

Torque2D is available on Github.

 

I’ve personally never checked out Torque2D, one of the biggest drawbacks was the limited platform support, which has been solved by this release.  My other major caveat is their use of a proprietary scripting language, something I am generally not a fan off.

News ,