Error with Three.js shader – ERROR :GL_INVALID_OPERATION – fix

[tweetmeme source=”neoRiley” only_single=false] I was just in the process of trying to narrow down what does and doesn’t work in IE11 with Three.js’ shaders and ran into this error message while working with the normalmap shader:

ERROR :GL_INVALID_OPERATION : glDrawElements: attempt to access out of range vertices in attribute 1

The fix is to simply call computeTangents() on your mesh’s geometry object, and bingo, we’re in business:


Here’s the block for context:

var shader = THREE.ShaderLib[ "normalmap" ];</pre>
var uniforms = THREE.UniformsUtils.clone( shader.uniforms );

uniforms[ "enableAO" ].value = false;
uniforms[ "enableDiffuse" ].value = true;
uniforms[ "enableSpecular" ].value = true;

uniforms[ "tDiffuse" ].value = fdo.colorMap;
uniforms[ "tNormal" ].value = fdo.normalMap;
uniforms[ "tSpecular" ].value = fdo.specularMap;

uniforms[ "diffuse" ].value.setHex( 0xFFFFFF );
uniforms[ "specular" ].value.setHex( 0xFFFFFF );
uniforms[ "ambient" ].value.setHex( 0x222222 );

uniforms[ "shininess" ].value = 10;
parameters = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShader, uniforms: uniforms, lights: true };
mat = new THREE.ShaderMaterial( parameters );

model.material = mat;

NGUI for Unity

After interviewing with a few unity3D shops,I was hit with the same question every single time: “do you have NGUI experience?” – to which I replied “no, but I’m sure I can pick it up”. They didn’t share my optimism 🙂 Enter in NGUI for Unity!

What I love about e-books these days is their size and how concise they can be, and this book delivers not only on both counts, but sets you in motion with a very real world example project that covers a great portion of the capabilities of NGUI. Everything from the wizards to widgets to creating atlas’ and fonts is covered. The book isn’t exhaustive in its explanations but IS thorough in pointing out the features and properties of all the components it covers – which makes it easy to follow along with in the examples.

The author gets right to the meat of the matter immediately walking you step by step through the sample project. It helps to have Unity3D experience and you’ll have to understand the basics of how unity works with prefabs and code as this book is targeting unity devs looking for a solid UI framework. It IS written in a very practical manner so even a complete beginner could get something out of it.

Now, in thinking back about my response to potential clients about just “picking NGUI up”, I see how deep the framework really is. It’s much more than just a set of UI components, and this book really brought me up to speed in a very short amount if time – excellent work!

Find more information here

Save Pinky! now on Android

Well, it took a couple of weeks to integrate the android plugins in to the project to co-exist with the iOS plugins 😉 But overall the experience was very good and it runs excellent on android!

So if you’ve felt left out of the fun, now’s your chance to show those iOS players how Android players roll!

Get it

WebGL Helicopter update

Ok, I know videos are only so good and you probably want to try the real thing – I get it!  It’s almost there!  I just have to clean up a few things to make it not so frustrating because flying the helicopter in and of itself will probably most frustrating 😉  If you ever played Battlefield 1942 with the Desert Combat mod and learned how to fly the helicopters there, this will be JUST like that.  I loved flying the helicopters in that game – and ever since then it’s just gone down hill.  They keep putting baby controls on the stupid things and it just ruins the cool factor IMO.  Yeah it was hard to fly, but once you got it, you owned just about anyone and everyone in the game.

Anyway, I originally mimic’d the physics and that worked ok, but then thought why not dive into a javascript physics engine and really get dirty.  So, I picked up Ammo (which is a straight API port of Bullet) and armed with very little in terms of documentation and examples was able to mimic the flight experience I’d created in Unity3D.  I’ll definitely be posting some examples and explanations of things I learned so sit tight for that – I’ll definitely attempt to de-mystify using Ammo as much as I can.

Goo Create IDE

If you saw the earlier post where I had an industrial area, you’ll notice that this time the scene is completely different.  I wanted to play with the different shaders and post processing affects and after playing with Goo I was inspired to recreate the scene I’d created there, here.  Goo definitely makes it a million times easier to achieve this look (another post for another time).  The floor is a mirror which has a nice subtle smoke / noise map and the only effect I applied was a vignette.  The performance so far is good at 60fps, but after adding the skyscrapers it’s starting to show signs of hitting the performance cap.

At this point, my overall impression of WebGL development is both inspiring and disappointing and somewhat cruel.  Documentation is probably my biggest gripe.  For Ammo, I had to go to Bullet’s API and docs and for examples, I just had to search the web for anyone who might have used Threejs with Ammo.  Thankfully, there was just enough to answer the basic questions, but it was tedious to say the VERY least.  Don’t get me started about browser issues and simple things like locking the mouse – I mean geez, really?? is that so much to ask a browser to do?  I have it working, but was astonished to find this wasn’t something supported up until recently and even then it’s only the main browsers (shocker, I thought I’d left all this crap back in the late 90’s? – why people are anti-plugin is beyond me, talk about wasted hours in QA?! oye!)

Ok, I’ll rant later and rave as well.  There’s good and bad of course, but the bottom line is, I at least enjoyed myself and the challenge has taken me back to the days when Papervision3D was just starting and we had no idea how to do many of the things we developed.  So that part is really very cool 😉

I promise – I’ll get the link up soon for you guys to try!

WebGL Helicopter Demo – Controls

It’s funny how things in life prompt you to change course or learn something new.  If you’d asked me a month ago about WebGL and if I’d be doing it, I would have surely said “no”.  But, after talking to 2 different agencies about contract work recently, I quickly realized that WebGL was catching fire to a certain extent.  Then, after talking to Carlos Ulloa about it, I realized I had a lot more experience with this type of 3D development than I realized.  After years of Papervision3D development, I found I was right at home with WebGL development.  It’s very similar to many of the techniques and limitations of Flash/3D development, with the nice twist of Javascript and browser incompatibilities thrown in… as if it wasn’t difficult enough to write 3D games/apps!

So naturally I dove in head first with a helicopter simulation 😉  I’ll be able to release this by the beginning of next week hopefully


Starting New!

PinkyIconWell, it’s time to start fresh on a few fronts!

First, I’m now looking for a new position in Unity3D with another shop.  My time with Infrared5 has finally concluded after 6+ wonderful years there!  So, if you know of any shops looking for Unity3D developers or have need of a contractor, please drop me an email!

Second, Save Pinky!  has received MANY updates and is in for review by Apple right now [update: it’s just been approved and is live in the app store now!]- I’m hoping it’ll go live by mid January at the latest.  But the downloads continue to astonish me!  We’re getting well over 150 a day most days and the GameCenter leader board count is well over 12,000!  What’s even more, there are TWO players who have posted scores over 1000!!!!  what?!  Incredible!!  My high score is 635, and I can’t imagine hanging on for another 800 holes!!  But I’m so glad people have enjoyed it like I have, and with the new ramps and balls, they should have even more fun with it.

Third, I updated my blog to a new more clean look and cleaned up some of the images/icons on the right menu for my iOS game titles, and I have made a commitment to start adding more content related to C#, Unity and Flash this coming 2014!

Enjoy the screenshots from my work in the past 6+ years with Infrared5!

This slideshow requires JavaScript.

Apples n’ More Released!

Single Player mode

Single Player mode

Well it’s been 3yrs since I actually started this little project.  I started it when I bought my first iPad and have been tinkering with it ever since on and off.  I finally got some help with managing the final tasks and then UniSWF came out and really kicked everything in overdrive.  UniSWF rocks – for an old flash geek like me, I was able to create GUI and animations and implement them in Unity3D with complete ease.  I had the scoreboards redone and implemented may new animations  that would have been nearly impossible for me in Unity3D without the help of UniSWF.

So, now that it’s been released, I’m trying to get some exposure, so I’ve dropped the price to free for 5 days.  It’s a lot of fun for single player mode where you can challenge your friends on GameCenter as well as challenge your friends and family in 2 and 4 player modes.  Just make sure they trim their fingernails before you play with them 😉  It gets vicious!

If you like the game please leave a comment and rate the game if you would, we’d love to know how it’s being received and if there are any suggestions for updates and fixes,

Thanks every one!