Page 1 of 1

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

Posted: September 13th, 2015, 12:25 pm
by LameGuy64
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.

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

Posted: September 19th, 2015, 1:57 am
by CyrusDevX
very cool. GJ ^^

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

Posted: July 5th, 2016, 1:45 am
by Rubiyooo
Good works dear LameGuy3D. I would like to make graphics with this technique :)

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

Posted: March 29th, 2020, 4:02 am
by Mills
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.

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

Posted: June 27th, 2020, 4:11 am
by Abelliqueux
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 !