Just vertex shaders

i’m a bit confused

if we write a vertex shader do we have to write a fragment shader?

i want to move a 3ds model by a sin wave on the y axis so i guess i have to calculate new normals using a jacobian matrix (GPU gems deformers) but the 3ds model requires two sided lighting to be lit properly - if i just use a vertex shader can the fixed functionality fill in the lighting gaps for me and save me some time.

Randi Rost told me himself that there’s a few issues with implementing the fixed pipeline in ogsl

Theroetically there’s no problem using a vertex shader without using a fragment shader. But be careful, the vertex shader has to fill all built-in variables like texture coordinates and so on. You are not able to use your own varyings.

if we write a vertex shader do we have to write a fragment shader?
No, it’s allowed to either only have a vertex shader or only have a fragment shader attached and linked to a program object.

Randi Rost told me himself that there’s a few issues with implementing the fixed pipeline in ogsl
There should be no problems at all. The only problem would be the size of a shader if you want to implement multiple lights, cause then you’d have to unroll them by hand due to the fact that current HW (except new NV-Cards) don’t support loops in shaders. And that would mean that your shaders would get very big and wouldn’t run on HW that can’t handle bigger shaders. Only way around this would be to do multiple passes.

due to the fact that current HW (except new NV-Cards) don’t support loops in shaders.
Current hardware doesn’t support fragment shader looping. Vertex shader looping works just fine. And fixed-function lighting is per-vertex lighting, so the loop would be in there.

Originally posted by Korval:
[quote]due to the fact that current HW (except new NV-Cards) don’t support loops in shaders.
Current hardware doesn’t support fragment shader looping. Vertex shader looping works just fine. And fixed-function lighting is per-vertex lighting, so the loop would be in there.
[/QUOTE]I’ll have to kindly correct you. The Wildcat VP series supports fragment shader looping (and branching). Just try out the mandelbrot shader in our SDK :slight_smile:

Barthold

I’ll have to kindly correct you. The Wildcat VP series supports fragment shader looping (and branching). Just try out the mandelbrot shader in our SDK :slight_smile:
That’s impossible. 3D labs must have very smart driver to compile that.

for(iter=0; iter<maxIterations && r2<4.0; iter++)
{

}

maxIterations is a uniform int and 4.0 is a const and since the test condition is a AND, it can unroll 4 times.

You’re confused. The r2 is a value calculated inside the loop which tells if the iteration of the imaginary numbers is divergent.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.