• Advertisement
Sign in to follow this  

How to make a shader based only engine?

This topic is 4346 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm looking for source code, books or tutorials that show how to make a shader based engine with no fixed functionality used. Is there such a thing? I cannot find anything on google yet.

Share this post


Link to post
Share on other sites
Advertisement
Well, it's certainly possible to write an engine which replaces the fixed function TNL, fog, etc with shaders although I'm not sure I know of any which advertise it as a major feature. You might want to look up the "ShaderX" series of books if you are interested, there is also a good book entitled "Programming Vertex and Pixel Shaders" by Wolfgang Engel which is a good book on shaders in general but also has a chapter dedicated to integrating shaders into a game engine. "GPU Gems" also contains a few chapters on the subject in its "Part V - Performance and Practicalities" section.

Share this post


Link to post
Share on other sites
If you want an engine that only uses shaders, then you just make an engine that only uses shaders [razz] There's nothing special you have to do just don't write any codepaths that used fixed function stuff for rendering (i.e. for everything you render having a pixel and vertex shader bound).

Share this post


Link to post
Share on other sites
This is from the DirecX10 Tutorials:

    // 2nd Cube:  Rotate around origin
D3DXMATRIX mTranslate;
D3DXMATRIX mOrbit;
D3DXMATRIX mSpin;
D3DXMATRIX mScale;
D3DXMatrixRotationZ( &mSpin, -t );
D3DXMatrixRotationY( &mOrbit, -t*2.0f );
D3DXMatrixTranslation( &mTranslate, -4.0f, 0.0f, 0.0f );
D3DXMatrixScaling( &mScale, 0.3f, 0.3f, 0.3f );

D3DXMatrixMultiply( &g_World2, &mScale, &mSpin );
D3DXMatrixMultiply( &g_World2, &g_World2, &mTranslate );
D3DXMatrixMultiply( &g_World2, &g_World2, &mOrbit );


I've been wondering if the matrix operations have to be done with shaders too...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Have you ever write any shader or at least used them once yourself?

Those matrix operations are done by the cpu and this is much more efficient because we do not need to calculate the world matrix (for example) for each vertex.

Share this post


Link to post
Share on other sites
Not really, that's why I'm asking. I've read about them (articles and a book) and I've played with samples.


AP, thank you for the answer!

Share this post


Link to post
Share on other sites
if you think of the fixed function pipeline as a shader you can't modify. You want to setup an architecture where by you are feeding your shaders with the various transformations, verts, textures, etc. that they need. look into HLSL and the D3D Effects framework, you really should be looking to learn 1-2 shading languages and associated run-times before you try and "make an engine based on shaders".

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement