Specular effects

Cheers Eric.

I’m currently experimenting using a vertex program on the 2nd pass, to do the specular. Means I can very easily specify the light direction, to have correctly facing speculars.

Yeah, I suppose the other blending mode, would make a good spotlight kind of effect!

I have this vertex program specular thing working fine now, but my faces keep interfering for some reason.

  • Nutty

It seems I’ve found a bug in using both normal T&L pipeline, and vertex programs in dual pass rendering. Though thats not surprising, cosidering they’re leaked drivers, but I thought I’d comment about it anyway.

Doing a normal 2 stage pass (both passes on normal T&L) works fine. i.e. no interference of poly’s provided you use 2 different depth functions. i.e. GL_LEQUAL, and GL_EQUAL.

However, enabling a vertex program for the 2nd pass, results in much polygon interference, unless vertex programs are used for both passes.

Very odd indeed.

I’ll try and get a multi-texturing vertex program version up and running soon.

  • Nutty

just do normal multitexturing use texenv mode GL_ADD on the spec texture. no blending required

Actually I just realised, it’s not a bug as such, just the result of mixing hardware and software rendering passes. The maths is not identical, thus giving this problem.

Which means it wont occur when it’s done in hardware proper.

I feel a bit dumb now…

I’ve just uploaded a specular demo to my website.
www.nutty.org

Uses multi-texturing with sphere mapping to create the effect. No vertex program stuff, so it should run on all dual texture unit graphics cards.

As always full commented source is included.

Might do a few other specular methods…

enjoy.

  • Nutty

Nice work Nutty. Works fine on Rage 128.

BTW, is that a babylon5 ship? I miss that show.

Thanks.

I dont know, ask Nvidia. Thats the model they stuck in with their DX effects browser thingy.

  • Nutty.

Yes, Elixer. It’s a White Star.

I’ve done another specular demo… and it looks awesome!

Uses vertex programs too.

Heres the gist.

I have a point light source moving around the space ship. I dot the normal, and light vector to apply lighting to the material color, I then multiply on a cube map, calculated in the vertex program also, then with the 2nd texture unit, I add on a specular highlight.

The vertex program is huge!! 38 instructions, might be able to squeeze it down a bit, haven’t tried yet.

Will upload it to my website tonight! (edit: Upload complete!!)
It’ll be in the vertex program section.

Requires dual texture units, 7.17 drivers, and cube mapping. Can’t wait for this to get released officially.

Enjoy!!

  • Nutty

[This message has been edited by Nutty (edited 02-20-2001).]

How exactly does one go about writing these vertex programs? What sort of thing is this? I’d sure like to know how to get started on stuff like this. BTW, great work, Nutty!

Download the basic vert prog from my site. Click the link to nvidia’s vertex program documents, download them, and read them.

Then you should understand what the vertex program does, and be able to write your own.

I honestly can’t wait for this feature to appear properly in hardware, the things you can do by writing your own pipeline are incredible!!

  • Nutty

Great! I can’t wait to check it out.