Today I extended the engine with support for vertex and pixel shaders.
Right now I have support for shaders written in HLSL but to the engine shaders is an abstract concept so there is nothing stopping me from adding support for other shading languages like Cg and GLSL transparently in the future.
Shaders are integrated into the effect/material system and I have a clean and simple interface for setting shader parameters from the engine. I intend to add support for automatic passing of common parameters like transform matrices to the shaders. Using shaders will be almost as easy as using the fixed function pipeline.
The terrain in the screenshot is rendered with per-pixel diffuse lighting and fog, using a pixel shader. In this kind of scene there is not much visual difference between per-vertex and per-pixel lighting, but when the sun is moving it's more apparent. Also the per-pixel fog is a lot smoother.
I use a slightly reddish sun color to give the impression of late afternoon lighting.
Now, with shader support in place, I can start doing some cool stuff :)
Saturday, March 25, 2006
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment