Cel-shaded TMD Rendering Example (plus low-level GTE stuff)

Programming examples for the Psy-Q SDK
Post Reply
User avatar
LameGuy64
Psy-Q Enthusiast
Psy-Q Enthusiast
Posts: 381
Joined: April 10th, 2013, 3:47 pm
I am a: Hobbyist Game Developer
Motto: Commercial or not, play it!
PlayStation Model: H2000/7000
Location: Philippines
Contact:

Cel-shaded TMD Rendering Example (plus low-level GTE stuff)

Post by LameGuy64 » September 13th, 2015, 12:25 pm

Well... I somehow managed to achieve what was thought to be impossible to do on the PlayStation and that is cel-shading 8-):
Image

Basically, what I did was using the resulting vertex colors after passing through light source calculation as texcoords which then maps to a texture of 3 color tones... Its essentially the same technique used in many games that utilized cel-shading before pixel shaders became dominant on graphics processors.

This example also demonstrates the use of low-level GTE macros as a faster alternative to RotTransPers3() and NormalColorCol3() which are essential to writing fast custom 3D graphics routines.
You do not have the required permissions to view the files attached to this post.
Please don't forget to include my name if you share my work around. Credit where it is due.

Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.

DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.

User avatar
CyrusDevX
Active PSXDEV User
Active PSXDEV User
Posts: 47
Joined: August 7th, 2015, 1:34 pm

Re: Cel-shaded TMD Rendering Example (plus low-level GTE stu

Post by CyrusDevX » September 19th, 2015, 1:57 am

very cool. GJ ^^

User avatar
Rubiyooo
Interested PSXDEV User
Interested PSXDEV User
Posts: 8
Joined: April 1st, 2016, 5:58 pm
I am a: 3d Modeler, Artist
Skype: Rubiyooo
Steam: rubiyooo
Location: Spain

Re: Cel-shaded TMD Rendering Example (plus low-level GTE stu

Post by Rubiyooo » July 5th, 2016, 1:45 am

Good works dear LameGuy3D. I would like to make graphics with this technique :)

Mills
Curious PSXDEV User
Curious PSXDEV User
Posts: 14
Joined: May 3rd, 2016, 11:21 pm

Re: Cel-shaded TMD Rendering Example (plus low-level GTE stuff)

Post by Mills » March 29th, 2020, 4:02 am

I know this is a very old thread, but it would be awesome if someone could modify this to make environment mapping textures.

I tried with a simple "asteroid" shape... but my programming and math skills are really bad.
Maybe LameGuy64 will add env-mapping to PSn00bSDK.

EDIT: I copied one of the samples in the psyq folder and I got it :). I plan to make a little library and a demo using psyq. But if PSn00bSDK is updated, maybe I will use it.
You do not have the required permissions to view the files attached to this post.

User avatar
Abelliqueux
Curious PSXDEV User
Curious PSXDEV User
Posts: 18
Joined: April 29th, 2016, 7:03 am
I am a: wannabee PSX dev
Motto: nope, bicycle
PlayStation Model: 7502/5502
Want to Find: knowledge !
Looking to: learn and share
Location: PAL
Contact:

Re: Cel-shaded TMD Rendering Example (plus low-level GTE stuff)

Post by Abelliqueux » June 27th, 2020, 4:11 am

Studying this example right now. Here is the modified makefile I came up with, based on yours LameGuy64, in order to compile in Linux :

Be mindful that you may have to change the paths in the following script.

Code: Select all

# Run this makefile in GNU/Linux.

WORKING_DIR = TMDCEL

#16-bits DOS exes run in Dosbox
RSDLINK     = "C:\PSYQ\BIN\RSDLINK.EXE"
DMPSX       = "C:\PSYQ\BIN\DMPSX.EXE"
CPE2X       = "C:\PSYQ\BIN\CPE2X.EXE"

TARGET  = main
ADDRESS	= 0x80010000

CFLAGS	= -O3 -Wall

all:
       # Convert suzanne RSD to TMD
       
	echo @echo on > dosbox.bat
	echo D: >> dosbox.bat
	echo cd "D:\$(WORKING_DIR)" >> dosbox.bat
	echo $(RSDLINK) -s 30.0 -o "SUZANNE\SUZANNE.TMD" "SUZANNE\SUZANNE.RSD" >> dosbox.bat
	echo exit >> dosbox.bat
	dosbox -c "D:\$(WORKING_DIR)\DOSBOX"
	rm dosbox.bat
	
	# Convert TMD to C
	bin2h.exe suzanne/suzanne.tmd suzanne/suzanne.c tmd_suzanne -nosize

        # build tmdcel.obj
	CCPSX.EXE $(CFLAGS) -c tmdcel.c
       
       # Pre-process tmdcel.obj with dmpsx
	echo @echo on > dosbox.bat
	echo D: >> dosbox.bat
	echo cd "D:\$(WORKING_DIR)" >> dosbox.bat
	echo $(DMPSX) tmdcel.obj >> dosbox.bat
	echo exit >> dosbox.bat
	dosbox -c "D:\$(WORKING_DIR)\DOSBOX"
	rm dosbox.bat
        
        #build CPE and SYM
	CCPSX.EXE -Xo$(ADDRESS) $(CFLAGS) main.c loadtim.c tmdcel.obj suzanne/suzanne.c celmap.c -o$(TARGET).cpe,$(TARGET).sym
	
	# Convert CPE to PSX EXE
	echo @echo on > dosbox.bat
	echo D: >> dosbox.bat
	echo cd "D:\$(WORKING_DIR)" >> dosbox.bat
	echo $(CPE2X) MAIN.CPE >> dosbox.bat
	echo exit >> dosbox.bat
	dosbox -c "D:\$(WORKING_DIR)\DOSBOX"
	rm dosbox.bat


Psy-Q is setup with Wine as per https://github.com/electrobs/PSYQ_Examples and you have to put this in the 'autoexec' section of dosbox.conf :

Code: Select all

[autoexec]
# Lines in this section will be run at startup.
# You can put your MOUNT lines here.

# this is where the psyq folder is
MOUNT C ~/.wine/drive_c 
# this is the folder where I unzip the examples
MOUNT D ~/build/PSYQ_Examples
# change to C:
C:
#go to the binary folder
cd psyq\bin
#clear screen
CLS
Additionally, you have to get bin2h.exe here : https://github.com/apiraino/psx_tapper/ ... /bin2h.exe
and put it in '~/.wine/drive_c/psyq/bin' .

Hope it helps someone !
Hardware : SCPH-5502 + Psnee Attiny45, SCPH-7502 + Psnee Attiny85, Gamehunter CD version + Unirom, Gamehunter CD Lite + Unirom
https://wiki.arthus.net - https://psx.arthus.net

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest