Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Volumetric Shadow Demo: Difference between revisions

From GameBrew
No edit summary
m (Text replacement - "|download=https://dlhb.gamebrew.org/dshomebrew/" to "|download=https://dlhb.gamebrew.org/dshomebrew2/")
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Infobox homebrew
{{Infobox DS Homebrews
| title       = Volumetric Shadow Demo
|title=Volumetric Shadow Demo
| image       =  
|image=vsd.png
| type       = Demo
|description=NDS Tech Demo, formerly know as the Stencil Shadow Demo.
| version     = 1.60
|author=Rob (silent_code, R.H.L.)
| licence    = Mixed
|lastupdated=2024/08/05
| author      = Rob (silent_code, R.H.L.)
|type=Demos
| website     = http://www.robs-basement.de/#RB_NDS_VSD
|version=1.7.1
| download    = Media:Vsd160ds.rar
|license=Mixed
| source     = Media:Vsd160src.rar
|download=https://dlhb.gamebrew.org/dshomebrew2/vsd.7z
|website=http://www.robs-basement.de/#RB_NDS_VSD
|source=https://github.com/AntonioND/volumetric_shadow_demo
}}
}}
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.


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.
In 2024, the demo was ported to [https://github.com/blocksds/sdk BlocksDS] by AntonioND to support modern tools.


==Features==
==Features==
Line 26: Line 29:


==Installation==
==Installation==
<tabber>
|-|BlocksDS port=
Copy the .nds file to your storage device.
|-|Neoflash compo ver.=
Copy the .nds file to the root of your card.  
Copy the .nds file to the root of your card.  


Line 33: Line 43:


Create the data directory, if not already present on your card.
Create the data directory, if not already present on your card.
</tabber>


'''Files that need to be copied:'''  
'''Files that need to be copied:'''  
Line 52: Line 63:
Prepare the hardware by setting the flush mode to manual and w-depth sorting with:
Prepare the hardware by setting the flush mode to manual and w-depth sorting with:
  glFlush(GL_TRANS_MANUALSORT | GL_WBUFFERING);
  glFlush(GL_TRANS_MANUALSORT | GL_WBUFFERING);
 
Do so in the frame before the frame you will draw the shadows. Usually, you would set this up when initializing the application and flush each frame with those settings.
Do so in the frame before the frame you will draw the shadows. Usually, you would set this up when initializing the application and flush each frame with those settings.


Line 64: Line 75:
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:
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);
  glPolyFmt(POLY_ALPHA(1) | POLY_CULL_FRONT | POLY_ID(0) | POLY_SHADOW);
 
Alpha must be between 1 and 30 and ID also must be 0.
Alpha must be between 1 and 30 and ID also must be 0.
   
   
3) The Stencil Shadow: Now, finally draw the shadow geometry's back with these settings:
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);
  glPolyFmt(POLY_ALPHA(20) | POLY_CULL_BACK | POLY_ID(63) | POLY_SHADOW);
 
Again, alpha needs to be between 1 and 30, but this time ID must not be 0.  
Again, alpha needs to be between 1 and 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.
Now you should have a volume shadow on screen. Repeat steps two and three for all other shadow geometry.


