(Pixel) Shaders

Started by
4 comments, last by Demus79 18 years ago
I have just read some introducing articles about Shaders, in specific Pixel Shaders... I was interested in using this feauture in combination with DirectX to be able to use Multitexturing with Alpha Blending... Now as far as I knwo it is possible to achieve this using Pixel Shaders... Now my question is: Is it normal to create your own shader or should/could I just use premade shaders? Now I have almost no experience with shaders, and as almost all people in the world a bit short in time :D Do you have any advice? p.s. The reason for Multitexture Alpha Blending is that im making an terrain generator that should use multitextexturing and being able to blend multiple (10-15) diferent types of texturing... p.s. I'm now using Multipass Single=Texturing but that is rather slow. And using Multi-Texturing in a single pass would be hardware dependent on the amount of Texture passes that the videocard supports. For more information, please ask any questions... Thanks in advance,
Advertisement
Quote:Original post by Quinnie
Is it normal to create your own shader or should/could I just use premade shaders?

That's like asking if it's normal to write your own C++ code or use pre-made code. I'd say it depends on whether you find suitable code. :)

Quote:p.s. I'm now using Multipass Single=Texturing but that is rather slow. And using Multi-Texturing in a single pass would be hardware dependent on the amount of Texture passes that the videocard supports.

Shader support would also be hardware dependent. Shader model 2 and up supports up to 16 textures. Older shader models support a lot less.
The best advice I can give you is to understand the theory behind what the vertex and pixel processing stages of the pipeline do. This is well documented in the DirectX SDK Documentation. This will give you a better understanding on how to implement shaders. In addition to that, you could probably take a look at the HLSL tutorials on www.mdxinfo.com even if you are using unmanaged code. It should push you into the right direction I believe.

I hope this helps.
Take care.
First of all, Thanks for your reply''s

Most of the time I do write C++ myself so than I will try creating my own shader... Thanks for that link it seems very helpfull although I am using unmanged code...

Is using shaders for multitexturing and aplha blending them the best solution or should I stick with normal Multi Texturing? Wich method is faster?

Thanks in advance,
As everything else, it depends :)
In this case, it depends on the target hardware. You should try to use shaders on hardware that supports it, singlepass multitexturing on hardware that supports that but now shaders, and as a last fallback, multipass blending.
Or well, hardware that doesn't support singlepass multitexturing basically doesn't exist today, so supporting it is far from necessary, and unless you're making a commercial application that has to support almost every obscure device out there, you should just stick to shaders, but make shaders for older shadermodels.

It isn't always the fastest solution according to some documentation to do all the multitexturing passes in 1 pass, even if it is possible.

Using pixel shaders with terrain splatting has the advantage that you can pack 4 alpha maps in a single texture and I think that it faster than using 4 separate alpha maps.

This topic is closed to new replies.

Advertisement