Vertex Shaders.......

Started by
5 comments, last by Raptor 21 years, 7 months ago
Hi, Just built an extremely advanced shadow renderer. It uses vertex shaders and Pixel Shaders to make it as fast as possible. Gives me an awesome lot of frames per second. But the sad part is, once i set a vertex shader, i cannot revert to the previous one. I need the vertex shader only for calculating the shadows. Once its done, i want to revert to normal transformations without the vertex shader. It doesnt do that. I have to write another vertex shader separately to do the normal transformations. This is a big pain. I tried using dev->GetVertexShader(&normal); and then set the new vertex shader, compute shadows, and then use SetVertexShader( normal ); it doesnt work I loose my texturing info..... In case of Pixel shaders, i can say...... SetPixelShader( NULL ); and it reverts to the normal render pipeline. Isnt there something which i can use to enable and disable vertex shaders????? Raptor
Advertisement
As far as I know to revert to the normal pipeline that Direct3D uses you just have to call SetVertexShader(D3DFVF_XYZ) with using whatever FVF that you would normally specify with whatever vertices you are using instead of D3DFVF_XYZ .
--24 Beers in a Case.24 Hours in a Day.Coincedence? I think not!www.gramb0.co.uk
Well, tried that too long back....
damn thing renders without a texture

Raptor
I ASSUME you are using 2 vertex shaders (rather than 1 VS and the standard pipeline).

Compile your "normal" pipeline. This will return a DWORD. This is a "handle" to this vertex shader.

Compile your "shadow" pipeline. This will return a DWORD. This is a "handle" to this vertex shader.

When you want to render normally:

Device->SetVertexShader(Normal_Handle);

When you want to render shadows:

Device->SetVertexShader(Shadow_Handle);

Avoid the GetVertexShader if possible.

Neil

WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!
WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!
Thats really strange. You sure you were using the right FVF?
--24 Beers in a Case.24 Hours in a Day.Coincedence? I think not!www.gramb0.co.uk
what does the debug output tell you?
-----------------------------------------------------------"People who usualy use the word pedantic usualy are pedantic!"-me
Never mind......a lousy settexturestage error!!

damn.....i feel like kickin myself

Thanks guys!
Raptor

This topic is closed to new replies.

Advertisement