Tutorials can be found at [http://www.code-basement.net/files/nds/vsd/volumetric-shadows-nds.tutorial.txt the offical site].
Tutorials can be found at [http://www.code-basement.net/files/nds/vsd/volumetric-shadows-nds.tutorial.txt the official website].


==Controls==
==Controls==
Line 99: Line 110:
L+D-Pad - Move the camera (up/down)
L+D-Pad - Move the camera (up/down)


R+L+up / down - Change the brightness
R+L+Up/Down - Change the brightness


R+L+Start - Reset the scene and the brightness
R+L+Start - Reset the scene and the brightness
==Screenshots==
https://dlhb.gamebrew.org/dshomebrew/vsd2.png
https://dlhb.gamebrew.org/dshomebrew/vsd3.png


==Compatibility==
==Compatibility==
Line 113: Line 128:


==Changelog==
==Changelog==
'''Revision 7.1'''
* Update format of documentation.
'''Revision 7.0'''
* Migrated to BlocksDS.
* Switched to using NitroFS instead of libfat.
'''Revision 6.0'''
'''Revision 6.0'''
* Fixed the tutorial (thanks to zeruda at gabdev).
* Fixed the tutorial (thanks to zeruda at gabdev).
Line 208: Line 230:
Also, greetings to everybody at the gbadev.org forums.
Also, greetings to everybody at the gbadev.org forums.


<br>
==External links==
[[Category:DS homebrew applications]]
* Author's website - http://www.robs-basement.de/#RB_NDS_VSD
[[Category:DS homebrew demos]]

Latest revision as of 11:12, 16 August 2024

Volumetric Shadow Demo
Vsd.png
General
AuthorRob (silent_code, R.H.L.)
TypeDemos
Version1.7.1
LicenseMixed
Last Updated2024/08/05
Links
Download
Website
Source

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.

In 2024, the demo was ported to BlocksDS by AntonioND to support modern tools.

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.

Installation

Copy the .nds file to your storage device.

Copy the .nds file to the root of your card.

You will see all (data) files are located in the vsd_data directory.

Copy them into the /data/ folder on the root of your card. Or alternatively, directly into the root.

Create the data directory, if not already present on your card.

Files that need to be copied:

vsd_###.nds (or vsd_###_fcsr.nds, in which case nothing else is needed)
doll.char
room.char
shadow.char
font.pbi
splash.pbi
loading.pbi
doll256.tga
test.tga

Depending on your device, you may have to manually patch the .nds file to make it work with DLDI. Your card's manufacturer can help you with how to accomplish that.

User guide

Initialization

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, you would set this up when initializing the application and flush each frame with those settings.

You might need to sort your translutient polygons/meshes. Remember, that certain volumetric shadow geometry configurations will cause artifacts.

Render volumetric shadows

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 and 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);

Again, alpha needs to be between 1 and 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.

Tutorials can be found at the official website.

Controls

During demo:

Touch (Stylus) - Look

D-Pad - Move the camera (forward/backward)

A/B/X/Y - Move the character

Start - Reset scene

Select+A - toggle shadowing

Select+B - toggle texturing

Select+X - toggle lighting

Select+Y - toggle capturing (motion blur)

R+D-Pad - Move a scissor box

L+D-Pad - Move the camera (up/down)

R+L+Up/Down - Change the brightness

R+L+Start - Reset the scene and the brightness

Screenshots

vsd2.png vsd3.png

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

Revision 7.1

  • Update format of documentation.

Revision 7.0

  • Migrated to BlocksDS.
  • Switched to using NitroFS instead of libfat.

Revision 6.0

  • Fixed the tutorial (thanks to zeruda at gabdev).
  • Fixed a typo in the readme (thanks to jello!) and updated it.
  • Cleaned up console initialization and proper use of libnds' definitions.
  • Fixed material/lighting bug.
  • Added and fixed come source comments.
  • Fixed initialization function.
  • Fixed the view class and its usage.
  • Replaced the floating point gluPerspective() whith its fixed point counterpart.
  • Reworked some parts of the mesh rendering.
  • Removed last bits of "useless stuff."

Revision 5.1

  • Refactored and fixed the scissor class.
  • Fixed fopen() usage.
  • Reduced file path to 31 (+ \0) characters and renamed some files.
  • Cleaned up glEnable() usage.
  • Added vertex and primitive list RAM usage display.
  • Added free render buffer lines display.
  • Readme has been fixed and updated.

Revision 5.0

  • Renamed to "Volumetric Shadow Demo".
  • Fixed input bug: textures could not be toggled.
  • Fixed: Single "include all" header style was remedied with only including and declaring what is needed in each compilation unit.
  • Restructured some source files.
  • Removed ARM7 source file and rearranged the project to ARM9 only (Using the default ARM7 binary).
  • Changed to unmodified default Makefile.
  • Changed the source usage "policy" a little bit.
  • Separated the tutorial from the readme.
  • Readme has been updated accordingly.

Revision 4.0

  • Did quite some source clean-up, rewriting and rearranging.
  • Added view and scissor box classes.
  • Added data directory support.
  • Added better error detection and handling.
  • Changed fog table generation.
  • Refactored a lot of variables and functions.
  • Added some more comments.
  • Fixed some typos in the readme and updated it.

Revision 3.0

  • Changed file system to libfat.
  • Added frame rate counter.
  • Added touch input smoothing (still need to fix the slight drifting).
  • Fixed the fog color.
  • Rearranged and cleaned up the sources.
  • Updated and fixed the readme.
  • Cleaned up and fixed the tutorial.

Revision 2.0

  • Moved to devkitARM R23b.
  • Updated to libnds 20071023.
  • Fixed the readme.
  • Slightly changed the .pbi format - old data and routines are incompatible.
  • Fixed "odd" loading routines.
  • Fixed some minor bugs.
  • Cleaned up the sources a little bit.
  • Added some info about the .tga format in "tgaloader.cpp".
  • Added an overview of controls to the bottom screen.

Revision 1.2

  • Fixed and rearranged some things in the readme.
  • Changed the term "shadow volumes" to the more precise term "volume shadows" in the readme.
  • Added a tutorial section.
  • Updated to libnds 20070503.
  • Added hardware fog.
  • Added capture support and a slight motion blur effect.
  • Added some new controls.

Revision 1.1

  • Fixed and rearranged some things in the readme.
  • Updated to libnds 2007050.
  • Removed my FIX versions of previously 'broken' libnds funktions.

Revision 1.0

  • Fixed and added things to the readme: additional thanks, change log, controls etc.
  • Replaced the shadow volume with a better suited (and simpler) one.
  • Fixed the controls.

1.0.0

  • Initial release.

Credits

It was built with devkitARM R23b, libnds 20071023 and libfat 20070127 from the libnds "touch_look" example (as a project kick-start), so credit and thanks go out to their respective authors.

Credit also goes to gabebear for the scissor pick matrix implementation.

Very special thanks go out to Larry E. and Brandon M. for helping with the hardware.

Special thanks to tepples, simonjhall and Alphanoob.

Also, greetings to everybody at the gbadev.org forums.

External links

Advertising: