03
Mar
08

More Superformula GLSL

More screenshots of the Superformula composition. I’ve added supersampling, and tweaked the shading code for a semi-transparent look.
Superformula GLSL 02Superformula GLSL 03
Superformula GLSL 04SuperShape 2D 05
Superformula GLSL 06Superformula GLSL 07

I really like this simple shading technique- it looks really smooth, especially with the semi-seethrough areas. Having said that, I’d really like to be able to get some proper lighting going, just to have the option.

Advertisements

13 Responses to “More Superformula GLSL”


  1. March 3, 2008 at 2:19 pm

    Looks wicked mate. Got any video of it in action?

  2. 2 toneburst
    March 3, 2008 at 2:24 pm

    Cheers!

    The controls aren’t set up properly yet, so no video at the moment. I’ve got to start making some little clips soon, though…

    Watch this space πŸ˜€

    alx

  3. 4 eraser85
    March 3, 2008 at 4:42 pm

    Instead of transparency, what you might want is translucency… with translucency you take into account the “thickness” of a given mesh and calculate the scattering inside the material.. it works very well if you want to simulate light going through meshes..

    Actually I’m writing a tutorial on a tecnique used to compute real time translucency. Too bad the tecnique I’m illustrating performs best on convex meshes, while it seem yours are for the most concave ones..

  4. 5 toneburst
    March 3, 2008 at 5:05 pm

    Hi Eraser85,

    I’d be very interested to see a translucency shader- sounds great! Do you have any screenshots of it in action?

    Before I can apply proper lighting to this particular object though, I need to work out how to convert the normal-calculation and view/world matrix transformations from the original HLSL code. Once that’s done, I can try out different lighting models.

    Cheers,

    alx

  5. 6 hob
    March 3, 2008 at 6:11 pm

    Hello toneburst.

    Really like the site. If you have a couple of minutes to spare, could you drop me an email? I’d like to ask you a couple of questions! My undergrad dissertation is on Quartz Composer, but nothing nearly as technical as your stuff… It all seems very familiar though, I’m also using VDMX and have looked at vvvv but don’t have time to learn vvvv as well…!

    Anyway, email address is in with this post – cheers πŸ™‚

  6. 7 eraser85
    March 4, 2008 at 7:00 am

    I do have lots of screens, but actually I’m outside my city.. I’ll be back this afternoon, then I’ll post some screenshots

    For the translation from hlsl code, I don’t know what you are actually doing in the vertex shader, but seems displacement based on a formula.. so if I understand correctly, you need to calculating per fragment normals between vertices, right?

    If that’s the case, it’s possible to calculate everything on the gpu with geometry shaders.. πŸ™‚ after the vertices gets the displacement, the geometry shader reads each face, displaced: at this point, by doing a cross product between adiacent vertices, you get per vertex normals.. πŸ˜›

  7. 8 toneburst
    March 4, 2008 at 9:28 am

    Cool eraser85, looking forward to seeing those screenshots.

    In terms of the normals and lighting stuff, that’s all been done in the original HLSL shader. The problem is, it uses some builtin transformation matrices (View, ViewProjection) and an HLSL function (lit) that have no direct equivalents in GLSL. I’m relatively new to all this stuff. I know enough about the differences between the HLSL and GLSL languages to be able to translate most of the code, but not enough to be competent when it’s re-writing rather than translation that’s required. My understanding at the moment though, is that as long as I can work out how to translate the normal-generation bits of the code, I can simply ‘slot in’ my own lighting calculations in the Fragment Shader.

    I’ve been doing some background reading, but keep getting distracted by the nice things I can do just with lookup-table-based shading πŸ™‚ I’m actually thinking it would be nice to combine the current simple shading with maybe a basic phong directional lighting model, to get a kind of glowing effect, as if the mesh was lit from inside. The Translucency effect also sounds very cool though, particularly when I get all the controls hooked up for nice smooth, organic movement.

    Cheers for the advice and encouragement!

    alx

  8. 9 eraser85
    March 4, 2008 at 11:17 am

    Mmmm maybe you can be interested in this:
    http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=233428

    talks about the lit function.. my GLSL implementation of lit function could be:

    vec4 lit (float ndotl, float ndoth, float m)
    {
    vec4 result = vec4(0.0, 0.0, 0.0, 1.0);
    result.r = 1.0;
    result.g = max(0.0, ndotl);
    if (ndotl > 0.0)
    result.b = max(0.0, ndoth) * m;

    return result;
    }

  9. 10 toneburst
    March 4, 2008 at 12:21 pm

    Hi again!

    that link was to a query I made myself, in fact πŸ™‚
    I’m still confused about the different view matrices, to be honest, though I’ve now got my head around what transformation matrices actually DO, and the various coordinate transformation steps in the OpenGL pipeline. I’m sure all the same things can be done in HLSL and GLSL.

    Ah… OK, so that’s what Lit does.. Thanks a lot for that. I’ll try that a bit later, if I get a chance.

    Thanks again,

    alx

  10. 11 eraser85
    March 6, 2008 at 7:59 am

    the screen I promised to you:

    With translucency:

    Without translucency:

    Note how the model is backlit by a light source, therefore almost of its screen-facing side is black without translucency. Adding it reveals those areas, since light enters the mesh and scatters.

  11. 12 toneburst
    March 6, 2008 at 6:21 pm

    That’s very impressive eraser85.
    Wish I could get normal-calculation working, so I can actually start applying lighting models to the scene…

    I’ll look through the code again and see if I can get it to work. I actually really like the fake lighting effect- looks like there’s a light inside the mesh. On the other hand, I really want to be able to light it too, if only to make the form more obvious.

    alx

  12. 13 toneburst
    March 26, 2008 at 4:50 pm

    Hi eraser85,

    just been looking at your tutorial at
    http://eraser85.wordpress.com/
    It’s fascinating stuff. Sadly, I can’t currently use multipass GLSL shaders in the system I use, so I’m not going to be able to implement translucency in my shaders in the near future. I love the effect though. I think it would work especially well with the Superformula and Spherical Harmonics shaders (though I can’t see it working at an acceptable framerate on my computer, sadly, given it’s already pretty slow, without any kind of lighting calculation).

    Great stuff, and a very interesting tutorial.

    Cheers,

    alx


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

March 2008
M T W T F S S
« Feb   Apr »
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Links

Blog Stats

  • 470,209 hits

%d bloggers like this: