DShade
January 19, 2008
The image in my ‘HAI WORLD!’ post, just as the following one …
![]()
… was rendered with DShade, a 3d software rasterizer of mine.
DShade is mostly an experiment at abusing the D compiler, created a year ago as a final project for my “Graphics and Multimedia” course.
Thanks to some of D’s features, it can do simple software vertex and pixel shaders with on-the-fly recompilation and reloading. It also supports bilinear-filtered texturing, perspective-correct attribute interpolation, Sutherland-Hodgeman clipping, backface culling, z-buffering and alpha blending.
The demo app features a very simple loader for q3 bsp levels, it can also display ‘HME’ models, a custom text-based format exported from 3dsmax.
As far as the software shaders are concerned, these are actually parts of D modules, that get mixed into a wider scope, where they can be inlined in tight rasterization loops. Additionally, some metaprogramming tricks detect the inputs and outputs of the shaders in order to automatically extract and interpolate all required vertex parameters needed for the shader.
Each shader gets mixed into a Renderer instance and compiled into a dynamic library, which can be recompiled and reloaded when needed.
The user interface to DShade is fairly simple. ‘WSAD’ keys control camera movement; Holding the right mouse button and moving the mouse pointer allows camera rotation; The left button is used to bring up a context menu for objects. From this menu, shaders and textures can be changed, hierarchies between objects may be defined and simple movement can be specified. Hit space to bring up a menu for object creation.
While the program is running, try editing one of the files in the shaders/ directory. Saving it should trigger an automatic recompilation and reloading of it within DShade. The console window will contain error logs if something goes wrong.
Please note that DShade doesn’t make use of SSE or 3dNow or MMX, it may contain bugs and can bring very fast CPUs to their knees. If shaders don’t want to recompile, make sure you have DShade located in a path not containing spaces. Build/DMD/OPTLINK can get a bit lost with them.
Also note that DShade was conceived when DDL’s OMF backend wasn’t very stable. If I were to rewrite it, I’d definitely use DDL on Windows.
Hint: deleting the level from within the context menu will speed things up a lot.
You can download DShade along with its source code and play around (run Main.exe). Out of my pure laziness, the shader compilation and loading system only supports Windows.
P.S. Thanks to Walter Bright for allowing me to distribute a stripped-down version of DMD and OPTLINK with DShade :)
Filed under: Uncategorized | Comments (5)
Nowai! :P
Hai that’s neat!
Hai! tnx :)
Napisałbym tu:
http://workshop.team0xf.com/index.php?n=Forum.Forum,
ale nie działa (line 871 && 872).
Tak więc pozwolę sobie naśmiecić tutaj:
Kip ap de gud łerk! KTHX4 4ll 0f 7h15 5tuff!11!! teh filmiki && 0th3r iz gr347!1! Mah iz n00b 4nD U V3ry h31p3d!11! Go foward, dudes!!11!
O, i jeszcze tak dla informacji:
http://workshop.team0xf.com/3/3.pdf == 404
Jakbyście mogli wrzucić to byłbym wdzięczny. Miałbym wtedy komplet && isMahHappy == true.
KTHXBYE
—–
Greetings,
freakpp
/*
To my mamy forum warsztatow? lol… dobrze wiedziec :D
Wrzucilem pdf’a, byl tylko pps :>
*/
BTW CAN HAS ENGLISH NEXT TIME KTNXBAI :P