Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 


Submitted by Cuban, posted on March 02, 2001




Image Description, by Cuban



This is the result of my first foray into D3D Vertex Shaders. It's the regular D3DXTeapot, rendered with three projective textures. One is a rotating fan-like texture, one a static vent-like texture, the other is a moving texture (the DirectX 'X'). The inspiration for making this was the Doom3 video shown at MacWorld the other day. Code-side I spend some time setting up projection matrices for each of the spot lights, set a few vertex shader constants, and then just render the mesh 3 times with alpha blending. Texture coordinates are generated given the object-space coordinates, they're clamped to the texture boundaries, and the texture is also multiplied by N*L (N=Vertex Normal, L=Light Vector) to get a nice falloff on the edges.

The DX8 binary is here:
http://www.contrib.andrew.cmu.edu/~amperez/projtex.zip

The code for the vertex shader is included. Pretty standard, and probably grossly inefficient in register usage (hey, it's the first assembly code I've written in years). Makes for a purty app tho.

-Cuban


[prev]
Image of the Day Gallery
www.flipcode.com

[next]

 
Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
Kris

March 02, 2001, 03:34 AM

WOW! That demo looks soo sweet.

As my 3d java engine is still pure software I don't really know much about vertex shaders/pixel shaders/shaders in general. Can somone explain to me what they are and how they are and why they are soo special :)?

Thanks,
Kris

 
maq

March 02, 2001, 03:42 AM

I like what your doing for the community cuban, keep the good work up. And please write another book.

/maq

 
David Olsson

March 02, 2001, 04:01 AM

It was pretty sweet until I tried to shut it down...
I couldn't. I couldn't even press CTRL-ALT-DEL.
I had to do a external boot.

 
Max

March 02, 2001, 04:03 AM

"It was pretty sweet until I tried to shut it down..."

Alt+F4, it's a shortcut for close in Windows applications.

Max

 
Rodex

March 02, 2001, 04:12 AM

About vertex-shaders and pixel-shaders and software-engine..

If you code a pure software-engine, you can already do everything
that those two can do plus you don't have any of their imitations. Altough the speed with perspective-texturing might not be as fast. ;)

Anyway, vertex-shaders and pixel-shaders are just one first and
small step for hardware to get closer to freedom of software-
rendering. But hardware can't never catch up software in terms
of freedom in effects you create.

Games will enjoy the hardware, of course, but the hardware will
allways be the limiting factor of intuition.

I'm glad that I have a change to design hardware and maybe some
day in future there will be freely enough programmable hardware
that I will support it in my hobby 3D-engine project. ;)

-Rodex

 
David Olsson

March 02, 2001, 04:26 AM

What, don't you think I didn't try that ?

 
Phantom

March 02, 2001, 04:32 AM

Rodex,

Maybe hardware can't ever give you the freedom software can give you, but they can come pretty close. I mean, if I write another inner loop for another type of texture mapping (env, bump, env+bump, gouraud, triple layer, whatever) most of the stuff looks the same all the time. If we can just write the code that fetches a texel and applies some lighting ourselfes, we are as close to software rendering as we could possibly want to be without sacrificing speed. That would be cool. :)

- Phantom.

 
Jukka Liimatta

March 02, 2001, 04:33 AM

/*
I'm glad that I have a change to design hardware and maybe some
day in future there will be freely enough programmable hardware
that I will support it in my hobby 3D-engine project. ;)
*/

I thought you already had an Athlon? ;-)

 
richard

March 02, 2001, 04:49 AM

It looks very nice but unfortunality I'm getting an "Illegal blah, blah, blah in NVMODE.DLL" error. :(

I'm using win98SE on a PIII 500 / 128mb SDRAM / GF2 MX.

 
Jan Niestadt

March 02, 2001, 06:13 AM

This is going to sound really stupid, but my monitor can't handle 1024x768, is there a way to run the demo in 800x600? Yeah, yeah, I know what you're all thinking, but my regular 17" is being repaired and I'm stuck with this ancient 14" thing..

 
e4F

March 02, 2001, 08:05 AM

The instruction at "0x004012b1" referenced memory at "0x000000". The memory could not be "read".


Click on OK to terminate the program

Click on CANCEL to debug the program





W2k, Duron @ 1GHz, GeForce2MX, DX8.0a

 
Nocturnal

March 02, 2001, 08:15 AM

If this program uses vertex shaders, how can anyone run it now? Does DirectX8 use software vertex shaders if no hardware is available? Does the GeForce2 family actually support vertex shaders?

 
Francis

March 02, 2001, 08:28 AM

I had no problem at all with by GF2. Really cool btw. Went to NVidia's site on GF3 yesterday - damn these are some sweet screenshots and movies! : )

 
Gill Bates

March 02, 2001, 09:02 AM

I had no idea that my Rage128 could do that. (I know itīs not running in HAL). Your demo got some smoooth motion going on my old tired ATI board.

 
David Olsson

March 02, 2001, 09:13 AM

Yes, dx8 will emulate vertex shaders (not pixel shadars) if they aren't available. The emulation is quite optimized.

 
Machin Shin

March 02, 2001, 11:56 AM

question:
what all is required to run this demo?
is it hw-specific? or can i just run it if i have the dx8 sdk?
(which i don't think i have as i use opengl :) )

and my understanding was that only the nv20 (now the geforce3 (better name req'd .. massive internal design should get a spiffy new name.. "geforce 3" just doesn't get through the *POWER* of that gpu :) ) ) could implement vertex/pixel shaders?
or is it all just emu'd in software (and how well could it possibly run?)

(i think i should be a lisp coder (considering the number of (parenthesis) i (use) ) ) ;)
--vat
"live highlander, grow stronger, fight another day"--methos

 
Michael Kurth

March 02, 2001, 12:00 PM

Apparently not, or at least not very well.

Alt-F4 works like a champ here.

 
Michael Kurth

March 02, 2001, 12:05 PM

I'd like to see a FPS counter on there, I'm curious how fast this process using SW emulation.

Other than that, it's pretty =)

 
Cuban

March 02, 2001, 12:16 PM

>question:
>what all is required to run this demo?
>is it hw-specific? or can i just run it if i have the dx8 sdk?
>(which i don't think i have as i use opengl :) )

The only fancy thing it's using is a couple of vertex shaders which will work on any machine that has Dx8 (albeit in software which is why the app is slow on a GeForce2)

It's also /completely/ bound by fill rate at 12x10; this pro'lly is making it slow on other cards... that was just me being dumb; I have a multimon setup and if I run fullscreen at a different resolution than my default screen you get that annoying popping around of windows when you come back.

I'll replace the binary with a new version momentarily that fixes this, sorry about that.

 
Cuban

March 02, 2001, 12:41 PM

Okay, I updated the zip file; this one runs at 800x600 so the people having problems with it will hopefully be able to run it. Also, it has the ability to toggle my sorry attempt at stencil shadows. If you didn't think it was fill-bound before, /damn/ :)

-Cuban

 
Manuel Astudillo

March 02, 2001, 12:52 PM

Check this address for some explanation of vertex shaders, etc:
www.tomshardware.com

 
Raspberry

March 02, 2001, 12:56 PM

Nice frame rate on my machine, but hey, why no exit key?! I must be really dumb.... ;]

 
Buster

March 02, 2001, 02:05 PM

I'm getting the same "Illegal read.. blah blah" error.

Win 2K, DirectX 8.

This machine at work always does funky things... I'll try it out when I get home and see what happens.

 
EgonOlsen

March 02, 2001, 02:08 PM

ESC works for me as an exit key (running on a Voodoo5-5500 under WIN2K)...

 
bit64

March 02, 2001, 02:15 PM

Nice demo cuban, runs great on an NV20 and the Geforce2 I dont however get an exit key in either WinXP or WinME.

 
Brainiac

March 02, 2001, 02:21 PM

Yes, and it crashes on the AMD Sledgehammer and the Itanium...

 
Cuban

March 02, 2001, 02:26 PM

Sorry about that. The code is written around a quick n' dirty DX8 file I use to test things out. The window is a WS_POPUP so there's no exit button; I just trap the escape key and post a WM_CLOSE message when I receive it.

 
A'r-Ci-O'oh

March 02, 2001, 03:46 PM

Couldn't run it. I get exactly the same msg as e4f:

The instruction at "0x004012b1" referenced memory at "0x000000". The memory could not be "read".

(Including the same memory location... Weird, isn't it?)

ATI Rage Mobility 2X, W2k, P3 500 MHZ, 512 MB RAM

I thought the software emu would work, though :'(

 
shrike

March 02, 2001, 04:12 PM

it worked great for me. TNT, PII 266, 128 meg ram

 
Warren Marshall

March 02, 2001, 05:27 PM

"It works for me."
"It crashed for me."
"It works for me."
"It crashed for me."
"It works for me."
"It crashed for me."

Ain't developing on the PC grand? :P

 
This thread contains 48 messages.
First Previous ( To view more messages, select a page: 0 1 ... out of 1) Next Last
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.