Simple 3D graphics sample

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

Simple 3D graphics sample

Post by LameGuy64 » March 3rd, 2014, 12:20 am

I finally managed to figure out how the 3D graphics system of the PlayStation works and was able to make a nice little sample for you guys to learn from as there hasn't been a good 3D graphics example for a long while.

Image

Unfortunately, this sample only uses flat shaded triangles but I might make another similar sample soon but with texture mapped triangles in a form of a little 3D game engine.
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
Shendo
C Programming Expert
C Programming Expert
Posts: 238
Joined: March 21st, 2012, 4:34 am
I am a: Programmer
Motto: Never settle
PlayStation Model: SCPH-9002
Location: Croatia, EU

Re: Simple 3D graphics sample

Post by Shendo » March 4th, 2014, 5:12 pm

Agreed. We definitely need more 3d stuff.
My PS1 consoles: 2 x SCPH-1002, SCPH-5552, SCPH-7002, 4x SCPH-9002, 2 x SCPH-102.
Dev console: SCPH-9002, MM3 - 7 wire modchip, PAL color mod, CH340 serial cable addon.

TheDukeOfZill
What is PSXDEV?
What is PSXDEV?
Posts: 1
Joined: April 7th, 2014, 10:04 am

Re: Simple 3D graphics sample

Post by TheDukeOfZill » April 7th, 2014, 10:31 am

I'm looking to start making 3D homebrew PSX games and this really helped. I made a script to export a model from Blender into this same format you're using, with the exception that it doesn't store duplicate vertices and instead contains an array of indices to the shared vertices. I realize the vertex data is stored as shorts, so this actually uses more memory, but it's more organized this way IMHO. http://pastebin.com/suU9DigB

The only modification I really had to make to get it to work this way (aside from changing the mesh name) was to change

Code: Select all

RotTransPers(&modelCube_mesh[t]...
to

Code: Select all

RotTransPers(&modelCube_mesh[modelCube_index[t]]...
Definitely looking forward to any more progress you make!

User avatar
bizarro2011
Serious PSXDEV User
Serious PSXDEV User
Posts: 118
Joined: March 27th, 2012, 9:09 pm
Skype: abernardo2011
Location: Brazil

Re: Simple 3D graphics sample

Post by bizarro2011 » April 12th, 2014, 11:47 am

very good, will create a table to write text and numbers. :clap

Tommy
Active PSXDEV User
Active PSXDEV User
Posts: 48
Joined: April 19th, 2014, 8:16 am

Re: Simple 3D graphics sample

Post by Tommy » April 24th, 2014, 1:56 pm

Good stuff.

Re: the dangling comment about RotMeshPrimS_F3; my reading of the documentation is that the MeshPrimS functions expect a triangle strip — the first three vertices define one triangle, then every subsequent vertex defines one further triangle. You've listed each triangle uniquely — the first three vertices define one triangle, then every subsequent three vertices define one further triangle. So that could be why that didn't work.

ZackVL
Interested PSXDEV User
Interested PSXDEV User
Posts: 8
Joined: September 6th, 2015, 6:57 pm
I am a: New Programmer
PlayStation Model: SCPH-9002
Location: Greece

Re: Simple 3D graphics sample

Post by ZackVL » September 10th, 2015, 11:08 pm

can you post the make file?

User avatar
Shadow
Admin / PSXDEV
Admin / PSXDEV
Posts: 2262
Joined: December 31st, 2012, 5:37 pm
PlayStation Model: H2000/5502

Re: Simple 3D graphics sample

Post by Shadow » September 10th, 2015, 11:38 pm

The MAKEFILE would be basically the same as the one in your 'helowrld' example because of its simplistic primary C file, "primdraw.c".

Code: Select all

# -----------------------------------------
#       PlayStation 1 Psy-Q Makefile
# -----------------------------------------

all:
	del mem.map
	del main.sym
	del main.exe
	del main.cpe
	cls

	ccpsx -Xo$80010000 primdraw.c -oprimdraw.cpe,primdraw.sym,mem.map
	cpe2x primdraw.cpe
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), PSIO Switch Board, DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.

PlayStation Development PC: Windows 98 SE, Pentium 3 at 400MHz, 128MB SDRAM, DTL-H2000, DTL-H2010, DTL-H201A, DTL-S2020 (with 4GB SCSI-2 HDD), 21" Sony G420, CD-R burner, 3.25" and 5.25" Floppy Diskette Drives, ZIP 100 Diskette Drive and an IBM Model M keyboard.

ZackVL
Interested PSXDEV User
Interested PSXDEV User
Posts: 8
Joined: September 6th, 2015, 6:57 pm
I am a: New Programmer
PlayStation Model: SCPH-9002
Location: Greece

Re: Simple 3D graphics sample

Post by ZackVL » September 11th, 2015, 12:22 am

thank's shadow!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest