Volumetric Shadow Demo

From GameBrew
Revision as of 02:19, 5 July 2012 by HydeWing (talk | contribs) (Created page with "{{Infobox homebrew | title = Volumetric Shadow Demo | image = | type = Other | version = 1.60 | licence = Mixed | author = Rob (silent_code, R.H....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Volumetric Shadow Demo
General
Author(s)Rob (silent_code, R.H.L.)
TypeOther
Version1.60
LicenceMixed
Links
[Media:Vsd160ds.rar Download]
Website
[Media:Vsd160src.rar Source]
Advertisements

<htmlet>adsense</htmlet>


Volumetric Shadow Demo is a NDS tech demo program formerly know as the “Stencil Shadow Demo”, and later “Volume Shadow Demo'. This small open source program demonstrates, among other things, some of the NDS' graphics hardware capabilities.

The program's current release was build with devkitARM R23b, libnds 20071023 and libfat 20070127, using devkitARM's default AMR7 binary.

Features

  • Hardware accelerated volumetric shadowing
  • Motion blur with video capture, using only one VRAM bank, at 60 FPS
  • Hardware lighting, texturing, fogging, antialiasing etc.
  • Display brightness control
  • Viewport scissoring (thanks to gabebear off the gbadev.org forum)
  • Loading binary and text files from disk (through libfat)
  • Converting .tga 24/32bit image data to 16bit nds textures
  • Displaying a custom font and a text area over a background image, all loaded from disk
  • Smooth touch input
  • Simple frame rate counting and some other rendering status info

User guide

Prepare the hardware by setting the flush mode to manual and w-depth sorting with:

glFlush(GL_TRANS_MANUALSORT | GL_WBUFFERING);

Do so in the frame BEFORE the frame you will draw the shadows. Usually, set this up when initializing the application and flush each frame with those settings.

You might need to sort your translutient polygons / meshes.

These are the three basic steps you need to follow to render volumetric shadows:

1)Render *all* the shadow casting and receiving geometry as usually. 2)For every shadow geometry, draw the "Stencil Mask": Shadow polygons *MUST* be translutient, so enable blending and render the shadow geometry's front using the following settings:

glPolyFmt(POLY_ALPHA(1) | POLY_CULL_FRONT | POLY_ID(0) | POLY_SHADOW);

(alpha *must* be between 1 to 30 and ID also MUST be 0)

3)The "Stencil Shadow": Now, finally draw the shadow geometry's "back" with these settings:

glPolyFmt(POLY_ALPHA(20) | POLY_CULL_BACK | POLY_ID(63) | POLY_SHADOW);

(alpha needs to be between 1 to 30, but this time ID MUST NOT be 0):

Now you should have a volume shadow on screen. Repeat steps two and three for all other shadow geometry.

Compatibility

Emulators: When using FCSR, it is mostly compatible with no$gba 2.6. (The emulator is still missing some features.) Other emulators are not supported.

Hardware: Compatible with DLDI-able FAT cards - tested with SLOT1 M3 Real via the firmware's autopatching. Through FCSR, it is also compatible with older SLOT2 (GBA) NOR cartridges - tested with NeoFlash 512Mb.

Changelog

Advertising: