• Register
Post news RSS [w]tech - A new shader-system

In the last months, I worked on the Shader system. See here, what is possible now!

Posted by on

You've may seen, that the meshes, in the previous screen shots, just had some simple skins (Face-Normals), because the Shader-System wasn't really built in. It was very basic, and didn't support textures, for example. Now I've created a useful Shader Editor, some UI to put Textures into the Shader, and I made a new Package-System, which is able to save the Shaders in a binary format (For faster loading). [w]tech is now at version 0.04, and supports these things:

Features (0.04):

- Chunk-Based-Package-System
- Map-Files
- Loading/Saving
- Content-Marks (See the first Documentation-feature)
- Transformation Widget
- Content-Tree
- X-File and OBJ-File mesh loaders
- All famous texture formats (tga,dds,png,jpg,bmp,tiff,gif)
- Shader Editor (With Syntax highlighting and such stuff)
- UI-Dialogs for Meshes, Textures, and Shaders
- An internal Mesh format
- Pixel-Shaders
- Vertex-Shaders
- Geometry-Shaders
- And much I forgot

In this news, I want to show you, what cool things can be made with Pixel-Shaders!

But first: What are "Shaders"?

A Shader is something like a small program, which gets executed for every Vertex/Pixel/Polygon.
So you can modify some values, like the position of a vertex, or the color of a pixel by using math.
In DirectX10, there are three types of shaders:

- Vertex-Shaders: Changes the position of any vertex, the mesh has. No matter if static or not.
- Pixel-Shaders: Sets the Color of the pixel, which is covered by the drawn mesh.
- Geometry-Shaders: This can create new polygons in realtime!

So, see this very evil little guy (A goblin from BeyondJupiter):

Evil Guy

He has a texture, but it looks very crappy and old, and since he doesn't has much polygons, he looks just like something in a game from 1999 or so. With Pixel-Shaders we can dress him up a lot! Lets take a look at the "Fresnel", which highlightes the borders of a mesh, based on it's face normals, but since we want something cool, this is not enough. In the Pixel-Shader, we can do a Texture-Lookup to a "Normal-Map". With this texture, it is possible to fake a surface-structure on low-poly meshes, to make them more realistic.

So, when we use a fresnel (For a lighing fake here), it looks like this (Untextured):

Evil Guy

And note, he doesn't really have much polygons!

If we combine the texture, and the Light(-Fake), we get this nice image:
Evil Guy
And as a final step, we add some specular lighting to the model:
Specular shader

Looks much better, I think. Normal mapping is one of the very cool things, you can do with Pixel-Shaders. As they are fully built in now, I will show you the use of all types of Shaders in the
next days!

RustySpannerz - - 641 comments

Cool story bro!

Reply Good karma Bad karma+2 votes
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.