Roll your own lighting shader with this code

@tnlogy - thanks, I’ll have a look

My height field code is a bit rubbish, mainly in terms of the recalculating normals which I only half did as I only had time to prove the concept to myself. But hopefully it gives a good feel for what can be done.

Textures in vertex shaders are commonly used for height fields, and also for things like waves on water effects and such. It should also be usable for user deformable objects, so you could let a user dent your mesh by taping it by just updating a texture for their touch.

I guess you could save the normal as RGB for each pixel so save some GPU? Is there a list of new features for GLSL in iOS 7?

@tnlogy - I modified your shader to take a texture. There are two issues I’d like to fix. One is that the furthest vertices flicker, and the other is that additional “tiles” are added periodically as you move forward, and it is very obvious when it happens. I’d like it to be more subtle.

I finally got a chance to try it. The printing the shader option doesn’t seem to be working (I’m running the beta). Other than that, it seems very useful.
Thanks!

Cool, looking forward to seeing your code. :slight_smile:

Yes, I’ve seen those issues as well, haven’t had time to fix them though, was thinking about adding a fog to solve it. I don’t know if my light shader code is so elegant either. :slight_smile:

Did you see any speed improvements?

@tnlogy - my understanding is that IOS 7 introduces OpenGL ES 3.0 which has some new features, and also includes a bunch of capabilities which (like compressed textures) which were optional in the previous version.

HOWEVER, OpenGL ES 3.0 is only usable on the latest “Air” versions of Ipads (and I’m not sure how Codea works with this), however IOS 7 also made available some capabilities to OpenGL ES 2.0 that were previously disabled, the only one I’ve used/looked into being textures in the vertex shaders.