Sign in to follow this  
howie_007

disillusioned by vertex shaders

Recommended Posts

I'm rather unhappy by this assuming I'm correct. Just by the act of using a vertex shader, I now have to do the transformations and lighting, in addition to what ever the effect is that I'm trying to do. bah. The transformations is not that big a deal but to have to also replace the current lighting with my own now.... sigh. [Edited by - howie_007 on March 5, 2010 10:14:15 AM]

Share this post


Link to post
Share on other sites
Correct. There used to be shaders somewhere (NVidia or ATI's site) which were just the fixed function pipeline in shader form - they might be a good starting point.

On the plus side, you're not limited to 8 dynamic lights any more...

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
On the plus side, you're not limited to 8 dynamic lights any more...

That is a plus but I didn't factor this into my engine design. This is one of those "all or nothing" decisions and now you have the added overhead of passing in the light data. uuugghh.

Share this post


Link to post
Share on other sites
Quote:
Original post by swiftcoder
And potentially a bigger plus, you can implement per-pixel lighting fairly trivially.

That is true but I have a feeling that would cost some serious FPS.

Share this post


Link to post
Share on other sites
Quote:
Original post by howie_007
Quote:
Original post by Evil Steve
On the plus side, you're not limited to 8 dynamic lights any more...

That is a plus but I didn't factor this into my engine design. This is one of those "all or nothing" decisions and now you have the added overhead of passing in the light data. uuugghh.
The overhead is no more than it was with the fixed function pipeline; you just need to pass the light data in as a global.

Share this post


Link to post
Share on other sites
I for one, never regret rewriting everything to use shaders and completely abandon the fixed function pipeline. :) The FFP code was unflexable and in the most part black magic, as I did't understand how some stuff worked and why. Shaders actually open you eyes and untie your hands :)

Share this post


Link to post
Share on other sites
Quote:
Original post by howie_007
Quote:
Original post by swiftcoder
And potentially a bigger plus, you can implement per-pixel lighting fairly trivially.
That is true but I have a feeling that would cost some serious FPS.
On even moderately modern hardware, you won't notice the hit.

Simple per-pixel lighting involves one square root and two dot products in the pixel shader - certainly lower cost than any other pixel-shader effect you will be implementing.

Share this post


Link to post
Share on other sites
Quote:
Original post by MJP
It was ATI. [smile]

Thanks for providing a link to that. Thanks to all helping me "get my mind right" about adopting the vertex shader for standard lighting. One other benefit I now see for this is if you do your transformations first, you don't have to translate your light position based to your model in model space. One of my big gripes with DirectX.

Share this post


Link to post
Share on other sites
Quote:
Original post by solenoidz
I for one, never regret rewriting everything to use shaders and completely abandon the fixed function pipeline. :) The FFP code was unflexable and in the most part black magic, as I did't understand how some stuff worked and why. Shaders actually open you eyes and untie your hands :)
Seconded! :)

Sorry howie_007, but if you didn't take shaders as a starting point, you're probably better to rethink everything!

Share this post


Link to post
Share on other sites
Just a quick general note. Transform all your lights and lighting calculations into world space.

It used to be an optimisation to do lighting in model space by translating the light into the models space to avoid the bigger overhead of transforming each position and normal into the lights'. However, if you do both and put everything into worldspace, the equations feel more natural, instancing becomes a breeze later on and it all generally feels easier to handle.

Share this post


Link to post
Share on other sites
I'm thinking of supporting an OpenGL renderer of my modest stuff, and i wonder if shaders will make my life easier for porting render code from DX9 to OpenGL 3.0 ?
Looking at my code now I see very little DX9 specific code, since it uses shaders even for render states.
Is it just me, or really is that simple and a lot easier to port a DX+HLSL application to render with OpenGL+CG, than a DX9+FFP to OpenGL+FFP ?

Share this post


Link to post
Share on other sites
Quote:
Original post by MJP
Quote:
Original post by Evil Steve
Correct. There used to be shaders somewhere (NVidia or ATI's site) which were just the fixed function pipeline in shader form - they might be a good starting point.


It was ATI. [smile]


I never new they'd done that, that is awesome :)

Thanks for the link!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this