Page 2 of 3

Re: 3D FPS Example

Posted: November 7th, 2018, 12:23 pm
by Shadow
Very cool 3D environment :)

Re: 3D FPS Example

Posted: November 7th, 2018, 2:20 pm
by LameGuy64
Yeah, TMD is not exactly suitable for rendering large 3D environments so a serious developer would often make their own rendering system. More sophisticated renderers have stuff like mipmaps and geometry LOD as seen in the Spyro games.

The TMD rendering functions are also pretty bloat and have some limitations to them such as limited control in translucency and not much in the way of special effects such as environment mapping.

Re: 3D FPS Example

Posted: November 7th, 2018, 8:00 pm
by NITROYUASH
make their own rendering system
*oof*
Okay, sounds hard. Very hard.

Re: 3D FPS Example

Posted: November 8th, 2018, 1:43 am
by lamb_of_senpai
NITROYUASH wrote: November 7th, 2018, 8:00 pm
make their own rendering system
*oof*
Okay, sounds hard. Very hard.
It looks like you've got a fairly rectilinear environment, so why not just extend/refine Lameguy64's original method? It looks like you're already working with tiles, so one thing you could do is write your own Blender script to export just the tile location/orientation, size, and associated texture in your own custom format, then write a set of functions to import, generate the geometry, and display it. There are plenty of "cheats" you could do—for instance you could use only a predetermined set of orientations/sizes stored as bit flags to get the read time up, make your exporter merge large groups of contiguous tiles using the same texture into single large tiles, etc. Of course, this wouldn't give you the kind of detail/variety found in a game like Spyro, but it's a good place to start, and you could of course extend this method to include non-tile meshes.

Re: 3D FPS Example

Posted: November 15th, 2018, 7:39 am
by NITROYUASH
UPD:
Thanks to Lameguy and this awesome 3D example, i did something like that.
► Show Spoiler
It looks like I still have a lot of work, but it's working :p

Re: 3D FPS Example

Posted: November 15th, 2018, 11:01 am
by LameGuy64
You may want to take a look at this example I made a long time ago that demonstrates how to do 3D transformations with the GTE directly using macros. It is much faster than RotTransPersp3() and gives you more control on how the GTE is being utilized.

You'll need to use dmpsx to convert the weird word codes used in the GTE macro headers to the correct cop2 instructions in your PS-EXE or object file. The Programmer's Tool CD 2.2 has a 32-bit version of dmpsx in it. Alternatively, you can replace the .dw <whatever code> directives in the GTE macros into cop2 instructions to eliminate the need to use dmpsx.

Re: 3D FPS Example

Posted: November 15th, 2018, 12:05 pm
by NITROYUASH
Sounds great. I will try to work with this code too :)

Re: 3D FPS Example

Posted: December 19th, 2018, 8:06 pm
by NITROYUASH
I have a small question about Blender and PS1 geometry. I don't want to make another theme so I will describe the problem here.

So this is the test-map (Blender):
► Show Spoiler
And this how it's look in PS1 (after Axis Conversion in Blender ( axis_conversion(to_forward='-Z', to_up='-Y').to_4x4() ) with SVECTOR VX VY VZ)
► Show Spoiler
with SVECTOR VX VY -VZ:
► Show Spoiler
Better than nothing, but now my model is mirrored.

UPD:
Fixed. It was a problem with my code (?).

Code: Select all

		nclip = RotAverageNclip4(
			&vp[0], &vp[1], &vp[2], &vp[3], 
			(long *)&obj->x0, (long *)&obj->x1, 
			(long *)&obj->x3, (long *)&obj->x2,
			&p, &OTz, &Flag);
Fix:

Code: Select all

		nclip = RotAverageNclip4(
			&vp[3], &vp[2], &vp[1], &vp[0], 
			(long *)&obj->x0, (long *)&obj->x1, 
			(long *)&obj->x3, (long *)&obj->x2,
			&p, &OTz, &Flag);

Re: 3D FPS Example

Posted: February 3rd, 2019, 4:10 am
by NITROYUASH
Hmm... I wonder to know how to fix this lines(?) between quads.

Image

Re: 3D FPS Example

Posted: February 3rd, 2019, 10:30 am
by gwald
I think it's because of the lack of float precision (but I get this even with floats on 3DS :? ).
The only way I know how to fix it, is to use vector lookups (indices), ie use the same exact vectors that the surrounding faces use.
But it could be the emulator being over precise, try a different render or emulator... try it on hardware and even on a CTR screen, it might not even be noticeable...

Re: 3D FPS Example

Posted: February 3rd, 2019, 4:03 pm
by Shadow
It would be from the PCSXR emulator. Use real hardware like gwald said.

Re: 3D FPS Example

Posted: February 3rd, 2019, 7:50 pm
by NITROYUASH
This is not an emulator problem.
Tested on PCSXR, EPSXE, NO$PSX and PS3.
The only way I know how to fix it, is to use vector lookups (indices), ie use the same exact vectors that the surrounding faces use.
Examples? :0

Re: 3D FPS Example

Posted: February 3rd, 2019, 11:42 pm
by Sblorgz
The official way to do that is to fill the holes with degenerated triangles (i.e. rendered as textured lines).

Re: 3D FPS Example

Posted: February 4th, 2019, 12:19 am
by LameGuy64
The seams happen when there are two connecting polygons (tris and quads) that are subdivided at different levels and the point of the quad that is subdivided does not always line up with the edge of a lesser subdivided or undivided quad.

Usual workarounds according to the PlayStation documents is to sort very thin triangle strips around the edges of a subdivided quad. That's what my custom quad subdivision routines do to hide the seams though the seams will become visible again when transparency is used.

Re: 3D FPS Example

Posted: February 4th, 2019, 5:57 am
by NITROYUASH
The seams happen when there are two connecting polygons (tris and quads) that are subdivided at different levels and the point of the quad that is subdivided does not always line up with the edge of a lesser subdivided or undivided quad.
I confirm this. After some tests with division, i managed reduce the seams. Thanks!

Re: 3D FPS Example

Posted: March 30th, 2019, 12:38 am
by NITROYUASH
I have a question about UV for plane(s):

Previously i was using this function:
setUVWH(obj_ft4, U_out, V_out, W_out, H_out);
► Show Spoiler
But this isn't working with POLY_FT3.

Now i want to use this 2 functions:
setUV3(obj_ft3, U0,V0, U1,V1, U2,V2);
setUV4(obj_ft3, U0,V0, U1,V1, U2,V2, U3,V3);

How to set the UV correctly for POLY_FT3 and POLY_FT4 using the UV3/UV4?

Texture Info:
► Show Spoiler
Thanks c:

Re: 3D FPS Example

Posted: March 30th, 2019, 1:20 pm
by LameGuy64
setUVWH() just sets all 4 UV coordinates of a quad based on the values you've specified to its arguments. The macro basically does:

Code: Select all

obj_ft4->u0 = U_out;
obj_ft4->v0 = V_out;
obj_ft4->u1 = U_out+W_out;
obj_ft4->v1 = V_out;
obj_ft4->u2 = U_out;
obj_ft4->v2 = V_out+H_out;
obj_ft4->u3 = U_out+W_out;
obj_ft4->v3 = V_out+H_out;
Assuming U_out and V_out are basically offsets of the texture image relative to its tpage you'll have to do it like this if you want to use setUV* macros:

Code: Select all

setUV3(obj_ft3, U_out, V_out, U_out+W_out, V_out, U_out, V_out+H_out);
setUV4(obj_ft4, U_out, V_out, U_out+W_out, V_out, U_out, V_out+H_out, U_out+W_out, V_out+H_out);

Re: 3D FPS Example

Posted: March 30th, 2019, 8:49 pm
by NITROYUASH
Almost working. The texture is flipped to the right :D
► Show Spoiler
Quick fix for me:

Code: Select all

setUV3(obj_ft3, U_out+W_out,V_out, U_out+W_out,V_out+H_out, U_out,V_out);
► Show Spoiler

Re: 3D FPS Example

Posted: March 31st, 2019, 1:04 am
by likeabaus
I'm a bit late to the party here, but this is quite impressive LameGuy64!

3D rendering is not an easy task for homebrew developers on the original PlayStation . This is pretty freakin' cool!

Re: 3D FPS Example

Posted: July 12th, 2019, 5:33 am
by MihaiGamerXD
Nice example LameGuy64! But I have one more problem. I want to set the resolution to 640x480, but the screen is glitchy!
How can I fix that?