Tutorial 24 - Basic 3D Graphics Using Shaders

As you would have seen by the feature list provided by @Simeon, Version 1.5 of Codea is a huge update. In addition to camera access, image blend modes and a tween library for simple animation, it includes full access to shaders and a shader editor. This feature gives you full access to GLSL (OpenGL Shading Language) vertex and fragment shaders. This allows you to implement some very fancy effects but it also means that there are a bunch of new concepts to understand and a new language to get to grips with. To wet your appetite and get you ready for v1.5, I have written a getting started tutorial for shaders:

http://codeatuts.blogspot.com.au/2012/11/tutorial-24-basic-3d-graphics.html

As always comments and suggestions are invited.

Looks good - except for the matrices part. Basically because you don’t really mention matrices and the whole 4D-to-2D is a bit sparse on detail. If you don’t fancy expanding on what’s going on with matrices you could link to my post on them.

An interesting read and a good intro to the subject of shaders, thank you.

.@Andrew_Stacey - I’m happy for you to run with the pure maths mantle! Being an engineer I only try and learn as much as I need to achieve the outcome. I havent needed too much in the way of matrix operations (yet), hence the lack of substantive discussion. I will stick a link in to your tutes on the subject.

.@TechDojo - thanks. I’m planning on having a play with what else you can do with shaders and writing that up in due course.

.@Reefwing Sure - I know my interest in maths is a bit unusual. Just think that the choice is either to say it all or to say nothing. I’ve seen confusion reign here before and so am wary of short snippets that could be misleading.

@Reefwing - maybe a simple “grid” of shaders running on a single screen doing things like particle emission or ripples/glows? That might show off the power of what was created.

.@aciolino - good thinking. I will have a play with that. I think the TLL guys plan on packaging up some standard shaders as part of the new release (there is already a ripple one which is very impressive).

.@Andrew_Stacey - I can’t find the link to your matrix post. Could you head me in the right direction?

http://loopspace.mathforge.org/discussion/13/matrices-in-codea

There is a discussion here as well.

Here’s the link to the discussion here:

http://www.twolivesleft.com/Codea/Talk/discussion/1804/matrices-in-codea-a-blog-ish-post/p1

Thanks Andrew - That is somewhat more detailed!

It’s painful to wait for the shaders! Argh!