04
Apr
08

Linear Harmonics

I was messing around with the Spherical Harmonics shader code, trying to work out how to get it to work with a Sphere primitive instead of a flat grid, when I thought I’d see what happened if I removed the part of the code that bends the flat mesh round into a sphere, and applied the radius variable to the z-coordinate of the mesh. The result is quite cool. I’ve applied the same shading I used in the original shader, and again textured the surface with simple shapes or lines.

Linear Harmonics 08Linear Harmonics 02
Linear Harmonics 03Linear Harmonics 04
Linear Harmonics 05Linear Harmonics 06
Linear Harmonics 07Linear Harmonics 01

Advertisements

8 Responses to “Linear Harmonics”


  1. April 4, 2008 at 11:56 am

    now that, i _really like.

  2. 4 toneburst
    April 4, 2008 at 1:17 pm

    Thanks for the encouraging feedback guys.

    Think I might have to add a ‘linear’ option to tb_sphericalHarmonics 1.01!

    a|x

  3. 5 optibreak
    April 4, 2008 at 8:34 pm

    Agreed, thats a wicked effect.

  4. 6 639me
    April 5, 2008 at 4:07 pm

    absolutely amazing! i’d like to know what part of the code you’ve altered, and how. i realize i’ll never learn glsl, but its absolutely comprehendable to some point to alter the code. it would also be great to learn some basics about it, like why is the code split in two parts? thanks!

  5. 7 toneburst
    April 5, 2008 at 4:29 pm

    Hi 639me,

    Cheers!
    There’s a part of the code that takes the result of the Spherical Harmonics formula itself, and bends the vertices around to create a sphere shape, distorted the radius of the sphere as it does so. I basically just removed this part of the code, and used r to set the z-coordinates of each vertex, creating a distorted plane rather than a distorted sphere. I’ll post the code here soon, and you can have a look at it yourself.

    GLSL code always comes in two parts.
    One part, the Vertex Shader, acts on the points making up a 3D mesh. This is where you write code to distort 3D models or primitives.
    The second part is the Fragment Shader. This is where you write code to change the colour, shading and surface texture of the 3D mesh.

    If you’re interested in making a start on GLSL yourself, you could do worse than take a look at the GLSL tutorials at lighthouse3d
    http://www.lighthouse3d.com/opengl/glsl/
    You could also pick up a copy of the GLSL Orange Book, which is pretty comprehensive. I bought it quite a while ago, but haven’t managed to force myself to read the whole thing yet. It’s got some good stuff in it, but assumes you’re using GLSL within the context of an OpenGL-based application you’re writing, so some of the tutorials won’t work without some tweaking in QC. A good reference though.

    Hope this helps,

    a|x

  6. April 6, 2008 at 7:01 am

    thanks a lot for the link

    ansonx


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Twitter

April 2008
M T W T F S S
« Mar   May »
 123456
78910111213
14151617181920
21222324252627
282930  

Links

Blog Stats

  • 471,196 hits

%d bloggers like this: